From 5074c60f0a1428233b65d44bc0119230c442d287 Mon Sep 17 00:00:00 2001 From: nseidle Date: Fri, 5 May 2023 11:44:20 -0600 Subject: [PATCH] L-Band Keys: Limit WiFi connection attempts when no WiFi available Fix for issue #454 --- Firmware/RTK_Surveyor/States.ino | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Firmware/RTK_Surveyor/States.ino b/Firmware/RTK_Surveyor/States.ino index 0855c2be8..2968389c0 100644 --- a/Firmware/RTK_Surveyor/States.ino +++ b/Firmware/RTK_Surveyor/States.ino @@ -740,6 +740,11 @@ void updateSystemState() else if (strlen(settings.pointPerfectCurrentKey) == 0 || strlen(settings.pointPerfectNextKey) == 0) { log_d("L_Band Keys starting WiFi"); + + //Temporarily limit WiFi connection attempts + wifiOriginalMaxConnectionAttempts = wifiMaxConnectionAttempts; + wifiMaxConnectionAttempts = 0; //Override setting during key retrieval. Give up after single failure. + wifiStart(); changeState(STATE_KEYS_PROVISION_WIFI_STARTED); } @@ -775,6 +780,11 @@ void updateSystemState() if (online.rtc == false) { log_d("Keys Needed RTC off starting WiFi"); + + //Temporarily limit WiFi connection attempts + wifiOriginalMaxConnectionAttempts = wifiMaxConnectionAttempts; + wifiMaxConnectionAttempts = 0; //Override setting during key retrieval. Give up after single failure. + wifiStart(); changeState(STATE_KEYS_WIFI_STARTED); //If we can't check the RTC, continue }