Skip to content

Commit

Permalink
Add esp8266 de-blocking
Browse files Browse the repository at this point in the history
Solve possible PubSubClient timeout due to esp8266 blocking (#790)
  • Loading branch information
arendst committed Sep 25, 2017
1 parent 33e116c commit 5d9dab9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/PubSubClient/src/PubSubClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ boolean PubSubClient::connect(const char *id, const char *user, const char *pass
boolean PubSubClient::readByte(uint8_t * result) {
uint32_t previousMillis = millis();
while(!_client->available()) {
delay(1); // Add esp8266 de-blocking (Tasmota #790)
uint32_t currentMillis = millis();
if(currentMillis - previousMillis >= ((int32_t) MQTT_SOCKET_TIMEOUT * 1000)){
return false;
Expand Down

0 comments on commit 5d9dab9

Please sign in to comment.