Skip to content

Commit

Permalink
Timeout for HardwareSerial 500ms
Browse files Browse the repository at this point in the history
  • Loading branch information
helgeerbe committed Aug 11, 2022
1 parent c889efe commit e43a45b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/MqttVedirectPublishing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ void MqttVedirectPublishingClass::loop()
String key;
String value;
bool bChanged;
unsigned long now = millis();

while ( Serial2.available() ) {
while ( Serial2.available() && ((millis() - now) < 500)) {
_myve.rxData(Serial2.read());
}
yield();
Expand Down

0 comments on commit e43a45b

Please sign in to comment.