Add esp8266 de-blocking

Solve possible PubSubClient timeout due to esp8266 blocking (#790)
This commit is contained in:
arendst 2017-09-25 12:35:02 +02:00
parent 33e116ccb9
commit 5d9dab9340
1 changed files with 1 additions and 0 deletions

View File

@ -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;