Browse Source

Set persistant WiFi opmode to WIFI_OFF if not already configured that way

master
Rick Watson 5 years ago
parent
commit
6aede04282
  1. 6
      lib/framework/WiFiSettingsService.cpp

6
lib/framework/WiFiSettingsService.cpp

@ -1,6 +1,12 @@
#include <WiFiSettingsService.h>
WiFiSettingsService::WiFiSettingsService(AsyncWebServer* server, FS* fs, SecurityManager* securityManager) : AdminSettingsService(server, fs, securityManager, WIFI_SETTINGS_SERVICE_PATH, WIFI_SETTINGS_FILE) {
// We want the device to come up in opmode=0 (WIFI_OFF), when erasing the flash this is not the default.
// If needed, we save opmode=0 before disabling persistence so the device boots with WiFi disabled in the future.
if (WiFi.getMode() != WIFI_OFF) {
WiFi.mode(WIFI_OFF);
}
// Disable WiFi config persistance and auto reconnect
WiFi.persistent(false);
WiFi.setAutoReconnect(false);

Loading…
Cancel
Save