fix mqtt reconnect delay
This commit is contained in:
@@ -50,7 +50,7 @@ bool Network::reconnect()
|
|||||||
while (!_mqttClient.connected()) {
|
while (!_mqttClient.connected()) {
|
||||||
Serial.println("Attempting MQTT connection");
|
Serial.println("Attempting MQTT connection");
|
||||||
// Attempt to connect
|
// Attempt to connect
|
||||||
if (_mqttClient.connect("arduinoClient")) {
|
if (_mqttClient.connect("nukiHub")) {
|
||||||
Serial.println("MQTT connected");
|
Serial.println("MQTT connected");
|
||||||
|
|
||||||
// ... and resubscribe
|
// ... and resubscribe
|
||||||
@@ -58,6 +58,7 @@ bool Network::reconnect()
|
|||||||
} else {
|
} else {
|
||||||
Serial.print("MQTT connect failed, rc=");
|
Serial.print("MQTT connect failed, rc=");
|
||||||
Serial.println(_mqttClient.state());
|
Serial.println(_mqttClient.state());
|
||||||
|
vTaskDelay( 5000 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,7 +77,6 @@ void Network::update()
|
|||||||
bool success = reconnect();
|
bool success = reconnect();
|
||||||
if(!success)
|
if(!success)
|
||||||
{
|
{
|
||||||
vTaskDelay( 5000 / portTICK_PERIOD_MS);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user