mirror of https://github.com/arendst/Tasmota.git
Save 6k code from ESP32 safeboot
This commit is contained in:
parent
0536cc87a0
commit
0744bf7f2b
|
@ -687,9 +687,11 @@ char* SettingsText(uint32_t index) {
|
|||
|
||||
if (index >= SET_MAX) { // Index above SET_MAX are not stored in Settings
|
||||
#ifdef USE_WEBSERVER
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
if (SET_BUTTON17 <= index && index <= SET_BUTTON32)
|
||||
return (char*)GetWebButton(index-SET_BUTTON17+16);
|
||||
#endif
|
||||
#endif // not FIRMWARE_MINIMAL
|
||||
#endif // USE_WEBSERVER
|
||||
position += settings_text_size -1; // Setting not supported - internal error - return empty string
|
||||
} else {
|
||||
SettingsUpdateFinished();
|
||||
|
|
|
@ -582,10 +582,8 @@ const WebServerDispatch_t WebServerDispatch[] PROGMEM = {
|
|||
{ "dl", HTTP_ANY, HandleBackupConfiguration },
|
||||
{ "rs", HTTP_ANY, HandleRestoreConfiguration },
|
||||
{ "rt", HTTP_ANY, HandleResetConfiguration },
|
||||
{ "in", HTTP_ANY, HandleInformation }
|
||||
#endif // Not FIRMWARE_MINIMAL
|
||||
#ifndef FIRMWARE_MINIMAL_ONLY
|
||||
{ "in", HTTP_ANY, HandleInformation },
|
||||
#endif // Not FIRMWARE_MINIMAL_ONLY
|
||||
};
|
||||
|
||||
void WebServer_on(const char * prefix, void (*func)(void), uint8_t method = HTTP_ANY) {
|
||||
|
@ -1521,14 +1519,7 @@ void HandleRoot(void) {
|
|||
|
||||
if (HTTP_ADMIN == Web.state) {
|
||||
#ifdef FIRMWARE_MINIMAL
|
||||
#ifdef ESP32
|
||||
#ifndef FIRMWARE_MINIMAL_ONLY
|
||||
WSContentSpaceButton(BUTTON_INFORMATION);
|
||||
WSContentButton(BUTTON_FIRMWARE_UPGRADE);
|
||||
#endif // FIRMWARE_MINIMAL_ONLY
|
||||
#else // ESP8266
|
||||
WSContentSpaceButton(BUTTON_FIRMWARE_UPGRADE);
|
||||
#endif // ESP32
|
||||
WSContentButton(BUTTON_CONSOLE);
|
||||
#else // Not FIRMWARE_MINIMAL
|
||||
WSContentSpaceButton(BUTTON_CONFIGURATION);
|
||||
|
@ -1912,7 +1903,7 @@ void HandleTemplateConfiguration(void) {
|
|||
if (!FlashPin(i)) {
|
||||
WSContentSend_P(PSTR("%s%d"), (i>0)?",":"", template_gp.io[i]);
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6
|
||||
}
|
||||
WSContentSend_P(PSTR("}1%d}1%d"), flag, Settings->user_template_base); // FLAG: 1 BASE: 17
|
||||
WSContentEnd();
|
||||
|
@ -1966,7 +1957,7 @@ void HandleTemplateConfiguration(void) {
|
|||
RedPin(i) ? WebColor(COL_TEXT_WARNING) : WebColor(COL_TEXT), i, (0==i) ? PSTR(" style='width:146px'") : "", i, i);
|
||||
WSContentSend_P(PSTR("<td style='width:54px'><select id='h%d'></select></td></tr>"), i);
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6
|
||||
}
|
||||
WSContentSend_P(PSTR("</table>"));
|
||||
|
||||
|
@ -2202,7 +2193,7 @@ void HandleWifiConfiguration(void) {
|
|||
WebRestart(3);
|
||||
#else
|
||||
HandleRoot();
|
||||
#endif
|
||||
#endif // RESTART_AFTER_INITIAL_WIFI_CONFIG
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2365,7 +2356,7 @@ void HandleWifiConfiguration(void) {
|
|||
WSContentSend_P(HTTP_FORM_WIFI_PART2, SettingsTextEscaped(SET_STASSID2).c_str(), WIFI_HOSTNAME, WIFI_HOSTNAME, SettingsTextEscaped(SET_HOSTNAME).c_str(), SettingsTextEscaped(SET_CORS).c_str());
|
||||
#else
|
||||
WSContentSend_P(HTTP_FORM_WIFI_PART2, SettingsTextEscaped(SET_STASSID2).c_str(), WIFI_HOSTNAME, WIFI_HOSTNAME, SettingsTextEscaped(SET_HOSTNAME).c_str());
|
||||
#endif
|
||||
#endif // USE_CORS
|
||||
}
|
||||
|
||||
WSContentSend_P(HTTP_FORM_END);
|
||||
|
@ -2400,7 +2391,7 @@ void WifiSaveSettings(void) {
|
|||
cmnd += AddWebCommand(PSTR(D_CMND_HOSTNAME), PSTR("h"), PSTR("1"));
|
||||
#ifdef USE_CORS
|
||||
cmnd += AddWebCommand(PSTR(D_CMND_CORS), PSTR("c"), PSTR("1"));
|
||||
#endif
|
||||
#endif // USE_CORS
|
||||
cmnd += AddWebCommand(PSTR(D_CMND_SSID "1"), PSTR("s1"), PSTR("1"));
|
||||
cmnd += AddWebCommand(PSTR(D_CMND_SSID "2"), PSTR("s2"), PSTR("1"));
|
||||
cmnd += AddWebCommand(PSTR(D_CMND_PASSWORD "3"), PSTR("p1"), PSTR("\""));
|
||||
|
@ -2617,12 +2608,6 @@ void HandleRestoreConfiguration(void)
|
|||
Web.upload_file_type = UPL_SETTINGS;
|
||||
}
|
||||
|
||||
#endif // Not FIRMWARE_MINIMAL
|
||||
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FIRMWARE_MINIMAL_ONLY
|
||||
|
||||
void WSContentSeparatorI(uint32_t size) {
|
||||
WSContentSend_P(PSTR("</td></tr><tr><td colspan=2><hr style='font-size:2px'%s/>"), (1 == size)?" size=1":"");
|
||||
// WSContentSend_P(PSTR("</td></tr><tr><td colspan=2><hr style='font-size:%dpx'/>"), size);
|
||||
|
@ -2873,7 +2858,8 @@ void HandleInformation(void) {
|
|||
WSContentSpaceButton(BUTTON_MAIN);
|
||||
WSContentStop();
|
||||
}
|
||||
#endif // Not FIRMWARE_MINIMAL_ONLY
|
||||
|
||||
#endif // Not FIRMWARE_MINIMAL
|
||||
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -2939,7 +2925,7 @@ void HandleUpgradeFirmware(void) {
|
|||
}
|
||||
#else
|
||||
WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_START_UPGRADE));
|
||||
#endif
|
||||
#endif // ESP32
|
||||
WSContentSpaceButton(BUTTON_MAIN);
|
||||
WSContentStop();
|
||||
|
||||
|
@ -3169,7 +3155,7 @@ void HandleUploadLoop(void) {
|
|||
uint32_t upload_size = (!strlen(tmp)) ? 0 : atoi(tmp);
|
||||
AddLog(LOG_LEVEL_DEBUG, D_LOG_UPLOAD "Freespace %i Filesize %i", ESP.getFreeSketchSpace(), upload_size);
|
||||
if (upload_size > ESP.getFreeSketchSpace()) { // TODO revisit this test
|
||||
#endif
|
||||
#endif // ESP8266
|
||||
Web.upload_error = 4; // Program flash size is larger than real flash size
|
||||
return;
|
||||
}
|
||||
|
@ -3565,6 +3551,8 @@ bool CaptivePortal(void)
|
|||
|
||||
/*********************************************************************************************/
|
||||
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
|
||||
enum {QUERY_DEFAULT=0, QUERY_RUN};
|
||||
int WebQuery(char *buffer, int query_function);
|
||||
|
||||
|
@ -3727,7 +3715,6 @@ int WebQuery(char *buffer, int query_function = 0)
|
|||
return status;
|
||||
}
|
||||
|
||||
|
||||
int WebSend(char *buffer)
|
||||
{
|
||||
// [tasmota] POWER1 ON --> Sends http://tasmota/cm?cmnd=POWER1 ON
|
||||
|
@ -3878,7 +3865,6 @@ const char kWebCmndStatus[] PROGMEM = D_JSON_DONE "|" D_JSON_WRONG_PARAMETERS "|
|
|||
|
||||
const char kWebCommands[] PROGMEM = "|" // No prefix
|
||||
D_CMND_WEBLOG "|"
|
||||
#ifndef FIRMWARE_MINIMAL_ONLY
|
||||
D_CMND_WEBTIME "|"
|
||||
#ifdef USE_EMULATION
|
||||
D_CMND_EMULATION "|"
|
||||
|
@ -3897,12 +3883,10 @@ const char kWebCommands[] PROGMEM = "|" // No prefix
|
|||
#ifdef USE_CORS
|
||||
"|" D_CMND_CORS
|
||||
#endif
|
||||
#endif // FIRMWARE_MINIMAL_ONLY
|
||||
;
|
||||
|
||||
void (* const WebCommand[])(void) PROGMEM = {
|
||||
&CmndWeblog,
|
||||
#ifndef FIRMWARE_MINIMAL_ONLY
|
||||
&CmndWebTime,
|
||||
#ifdef USE_EMULATION
|
||||
&CmndEmulation,
|
||||
|
@ -3921,7 +3905,6 @@ void (* const WebCommand[])(void) PROGMEM = {
|
|||
#ifdef USE_CORS
|
||||
, &CmndCors
|
||||
#endif
|
||||
#endif // FIRMWARE_MINIMAL_ONLY
|
||||
};
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
@ -4174,7 +4157,9 @@ void CmndCors(void)
|
|||
}
|
||||
ResponseCmndChar(SettingsText(SET_CORS));
|
||||
}
|
||||
#endif
|
||||
#endif // USE_CORS
|
||||
|
||||
#endif // not FIRMWARE_MINIMAL
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Interface
|
||||
|
@ -4263,9 +4248,11 @@ bool Xdrv01(uint32_t function)
|
|||
}
|
||||
}
|
||||
break;
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
case FUNC_COMMAND:
|
||||
result = DecodeCommand(kWebCommands, WebCommand);
|
||||
break;
|
||||
#endif // FIRMWARE_MINIMAL
|
||||
case FUNC_ACTIVE:
|
||||
result = true;
|
||||
break;
|
||||
|
|
|
@ -512,6 +512,7 @@ void CmndRfTimeout(void) {
|
|||
}
|
||||
|
||||
#ifdef USE_WEBSERVER
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
|
||||
void SonoffBridgeAddButton(void) {
|
||||
WSContentSend_P(HTTP_TABLE100);
|
||||
|
@ -539,6 +540,7 @@ void SonoffBridgeWebGetArg(void) {
|
|||
}
|
||||
}
|
||||
|
||||
#endif // not FIRMWARE_MINIMAL
|
||||
#endif // USE_WEBSERVER
|
||||
|
||||
/*********************************************************************************************\
|
||||
|
@ -559,12 +561,14 @@ bool Xdrv06(uint32_t function)
|
|||
result = DecodeCommand(kSonoffBridgeCommands, SonoffBridgeCommand);
|
||||
break;
|
||||
#ifdef USE_WEBSERVER
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
case FUNC_WEB_ADD_MAIN_BUTTON:
|
||||
SonoffBridgeAddButton();
|
||||
break;
|
||||
case FUNC_WEB_GET_ARG:
|
||||
SonoffBridgeWebGetArg();
|
||||
break;
|
||||
#endif // not FIRMWARE_MINIMAL
|
||||
#endif // USE_WEBSERVER
|
||||
case FUNC_INIT:
|
||||
if (Settings->rf_duplicate_time < 10) {
|
||||
|
|
|
@ -1619,6 +1619,7 @@ void TuyaSensorsShow(bool json)
|
|||
}
|
||||
|
||||
#ifdef USE_WEBSERVER
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
|
||||
#define WEB_HANDLE_TUYA "d16"
|
||||
|
||||
|
@ -1646,6 +1647,7 @@ void TuyaWebGetArg(void) {
|
|||
}
|
||||
}
|
||||
|
||||
#endif // not FIRMWARE_MINIMAL
|
||||
#endif // USE_WEBSERVER
|
||||
|
||||
/*********************************************************************************************\
|
||||
|
@ -1735,6 +1737,7 @@ bool Xdrv16(uint32_t function) {
|
|||
TuyaSensorsShow(1);
|
||||
break;
|
||||
#ifdef USE_WEBSERVER
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
case FUNC_WEB_ADD_MAIN_BUTTON:
|
||||
TuyaAddButton();
|
||||
break;
|
||||
|
@ -1744,6 +1747,7 @@ bool Xdrv16(uint32_t function) {
|
|||
case FUNC_WEB_SENSOR:
|
||||
TuyaSensorsShow(0);
|
||||
break;
|
||||
#endif // not FIRMWARE_MINIMAL
|
||||
#endif // USE_WEBSERVER
|
||||
case FUNC_ACTIVE:
|
||||
result = true;
|
||||
|
|
|
@ -2412,6 +2412,7 @@ void TuyaSensorsShow(bool json)
|
|||
}
|
||||
|
||||
#ifdef USE_WEBSERVER
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
|
||||
#define WEB_HANDLE_TUYA "d16"
|
||||
|
||||
|
@ -2439,6 +2440,7 @@ void TuyaWebGetArg(void) {
|
|||
}
|
||||
}
|
||||
|
||||
#endif // not FIRMWARE_MINIMAL
|
||||
#endif // USE_WEBSERVER
|
||||
|
||||
/*********************************************************************************************\
|
||||
|
@ -2570,6 +2572,7 @@ bool Xdrv16(uint32_t function) {
|
|||
TuyaSensorsShow(1);
|
||||
break;
|
||||
#ifdef USE_WEBSERVER
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
case FUNC_WEB_ADD_MAIN_BUTTON:
|
||||
TuyaAddButton();
|
||||
break;
|
||||
|
@ -2579,6 +2582,7 @@ bool Xdrv16(uint32_t function) {
|
|||
case FUNC_WEB_SENSOR:
|
||||
TuyaSensorsShow(0);
|
||||
break;
|
||||
#endif // not FIRMWARE_MINIMAL
|
||||
#endif // USE_WEBSERVER
|
||||
case FUNC_ACTIVE:
|
||||
result = true;
|
||||
|
|
|
@ -246,6 +246,7 @@ void LscMcModuleSelected(void) {
|
|||
}
|
||||
|
||||
#ifdef USE_WEBSERVER
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
#ifdef USE_LSC_MCSL_GUI
|
||||
|
||||
void LscMcAddFuctionButtons(void) {
|
||||
|
@ -287,6 +288,7 @@ void LscMcWebGetArg(void) {
|
|||
}
|
||||
|
||||
#endif // USE_LSC_MCSL_GUI
|
||||
#endif // not FIRMWARE_MINIMAL
|
||||
#endif // USE_WEBSERVER
|
||||
|
||||
|
||||
|
@ -306,6 +308,7 @@ bool Xlgt07(uint32_t function)
|
|||
result = LscMcMultiButtonPressed();
|
||||
break;
|
||||
#ifdef USE_WEBSERVER
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
#ifdef USE_LSC_MCSL_GUI
|
||||
case FUNC_WEB_ADD_MAIN_BUTTON:
|
||||
LscMcAddFuctionButtons();
|
||||
|
@ -314,6 +317,7 @@ bool Xlgt07(uint32_t function)
|
|||
LscMcWebGetArg();
|
||||
break;
|
||||
#endif // USE_LSC_MCSL_GUI
|
||||
#endif // not FIRMWARE_MINIMAL
|
||||
#endif // USE_WEBSERVER
|
||||
case FUNC_MODULE_INIT:
|
||||
LscMcModuleSelected();
|
||||
|
|
Loading…
Reference in New Issue