VE.Direct: make state machine timeout robust against overflow
This commit is contained in:
parent
43f553d2d4
commit
8c6e925ca4
@ -118,7 +118,7 @@ void VeDirectFrameHandler<T>::loop()
|
|||||||
// there will never be a large gap between two bytes of the same frame.
|
// there will never be a large gap between two bytes of the same frame.
|
||||||
// if such a large gap is observed, reset the state machine so it tries
|
// if such a large gap is observed, reset the state machine so it tries
|
||||||
// to decode a new frame once more data arrives.
|
// to decode a new frame once more data arrives.
|
||||||
if (IDLE != _state && _lastByteMillis + 500 < millis()) {
|
if (IDLE != _state && (millis() - _lastByteMillis) > 500) {
|
||||||
_msgOut->printf("%s Resetting state machine (was %d) after timeout\r\n", _logId, _state);
|
_msgOut->printf("%s Resetting state machine (was %d) after timeout\r\n", _logId, _state);
|
||||||
if (_verboseLogging) { dumpDebugBuffer(); }
|
if (_verboseLogging) { dumpDebugBuffer(); }
|
||||||
reset();
|
reset();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user