1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-01 18:32:37 +02:00

Merge pull request #174 from luc-github/Devt

fix empty password not saved and generated error
This commit is contained in:
bdring
2019-06-25 08:27:08 -05:00
committed by GitHub
3 changed files with 12 additions and 7 deletions

View File

@@ -326,7 +326,7 @@ bool COMMANDS::execute_internal_command (int cmd, String cmd_params, level_authe
} }
Preferences prefs; Preferences prefs;
prefs.begin(NAMESPACE, false); prefs.begin(NAMESPACE, false);
if (prefs.putString(AP_PWD_ENTRY, parameter) == 0){ if (prefs.putString(AP_PWD_ENTRY, parameter) != parameter.length()){
response = false; response = false;
if(espresponse)espresponse->println ("Error: Set failed!"); if(espresponse)espresponse->println ("Error: Set failed!");
} else if(espresponse)espresponse->println ("ok"); } else if(espresponse)espresponse->println ("ok");
@@ -940,11 +940,12 @@ bool COMMANDS::execute_internal_command (int cmd, String cmd_params, level_authe
return false; return false;
} }
#endif #endif
int8_t vi;
espresponse->print("{\"EEPROM\":["); espresponse->print("{\"EEPROM\":[");
if(espresponse->client() != CLIENT_WEBUI)espresponse->println(""); if(espresponse->client() != CLIENT_WEBUI)espresponse->println("");
prefs.begin(NAMESPACE, true); prefs.begin(NAMESPACE, true);
#ifdef ENABLE_WIFI #ifdef ENABLE_WIFI
int8_t vi;
//1 - Hostname //1 - Hostname
espresponse->print ("{\"F\":\"network\",\"P\":\""); espresponse->print ("{\"F\":\"network\",\"P\":\"");
espresponse->print (HOSTNAME_ENTRY); espresponse->print (HOSTNAME_ENTRY);
@@ -1223,7 +1224,11 @@ bool COMMANDS::execute_internal_command (int cmd, String cmd_params, level_authe
if (! (styp == "B" || styp == "S" || styp == "A" || styp == "I" || styp == "F") ) { if (! (styp == "B" || styp == "S" || styp == "A" || styp == "I" || styp == "F") ) {
response = false; response = false;
} }
if (sval.length() == 0) { if ((sval.length() == 0)
#if defined (ENABLE_WIFI)
&& !((spos==AP_PWD_ENTRY) || (spos==STA_PWD_ENTRY))
#endif
){
response = false; response = false;
} }
@@ -1281,7 +1286,7 @@ bool COMMANDS::execute_internal_command (int cmd, String cmd_params, level_authe
} }
//String value //String value
if (styp == "S") { if (styp == "S") {
if (prefs.putString(spos.c_str(), sval) == 0) { if (prefs.putString(spos.c_str(), sval) != sval.length()) {
response = false; response = false;
} else { } else {
#if defined (ENABLE_WIFI) #if defined (ENABLE_WIFI)

View File

@@ -20,7 +20,7 @@
// Grbl versioning system // Grbl versioning system
#define GRBL_VERSION "1.1f" #define GRBL_VERSION "1.1f"
#define GRBL_VERSION_BUILD "20190616" #define GRBL_VERSION_BUILD "20190622"
//#include <sdkconfig.h> //#include <sdkconfig.h>
#include <Arduino.h> #include <Arduino.h>

View File

@@ -475,7 +475,7 @@ void WiFiConfig::reset_settings(){
error = true; error = true;
} }
sval = DEFAULT_STA_PWD; sval = DEFAULT_STA_PWD;
if (prefs.putString(STA_PWD_ENTRY, sval) == 0){ if (prefs.putString(STA_PWD_ENTRY, sval) != sval.length()){
error = true; error = true;
} }
sval = DEFAULT_AP_SSID; sval = DEFAULT_AP_SSID;
@@ -483,7 +483,7 @@ void WiFiConfig::reset_settings(){
error = true; error = true;
} }
sval = DEFAULT_AP_PWD; sval = DEFAULT_AP_PWD;
if (prefs.putString(AP_PWD_ENTRY, sval) == 0){ if (prefs.putString(AP_PWD_ENTRY, sval) != sval.length()){
error = true; error = true;
} }