Showing the changes to interface/src/SerialInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -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 reads | 105 | // 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]; |