Skip to content

Commit

Permalink
Workaround to determine whether the Wi-Fi data has been changed via BLE
Browse files Browse the repository at this point in the history
  • Loading branch information
melkati committed Jan 29, 2024
1 parent e74b6e1 commit 670f511
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CO2_Gadget_WIFI.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,17 @@ void wifiClientLoop() {
if (activeWIFI && troubledWIFI && (millis() - timeTroubledWIFI >= timeToRetryTroubledWIFI * 1000)) {
initWifi();
}

// This is a workaround until I can directly determine whether the Wi-Fi data has been changed via BLE
// Only checks for SSID changed (not password)
if (WiFi.SSID() != wifiSSID) {
Serial.println("-->[WiFi] Wi-Fi SSID changed. Old SSID: " + wifiSSID + ", new SSID: " + WiFi.SSID());
wifiSSID = WiFi.SSID();
putPreferences();
// initWifi();
wifiChanged = true;
}

if (wifiChanged) {
wifiChanged = false;
initWifi();
Expand Down

0 comments on commit 670f511

Please sign in to comment.