Skip to content

Commit c879c70

Browse files
author
Brendan Whitfield
committed
moved flush() to after the command has been written, to avoid lingering data
1 parent 1938e96 commit c879c70

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

obd/elm327.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,9 @@ def __write(self, cmd):
308308

309309
if self.__port:
310310
cmd += "\r\n" # terminate
311-
self.__port.flush()
312-
self.__port.flushInput()
313-
self.__port.write(cmd.encode()) # turn the string into bytes
311+
self.__port.flushInput() # dump everything in the input buffer
312+
self.__port.write(cmd.encode()) # turn the string into bytes and write
313+
self.__port.flush() # wait for the output buffer to finish transmitting
314314
debug("write: " + repr(cmd))
315315
else:
316316
debug("cannot perform __write() when unconnected", True)

0 commit comments

Comments
 (0)