mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:24:00 +02:00
Flush the queue so that we don't get any funny data on the initial read.
This commit is contained in:
parent
2ffd151a1f
commit
559dc4bb5d
1 changed files with 3 additions and 0 deletions
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue