History

Flush the queue so that we don't get any funny data on the initial read.

Andrzej Kapolka committed 13 years ago

Commit 559dc4b1 parent 2ffd1511 file · +3 −0Browse files

Showing the changes to interface/src/SerialInterface.cpp (1 of 1 file). Show all

Unified · Split

interface/src/SerialInterface.cpp+3−0
@@ -99,6 +99,9 @@ void SerialInterface::initializePort(char* portname) { · 98 unmodified lines
99 int currentFlags = fcntl(_serialDescriptor, F_GETFL);99 int currentFlags = fcntl(_serialDescriptor, F_GETFL);
100 fcntl(_serialDescriptor, F_SETFL, currentFlags & ~O_NONBLOCK);100 fcntl(_serialDescriptor, F_SETFL, currentFlags & ~O_NONBLOCK);
101 101
102 // make sure there's nothing queued up to be read
103 tcflush(_serialDescriptor, TCIOFLUSH);
104
102 // this disables streaming so there's no garbage data on reads105 // this disables streaming so there's no garbage data on reads
103 write(_serialDescriptor, "SD\n", 3);106 write(_serialDescriptor, "SD\n", 3);
104 char result[4];107 char result[4];