Changeset 41 in flair-src for trunk/lib/FlairSensorActuator
- Timestamp:
- Jun 28, 2016, 3:20:04 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSensorActuator/src/Mb800.cpp
r15 r41 43 43 /** Debut init **/ 44 44 char response[200] = {0}; 45 int size ;45 int size,written; 46 46 47 47 /** Fin init **/ … … 49 49 /** Debut config **/ 50 50 char to_send[] = "$PASHS,NME,ALL,A,OFF\r\n"; 51 serialport->Write(to_send, sizeof(to_send)); 52 51 written=serialport->Write(to_send, sizeof(to_send)); 52 if (written< 0) { 53 Thread::Err("erreur Write (%s)\n", strerror(-written)); 54 } 55 /* 53 56 { 54 57 char to_send[] = "$PASHS,CPD,AFP,95.0\r\n"; 55 serialport->Write(to_send, sizeof(to_send)); 58 written=serialport->Write(to_send, sizeof(to_send)); 59 if (written< 0) { 60 Thread::Err("erreur Write (%s)\n", strerror(-written)); 61 } 56 62 } 57 63 { 58 64 char to_send[] = "$PASHS,DIF,PRT,C,RT3\r\n"; 59 serialport->Write(to_send, sizeof(to_send)); 65 written=serialport->Write(to_send, sizeof(to_send)); 66 if (written< 0) { 67 Thread::Err("erreur Write (%s)\n", strerror(-written)); 68 } 60 69 } 61 70 */ 62 71 if ((NMEAFlags & GGA) != 0) { 63 72 char to_send[] = "$PASHS,NME,GGA,A,ON,0.05\r\n"; 64 size = serialport->Write(to_send, sizeof(to_send)); 65 // Printf("ecrit %i\n",size); 73 written = serialport->Write(to_send, sizeof(to_send)); 74 if (written< 0) { 75 Thread::Err("erreur Write (%s)\n", strerror(-written)); 76 } 66 77 } 67 78 if ((NMEAFlags & VTG) != 0) { 68 79 char to_send[] = "$PASHS,NME,VTG,A,ON,0.05\r\n"; 69 size = serialport->Write(to_send, sizeof(to_send)); 70 // Printf("%i\n",size); 80 written = serialport->Write(to_send, sizeof(to_send)); 81 if (written< 0) { 82 Thread::Err("erreur Write (%s)\n", strerror(-written)); 83 } 71 84 } 72 85 if ((NMEAFlags & GST) != 0) { 73 86 char to_send[] = "$PASHS,NME,GST,A,ON,0.05\r\n"; 74 size = serialport->Write(to_send, sizeof(to_send)); 75 // Printf("%i\n",size); 87 written = serialport->Write(to_send, sizeof(to_send)); 88 if (written< 0) { 89 Thread::Err("erreur Write (%s)\n", strerror(-written)); 90 } 76 91 } 77 92 … … 84 99 85 100 while (!ToBeStopped()) { 101 //Printf("loop\n"); 86 102 SleepMS(10); 87 size = 0; 103 size = 0;/* 88 104 while (!ToBeStopped()) { 89 105 ssize_t read = serialport->Read(&response[size], 1); … … 95 111 break; 96 112 size++; 97 } 113 }*/ 98 114 size++; 99 parseFrame(response, size);115 //parseFrame(response, size); 100 116 } 101 117 /** fin running loop **/ … … 106 122 char data = 0; 107 123 ssize_t read = 0; 108 124 Printf("sync\n"); 109 125 // attente fin trame 110 while (data != 0x0a ) {126 while (data != 0x0a && !ToBeStopped()) { 111 127 read = serialport->Read(&data, 1); 128 SleepMS(10); 129 Printf("%i %x\n",read,data); 112 130 if (read < 0) { 113 131 Thread::Err("erreur Read (%s)\n", strerror(-read));
Note:
See TracChangeset
for help on using the changeset viewer.