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

This commit is contained in:
Andrzej Kapolka 2013-07-10 15:07:39 -07:00
parent 2ffd151a1f
commit 559dc4bb5d

View file

@ -99,6 +99,9 @@ void SerialInterface::initializePort(char* portname) {
int currentFlags = fcntl(_serialDescriptor, F_GETFL);
fcntl(_serialDescriptor, F_SETFL, currentFlags & ~O_NONBLOCK);
// make sure there's nothing queued up to be read
tcflush(_serialDescriptor, TCIOFLUSH);
// this disables streaming so there's no garbage data on reads
write(_serialDescriptor, "SD\n", 3);
char result[4];