- Timestamp:
- Sep 12, 2017, 11:26:33 AM (7 years ago)
- Location:
- trunk/lib/FlairSensorActuator/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSensorActuator/src/Mb800.cpp
r194 r196 43 43 44 44 void Mb800::Run(void) { 45 char response[200] = {0}; 46 int size,written; 45 int written; 47 46 48 47 /** Debut config **/ … … 103 102 /** Debut running loop **/ 104 103 WarnUponSwitches(true); 105 104 106 105 while (!ToBeStopped()) { 107 //SleepMS(10);??108 size = 0;106 char response[1024] = {0}; 107 int size = 0; 109 108 while (!ToBeStopped()) { 110 109 ssize_t read = serialport->Read(&response[size], 1); … … 113 112 } 114 113 115 if (response[size] == 0x0a) 116 break; 114 if (response[size] == 0x0a ) break; 117 115 size++; 116 if (size==sizeof(response)) break; 118 117 } 119 size++; 120 parseFrame(response, size); 118 if (size!=sizeof(response)) { 119 size++; 120 parseFrame(response, size); 121 } else { 122 Thread::Warn("frame too long for buffer\n"); 123 } 121 124 } 125 122 126 /** fin running loop **/ 123 127 WarnUponSwitches(false); -
trunk/lib/FlairSensorActuator/src/NeoM8N.cpp
r195 r196 42 42 43 43 void NeoM8N::Run(void) { 44 char response[200] = {0}; 45 int size,written; 46 47 //turn off all mesages 44 45 //turn off all messages 48 46 { 49 47 char tx[]={0x06, 0x01, 0x03, 0, 0xf0, 0,0}; … … 82 80 83 81 while (!ToBeStopped()) { 84 //SleepMS(10);??85 size = 0;82 char response[1024] = {0}; 83 int size = 0; 86 84 while (!ToBeStopped()) { 87 85 ssize_t read = serialport->Read(&response[size], 1); … … 90 88 } 91 89 92 if (response[size] == 0x0a) 93 break; 90 if (response[size] == 0x0a ) break; 94 91 size++; 92 if (size==sizeof(response)) break; 95 93 } 96 size++; 97 parseFrame(response, size); 94 if (size!=sizeof(response)) { 95 size++; 96 parseFrame(response, size); 97 } else { 98 Thread::Warn("frame too long for buffer\n"); 99 } 98 100 } 99 101 /** fin running loop **/ -
trunk/lib/FlairSensorActuator/src/Novatel.cpp
r170 r196 42 42 43 43 void Novatel::Run(void) { 44 char response[200] = {0};45 int size;46 44 ssize_t written; 47 45 … … 62 60 63 61 while (!ToBeStopped()) { 64 size = 0;65 while (1) {66 // ssize_t read = rt_dev_read(uart_fd, &response[size],1);67 ssize_t Read = serialport->Read(&response[size], 1);68 if ( Read < 0) {69 Thread::Err("erreur Read (%s)\n", strerror(- Read));62 char response[1024] = {0}; 63 int size = 0; 64 while (!ToBeStopped()) { 65 ssize_t read = serialport->Read(&response[size], 1); 66 if (read < 0) { 67 Thread::Err("erreur Read (%s)\n", strerror(-read)); 70 68 } 71 if (response[size] == 0x0a) 72 69 70 if (response[size] == 0x0a ) break; 73 71 size++; 72 if (size==sizeof(response)) break; 74 73 } 75 size++; 76 parseFrame(response, size); 74 if (size!=sizeof(response)) { 75 size++; 76 parseFrame(response, size); 77 } else { 78 Thread::Warn("frame too long for buffer\n"); 79 } 77 80 } 78 81
Note:
See TracChangeset
for help on using the changeset viewer.