mirror of https://github.com/arendst/Tasmota.git
Refactor Gui Save Settings to unlimited (heap) parameter size
This commit is contained in:
parent
54a856f2c8
commit
1bb0975d89
|
@ -421,6 +421,7 @@ static void WebGetArg(const char* arg, char* out, size_t max)
|
||||||
}
|
}
|
||||||
|
|
||||||
String AddWebCommand(const char* command, const char* arg, const char* dflt) {
|
String AddWebCommand(const char* command, const char* arg, const char* dflt) {
|
||||||
|
/*
|
||||||
// OK but fixed max argument
|
// OK but fixed max argument
|
||||||
char param[200]; // Allow parameter with lenght up to 199 characters
|
char param[200]; // Allow parameter with lenght up to 199 characters
|
||||||
WebGetArg(arg, param, sizeof(param));
|
WebGetArg(arg, param, sizeof(param));
|
||||||
|
@ -428,7 +429,7 @@ String AddWebCommand(const char* command, const char* arg, const char* dflt) {
|
||||||
char cmnd[232];
|
char cmnd[232];
|
||||||
snprintf_P(cmnd, sizeof(cmnd), PSTR(";%s %s"), command, (0 == len) ? dflt : (StrCaseStr_P(command, PSTR("Password")) && (len < 5)) ? "" : param);
|
snprintf_P(cmnd, sizeof(cmnd), PSTR(";%s %s"), command, (0 == len) ? dflt : (StrCaseStr_P(command, PSTR("Password")) && (len < 5)) ? "" : param);
|
||||||
return String(cmnd);
|
return String(cmnd);
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
// Any argument size (within stack space) +48 bytes
|
// Any argument size (within stack space) +48 bytes
|
||||||
String param = Webserver->arg((const __FlashStringHelper *)arg);
|
String param = Webserver->arg((const __FlashStringHelper *)arg);
|
||||||
|
@ -438,21 +439,30 @@ String AddWebCommand(const char* command, const char* arg, const char* dflt) {
|
||||||
snprintf_P(cmnd, sizeof(cmnd), PSTR(";%s %s"), command, (0 == len) ? dflt : (StrCaseStr_P(command, PSTR("Password")) && (len < 5)) ? "" : param.c_str());
|
snprintf_P(cmnd, sizeof(cmnd), PSTR(";%s %s"), command, (0 == len) ? dflt : (StrCaseStr_P(command, PSTR("Password")) && (len < 5)) ? "" : param.c_str());
|
||||||
return String(cmnd);
|
return String(cmnd);
|
||||||
*/
|
*/
|
||||||
/*
|
// Any argument size (within heap space) +24 bytes
|
||||||
// Exception (3) +24 bytes
|
// Exception (3) if not first moved from flash to stack
|
||||||
|
// Exception (3) if not using __FlashStringHelper
|
||||||
|
// Exception (3) if not FPSTR()
|
||||||
|
// char rcommand[strlen_P(command) +1];
|
||||||
|
// snprintf_P(rcommand, sizeof(rcommand), command);
|
||||||
|
// char rdflt[strlen_P(dflt) +1];
|
||||||
|
// snprintf_P(rdflt, sizeof(rdflt), dflt);
|
||||||
String result = F(";");
|
String result = F(";");
|
||||||
result += command;
|
// result += rcommand;
|
||||||
|
// result += (const __FlashStringHelper *)command;
|
||||||
|
result += FPSTR(command);
|
||||||
result += F(" ");
|
result += F(" ");
|
||||||
String param = Webserver->arg((const __FlashStringHelper *)arg);
|
String param = Webserver->arg(FPSTR(arg));
|
||||||
uint32_t len = param.length();
|
uint32_t len = param.length();
|
||||||
if (0 == len) {
|
if (0 == len) {
|
||||||
result += dflt;
|
// result += rdflt;
|
||||||
|
// result += (const __FlashStringHelper *)dflt;
|
||||||
|
result += FPSTR(dflt);
|
||||||
}
|
}
|
||||||
else if (!(StrCaseStr_P(command, PSTR("Password")) && (len < 5))) {
|
else if (!(StrCaseStr_P(command, PSTR("Password")) && (len < 5))) {
|
||||||
result += param;
|
result += param;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool WifiIsInManagerMode(){
|
static bool WifiIsInManagerMode(){
|
||||||
|
|
Loading…
Reference in New Issue