From 75d38da03b67c93ab60ec8ec47c4a515e0ae6313 Mon Sep 17 00:00:00 2001 From: Shelby Merrick Date: Fri, 1 Dec 2023 11:04:54 -0500 Subject: [PATCH 1/4] Check for wificonfig.json before opening --- ESPixelStick/src/network/WiFiDriver.cpp | 31 ++++++++++++++----------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/ESPixelStick/src/network/WiFiDriver.cpp b/ESPixelStick/src/network/WiFiDriver.cpp index fa9317b9d..2ca0a4d94 100644 --- a/ESPixelStick/src/network/WiFiDriver.cpp +++ b/ESPixelStick/src/network/WiFiDriver.cpp @@ -130,24 +130,27 @@ void c_WiFiDriver::Begin () if (FileMgr.SdCardIsInstalled()) { - DynamicJsonDocument jsonConfigDoc(1024); - // DEBUG_V ("read the sdcard config"); - if (FileMgr.ReadSdFile (F("wificonfig.json"), jsonConfigDoc)) + if (ESP_SDFS.exists (F("wificonfig.json"))) { - // DEBUG_V ("Process the sdcard config"); - JsonObject jsonConfig = jsonConfigDoc.as (); + DynamicJsonDocument jsonConfigDoc(1024); + // DEBUG_V ("read the sdcard config"); + if (FileMgr.ReadSdFile (F("wificonfig.json"), jsonConfigDoc)) + { + // DEBUG_V ("Process the sdcard config"); + JsonObject jsonConfig = jsonConfigDoc.as (); - // copy the fields of interest into the local structure - setFromJSON (ssid, jsonConfig, CN_ssid); - setFromJSON (passphrase, jsonConfig, CN_passphrase); + // copy the fields of interest into the local structure + setFromJSON (ssid, jsonConfig, CN_ssid); + setFromJSON (passphrase, jsonConfig, CN_passphrase); - ConfigSaveNeeded = true; + ConfigSaveNeeded = true; - FileMgr.DeleteSdFile (F ("wificonfig.json")); - } - else - { - // DEBUG_V ("ERROR: Could not read SD card config"); + FileMgr.DeleteSdFile (F ("wificonfig.json")); + } + else + { + // DEBUG_V ("ERROR: Could not read SD card config"); + } } } From 5809d782db079fad417c70eceffc12827d8e7e79 Mon Sep 17 00:00:00 2001 From: Shelby Merrick Date: Fri, 1 Dec 2023 11:05:53 -0500 Subject: [PATCH 2/4] Fixed "AP Reboot" text --- html/index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/html/index.html b/html/index.html index 24d7fe3af..f70a30155 100644 --- a/html/index.html +++ b/html/index.html @@ -453,14 +453,14 @@
+ Reboot on Fail
+ Stay in AP Mode
@@ -642,15 +642,15 @@