diff --git a/Software/src/communication/nvm/comm_nvm.cpp b/Software/src/communication/nvm/comm_nvm.cpp index e30812ff..860c8443 100644 --- a/Software/src/communication/nvm/comm_nvm.cpp +++ b/Software/src/communication/nvm/comm_nvm.cpp @@ -32,18 +32,8 @@ void init_stored_settings() { esp32hal->set_default_configuration_values(); - char tempSSIDstring[63]; // Allocate buffer with sufficient size - size_t lengthSSID = settings.getString("SSID", tempSSIDstring, sizeof(tempSSIDstring)); - if (lengthSSID > 0) { // Successfully read the string from memory. Set it to SSID! - ssid = tempSSIDstring; - } else { // Reading from settings failed. Do nothing with SSID. Raise event? - } - char tempPasswordString[63]; // Allocate buffer with sufficient size - size_t lengthPassword = settings.getString("PASSWORD", tempPasswordString, sizeof(tempPasswordString)); - if (lengthPassword > 7) { // Successfully read the string from memory. Set it to password! - password = tempPasswordString; - } else { // Reading from settings failed. Do nothing with SSID. Raise event? - } + ssid = settings.getString("SSID", "REPLACEME").c_str(); + password = settings.getString("PASSWORD", "REPLACEME").c_str(); temp = settings.getUInt("BATTERY_WH_MAX", false); if (temp != 0) { @@ -208,15 +198,6 @@ void store_settings() { return; } - if (!settings.putString("SSID", String(ssid.c_str()))) { - if (ssid != "") - set_event(EVENT_PERSISTENT_SAVE_INFO, 1); - } - if (!settings.putString("PASSWORD", String(password.c_str()))) { - if (password != "") - set_event(EVENT_PERSISTENT_SAVE_INFO, 2); - } - if (!settings.putUInt("BATTERY_WH_MAX", datalayer.battery.info.total_capacity_Wh)) { set_event(EVENT_PERSISTENT_SAVE_INFO, 3); } diff --git a/Software/src/devboard/webserver/settings_html.cpp b/Software/src/devboard/webserver/settings_html.cpp index 08ca1929..ce279b62 100644 --- a/Software/src/devboard/webserver/settings_html.cpp +++ b/Software/src/devboard/webserver/settings_html.cpp @@ -132,8 +132,13 @@ String settings_processor(const String& var, BatteryEmulatorSettingsStore& setti return battery->interface_name(); } } + if (var == "SSID") { - return String(ssid.c_str()); + return settings.getString("SSID", "REPLACEME"); + } + + if (var == "PASSWORD") { + return settings.getString("PASSWORD", "REPLACEME"); } if (var == "SAVEDCLASS") { @@ -750,12 +755,6 @@ const char* getCANInterfaceName(CAN_Interface interface) { function editError(){alert('Invalid input');} - function editSSID(){var value=prompt('Which SSID to connect to. Enter new SSID:');if(value!==null){var xhr=new - XMLHttpRequest();xhr.onload=editComplete;xhr.onerror=editError;xhr.open('GET','/updateSSID?value='+encodeURIComponent(value),true);xhr.send();}} - - function editPassword(){var value=prompt('Enter new password:');if(value!==null){var xhr=new - XMLHttpRequest();xhr.onload=editComplete;xhr.onerror=editError;xhr.open('GET','/updatePassword?value='+encodeURIComponent(value),true);xhr.send();}} - function editWh(){var value=prompt('How much energy the battery can store. Enter new Wh value (1-400000):'); if(value!==null){if(value>=1&&value<=400000){var xhr=new XMLHttpRequest();xhr.onload=editComplete;xhr.onerror=editError;xhr.open('GET','/updateBatterySize?value='+value,true);xhr.send();}else{ @@ -983,11 +982,6 @@ const char* getCANInterfaceName(CAN_Interface interface) { -