diff --git a/autoplant_pio/src/autoplant.cpp b/autoplant_pio/src/autoplant.cpp index 9774627..79ac15e 100644 --- a/autoplant_pio/src/autoplant.cpp +++ b/autoplant_pio/src/autoplant.cpp @@ -103,7 +103,7 @@ void connect_wifi() { * @return void */ void connect_mqtt() { - int delay = 1000; + int backoff_delay = 1000; while(true) { Serial.print("MQTT: "); mqtt = PubSubClient(); @@ -142,9 +142,9 @@ void connect_mqtt() { int error_code = mqtt.state(); Serial.println("failed, error code "+String(error_code)); - delay(delay); - delay += 1000; - if(delay > 60 * 1000) delay = 60 * 1000; + delay(backoff_delay); + backoff_delay += 1000; + if(backoff_delay > 60 * 1000) backoff_delay = 60 * 1000; } Serial.println("ok");