Dependents: AutonomousDAQ AutonomousDAQ
Revision 10:29301aaa8c33, committed 2018-08-08
- Comitter:
- uci1
- Date:
- Wed Aug 08 21:00:41 2018 +0000
- Parent:
- 9:1562f78c4d3c
- Commit message:
- Fixed EOL termination for SBD comms, replacing \r\n with \r (or something like that)
Changed in this revision
SnCommSBD.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1562f78c4d3c -r 29301aaa8c33 SnCommSBD.cpp --- a/SnCommSBD.cpp Fri Oct 30 04:19:49 2015 +0000 +++ b/SnCommSBD.cpp Wed Aug 08 21:00:41 2018 +0000 @@ -3,7 +3,7 @@ #ifdef ENABLE_SBD -//#define DEBUG +#define DEBUG #include <stdint.h> #include <vector> @@ -180,15 +180,28 @@ for (uint32_t i=0; i<length; ++i, ++d) { cs.u += *d; } - DoIO(smhead, SnHeaderFrame::SizeOf(), timeout_clock, + uint32_t bsent(0); + bsent = DoIO(smhead, SnHeaderFrame::SizeOf(), timeout_clock, &SnCommSBD::PutC, &SnCommSBD::SerialWriteable); - DoIO(data, length, timeout_clock, +#ifdef DEBUG + printf("SendSBD: header DoIO returned %u\r\n", bsent); +#endif + bsent = DoIO(data, length, timeout_clock, &SnCommSBD::PutC, &SnCommSBD::SerialWriteable); +#ifdef DEBUG + printf("SendSBD: data DoIO returned %u\r\n", bsent); +#endif // now least significant bytes of the checksum (in big-endian order) - DoIO((cs.c)+1, 1u, timeout_clock, + bsent = DoIO((cs.c)+1, 1u, timeout_clock, &SnCommSBD::PutC, &SnCommSBD::SerialWriteable); - DoIO( cs.c, 1u, timeout_clock, +#ifdef DEBUG + printf("SendSBD: checksum byte 1 DoIO returned %u\r\n", bsent); +#endif + bsent = DoIO( cs.c, 1u, timeout_clock, &SnCommSBD::PutC, &SnCommSBD::SerialWriteable); +#ifdef DEBUG + printf("SendSBD: checksum byte 0 DoIO returned %u\r\n", bsent); +#endif //wait_ms(kCmdReactDelay); #ifdef DEBUG @@ -578,11 +591,16 @@ &SnCommSBD::PutC, &SnCommSBD::SerialWriteable); if ( cmd[cln-2]!='\r' || cmd[cln-1]!='\n' ) { - static char rr[2]={0x0d, 0x0a}; + // static char rr[2]={0x0d, 0x0a}; + static char rr[1]={0x0d}; // do not send a '\n', suggested by NAL #ifdef DEBUG - dispStrBytes(rr, 2u); + // dispStrBytes(rr, 2u); + dispStrBytes(rr, 1u); #endif - br += DoIO(rr, 2u, timeout, + // br += DoIO(rr, 2u, timeout, + // &SnCommSBD::PutC, + // &SnCommSBD::SerialWriteable); + br += DoIO(rr, 1u, timeout, &SnCommSBD::PutC, &SnCommSBD::SerialWriteable); }