Commit 5a4f5914 authored by Michael Buesch's avatar Michael Buesch
Browse files

phy_serial: Simplify discard

Signed-off-by: default avatarMichael Buesch <m@bues.ch>
parent 210a819c
......@@ -117,12 +117,10 @@ class CpPhySerial(CpPhy):
size = -1
getSize = FdlTelegram.getSizeFromRaw
if self.__discardTimeout is not None:
while self.__discardTimeout is not None:
self.__discard()
if (timeout == 0.0 or
(timeout > 0.0 and monotonic_time() >= timeoutStamp)):
return None
while self.__discardTimeout is not None:
self.__discard()
if timeout > 0.0 and monotonic_time() >= timeoutStamp:
return None
try:
rxBufLen = len(rxBuf)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment