Squeeze 0.5k from code size

This commit is contained in:
Theo Arends 2025-12-13 14:45:15 +01:00
parent 272fd431ef
commit d521498d82
9 changed files with 212 additions and 97 deletions

View File

@ -304,23 +304,21 @@ const char HTTP_FORM_LOGIN[] PROGMEM =
"<button>" D_OK "</button>" "<button>" D_OK "</button>"
"</form></fieldset>"; "</form></fieldset>";
const char HTTP_FIELDSET_LEGEND[] PROGMEM =
"<fieldset><legend><b>&nbsp;%s&nbsp;</b></legend>";
const char HTTP_FORM_TEMPLATE[] PROGMEM = const char HTTP_FORM_TEMPLATE[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_TEMPLATE_PARAMETERS "&nbsp;</b></legend>"
"<form method='get' action='tp'>"; "<form method='get' action='tp'>";
const char HTTP_FORM_TEMPLATE_FLAG[] PROGMEM = const char HTTP_FORM_TEMPLATE_FLAG[] PROGMEM =
"<p></p>" // Keep close so do not use <br>
"<fieldset><legend><b>&nbsp;" D_TEMPLATE_FLAGS "&nbsp;</b></legend><p>"
// "<label><input id='c0' name='c0' type='checkbox'><b>" D_OPTION_TEXT "</b></label><br>" // "<label><input id='c0' name='c0' type='checkbox'><b>" D_OPTION_TEXT "</b></label><br>"
"</p></fieldset>"; "</p></fieldset>";
const char HTTP_FORM_MODULE[] PROGMEM = const char HTTP_FORM_MODULE[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_MODULE_PARAMETERS "&nbsp;</b></legend>"
"<form method='get' action='md'>" "<form method='get' action='md'>"
"<p></p><b>" D_MODULE_TYPE "</b> (%s)<br><select id='g99'></select><br>" "<p></p><b>" D_MODULE_TYPE "</b> (%s)<br><select id='g99'></select><br>"
"<br><table>"; "<br><table>";
const char HTTP_FORM_WIFI_PART1[] PROGMEM = const char HTTP_FORM_WIFI_PART1[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_WIFI_PARAMETERS "&nbsp;</b></legend>"
"<form method='get' action='wi'>" "<form method='get' action='wi'>"
"<p><b>" D_AP1_SSID "</b>%s<br><input id='s1' placeholder=\"" D_AP1_SSID_HELP "\" value=\"%s\"></p>" // Need \" instead of ' to be able to use ' in text (#8489) "<p><b>" D_AP1_SSID "</b>%s<br><input id='s1' placeholder=\"" D_AP1_SSID_HELP "\" value=\"%s\"></p>" // Need \" instead of ' to be able to use ' in text (#8489)
"<p><label><b>" D_AP_PASSWORD "</b><input type='checkbox' onclick='sp(\"p1\")'></label><br><input id='p1' type='password' placeholder=\"" D_AP_PASSWORD_HELP "\""; "<p><label><b>" D_AP_PASSWORD "</b><input type='checkbox' onclick='sp(\"p1\")'></label><br><input id='p1' type='password' placeholder=\"" D_AP_PASSWORD_HELP "\"";
@ -336,18 +334,17 @@ const char HTTP_FORM_WIFI_PART2[] PROGMEM =
; ;
const char HTTP_FORM_LOG1[] PROGMEM = const char HTTP_FORM_LOG1[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_LOGGING_PARAMETERS "&nbsp;</b>" "<form method='get' action='lg'>";
"</legend><form method='get' action='lg'>";
const char HTTP_FORM_LOG2[] PROGMEM = const char HTTP_FORM_LOG2[] PROGMEM =
"<p><b>" D_SYSLOG_HOST "</b> (" SYS_LOG_HOST ")<br><input id='lh' placeholder=\"" SYS_LOG_HOST "\" value=\"%s\"></p>" "<p><b>" D_SYSLOG_HOST "</b> (" SYS_LOG_HOST ")<br><input id='lh' placeholder=\"" SYS_LOG_HOST "\" value=\"%s\"></p>"
"<p><b>" D_SYSLOG_PORT "</b> (" STR(SYS_LOG_PORT) ")<br><input id='lp' placeholder='" STR(SYS_LOG_PORT) "' value='%d'></p>" "<p><b>" D_SYSLOG_PORT "</b> (" STR(SYS_LOG_PORT) ")<br><input id='lp' placeholder='" STR(SYS_LOG_PORT) "' value='%d'></p>"
"<p><b>" D_TELEMETRY_PERIOD "</b> (" STR(TELE_PERIOD) ")<br><input id='lt' placeholder='" STR(TELE_PERIOD) "' value='%d'></p>"; "<p><b>" D_TELEMETRY_PERIOD "</b> (" STR(TELE_PERIOD) ")<br><input id='lt' placeholder='" STR(TELE_PERIOD) "' value='%d'></p>";
const char HTTP_FORM_OTHER[] PROGMEM = const char HTTP_FORM_OTHER1[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_OTHER_PARAMETERS "&nbsp;</b></legend>"
"<form method='get' action='co'>" "<form method='get' action='co'>"
"<p></p>" "<p></p>";
"<fieldset><legend><b>&nbsp;" D_TEMPLATE "&nbsp;</b></legend>"
const char HTTP_FORM_OTHER2[] PROGMEM =
"<p><input id='t1' placeholder=\"" D_TEMPLATE "\" value='%s'></p>" // We need ' apostrophe here as the template contains " quotation mark "<p><input id='t1' placeholder=\"" D_TEMPLATE "\" value='%s'></p>" // We need ' apostrophe here as the template contains " quotation mark
"<p><label><input id='t2' type='checkbox'%s><b>" D_ACTIVATE "</b></label></p>" "<p><label><input id='t2' type='checkbox'%s><b>" D_ACTIVATE "</b></label></p>"
"</fieldset>" "</fieldset>"
@ -365,17 +362,15 @@ const char HTTP_FORM_END[] PROGMEM =
"<button name='save' type='submit' class='button bgrn'>" D_SAVE "</button>" "<button name='save' type='submit' class='button bgrn'>" D_SAVE "</button>"
"</form></fieldset>"; "</form></fieldset>";
const char HTTP_FORM_RST[] PROGMEM = const char HTTP_DIV_BLOCK[] PROGMEM =
"<div id='f1' style='display:block;'>" "<div id='f1' name='f1' style='display:block;'>";
"<fieldset><legend><b>&nbsp;" D_RESTORE_CONFIGURATION "&nbsp;</b></legend>";
const char HTTP_FORM_UPG[] PROGMEM = const char HTTP_FORM_UPG[] PROGMEM =
"<div id='f1' style='display:block;'>"
"<fieldset><legend><b>&nbsp;" D_UPGRADE_BY_WEBSERVER "&nbsp;</b></legend>"
"<form method='get' action='u1'>" "<form method='get' action='u1'>"
"<br><b>" D_OTA_URL "</b><br><input id='o' placeholder=\"OTA_URL\" value=\"%s\"><br>" "<br><b>" D_OTA_URL "</b><br><input id='o' placeholder=\"OTA_URL\" value=\"%s\"><br>"
"<br><button type='submit'>" D_START_UPGRADE "</button></form>" "<br><button type='submit'>" D_START_UPGRADE "</button></form>"
"</fieldset><br><br>" "</fieldset><br><br>";
"<fieldset><legend><b>&nbsp;" D_UPGRADE_BY_FILE_UPLOAD "&nbsp;</b></legend>";
const char HTTP_FORM_RST_UPG[] PROGMEM = // ESP8266 or ESP32 dual partition const char HTTP_FORM_RST_UPG[] PROGMEM = // ESP8266 or ESP32 dual partition
"<form method='post' action='u2?fsz=' enctype='multipart/form-data'>" "<form method='post' action='u2?fsz=' enctype='multipart/form-data'>"
"<br><input type='file' name='u2'><br>" "<br><input type='file' name='u2'><br>"
@ -970,7 +965,10 @@ void WSContentStart_P(const char* title, bool auth) {
WSContentBegin(200, CT_HTML); WSContentBegin(200, CT_HTML);
if (title != nullptr) { if (title != nullptr) {
WSContentSend_P(HTTP_HEADER1, PSTR(D_HTML_LANGUAGE), SettingsTextEscaped(SET_DEVICENAME).c_str(), title); WSContentSend_P(HTTP_HEADER1,
PSTR(D_HTML_LANGUAGE),
SettingsTextEscaped(SET_DEVICENAME).c_str(),
title);
} }
} }
@ -1152,19 +1150,29 @@ void WSContentSeparator(uint32_t state) {
/*-------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------*/
void WSContentSend_Temp(const char *types, float f_temperature) { void WSContentSend_Temp(const char *types, float f_temperature) {
WSContentSend_PD(HTTP_SNS_F_TEMP, types, Settings->flag2.temperature_resolution, &f_temperature, TempUnit()); WSContentSend_PD(HTTP_SNS_F_TEMP,
types,
Settings->flag2.temperature_resolution,
&f_temperature,
TempUnit());
} }
/*-------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------*/
void WSContentSend_Voltage(const char *types, float f_voltage) { void WSContentSend_Voltage(const char *types, float f_voltage) {
WSContentSend_PD(HTTP_SNS_F_VOLTAGE, types, Settings->flag2.voltage_resolution, &f_voltage); WSContentSend_PD(HTTP_SNS_F_VOLTAGE,
types,
Settings->flag2.voltage_resolution,
&f_voltage);
} }
/*-------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------*/
void WSContentSend_Current(const char *types, float f_current) { void WSContentSend_Current(const char *types, float f_current) {
WSContentSend_PD(HTTP_SNS_F_CURRENT, types, Settings->flag2.current_resolution, &f_current); WSContentSend_PD(HTTP_SNS_F_CURRENT,
types,
Settings->flag2.current_resolution,
&f_current);
} }
/*-------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------*/
@ -1261,11 +1269,14 @@ void WebRestart(uint32_t type) {
WSContentSendStyle(); WSContentSendStyle();
if (type) { if (type) {
if (!(3 == type)) { if (!(3 == type)) {
WSContentSend_P(PSTR("<div style='text-align:center;'><b>%s</b><br><br></div>"), (type==2) ? PSTR(D_TRYING_TO_CONNECT) : PSTR(D_CONFIGURATION_SAVED) ); WSContentSend_P(PSTR("<div style='text-align:center;'><b>%s</b><br><br></div>"),
(type==2) ? PSTR(D_TRYING_TO_CONNECT) : PSTR(D_CONFIGURATION_SAVED) );
} else { } else {
#if (AFTER_INITIAL_WIFI_CONFIG_GO_TO_NEW_IP) #if (AFTER_INITIAL_WIFI_CONFIG_GO_TO_NEW_IP)
WSContentTextCenterStart(WebColor(COL_TEXT_SUCCESS)); WSContentTextCenterStart(WebColor(COL_TEXT_SUCCESS));
WSContentSend_P(PSTR(D_SUCCESSFUL_WIFI_CONNECTION "<br><br></div><div style='text-align:center;'>" D_REDIRECTING_TO_NEW_IP "<br><br><a href='http://%_I'>%_I</a><br></div>"),(uint32_t)WiFi.localIP(),(uint32_t)WiFi.localIP()); WSContentSend_P(PSTR(D_SUCCESSFUL_WIFI_CONNECTION "<br><br></div><div style='text-align:center;'>" D_REDIRECTING_TO_NEW_IP "<br><br><a href='http://%_I'>%_I</a><br></div>"),
(uint32_t)WiFi.localIP(),
(uint32_t)WiFi.localIP());
#else #else
WSContentTextCenterStart(WebColor(COL_TEXT_SUCCESS)); WSContentTextCenterStart(WebColor(COL_TEXT_SUCCESS));
WSContentSend_P(PSTR(D_SUCCESSFUL_WIFI_CONNECTION "<br><br></div><div style='text-align:center;'>" D_NOW_YOU_CAN_CLOSE_THIS_WINDOW "<br><br></div>")); WSContentSend_P(PSTR(D_SUCCESSFUL_WIFI_CONNECTION "<br><br></div><div style='text-align:center;'>" D_NOW_YOU_CAN_CLOSE_THIS_WINDOW "<br><br></div>"));
@ -1409,10 +1420,16 @@ void HandleRoot(void) {
if (WifiIsInManagerMode()) { if (WifiIsInManagerMode()) {
#ifndef FIRMWARE_MINIMAL #ifndef FIRMWARE_MINIMAL
if (strlen(SettingsText(SET_WEBPWD)) && !(Webserver->hasArg(F("USER1"))) && !(Webserver->hasArg(F("PASS1"))) && HTTP_MANAGER_RESET_ONLY != Web.state) { if (strlen(SettingsText(SET_WEBPWD)) &&
!(Webserver->hasArg(F("USER1"))) &&
!(Webserver->hasArg(F("PASS1"))) &&
HTTP_MANAGER_RESET_ONLY != Web.state) {
HandleWifiLogin(); HandleWifiLogin();
} else { } else {
if (!strlen(SettingsText(SET_WEBPWD)) || (((Webserver->arg(F("USER1")) == WEB_USERNAME ) && (Webserver->arg(F("PASS1")) == SettingsText(SET_WEBPWD) )) || HTTP_MANAGER_RESET_ONLY == Web.state)) { if (!strlen(SettingsText(SET_WEBPWD)) ||
(((Webserver->arg(F("USER1")) == WEB_USERNAME ) &&
(Webserver->arg(F("PASS1")) == SettingsText(SET_WEBPWD) )) ||
HTTP_MANAGER_RESET_ONLY == Web.state)) {
HandleWifiConfiguration(); HandleWifiConfiguration();
} else { } else {
// wrong user and pass // wrong user and pass
@ -1977,7 +1994,8 @@ bool HandleRootStatusRefresh(void) {
#ifdef USE_WEB_STATUS_LINE #ifdef USE_WEB_STATUS_LINE
// create a first DIV for the upper left status bar, positioned left-justified // create a first DIV for the upper left status bar, positioned left-justified
// we use the same string literal for both lines to reduce Flash // we use the same string literal for both lines to reduce Flash
WSContentSend_P(PSTR("<div style='font-size:9px;font-weight:bold;text-align:%s;position:absolute;top:0;%s:0;display:inline-flex;'>"), PSTR("left"), PSTR("left")); WSContentSend_P(PSTR("<div style='font-size:9px;font-weight:bold;text-align:%s;position:absolute;top:0;%s:0;display:inline-flex;'>"),
PSTR("left"), PSTR("left"));
#ifdef USE_WEB_STATUS_LINE_WIFI #ifdef USE_WEB_STATUS_LINE_WIFI
if (Settings->flag4.network_wifi) { if (Settings->flag4.network_wifi) {
int32_t rssi = WiFi.RSSI(); int32_t rssi = WiFi.RSSI();
@ -1997,7 +2015,8 @@ bool HandleRootStatusRefresh(void) {
WSContentSend_P(PSTR("</div>")); WSContentSend_P(PSTR("</div>"));
// create a second DIV for the upper right status bar, positioned right-justified // create a second DIV for the upper right status bar, positioned right-justified
WSContentSend_P(PSTR("<div style='font-size:9px;font-weight:bold;text-align:%s;position:absolute;top:0;%s:0;display:inline-flex;'>"), PSTR("right"), PSTR("right")); WSContentSend_P(PSTR("<div style='font-size:9px;font-weight:bold;text-align:%s;position:absolute;top:0;%s:0;display:inline-flex;'>"),
PSTR("right"), PSTR("right"));
XsnsXdrvCall(FUNC_WEB_STATUS_RIGHT); XsnsXdrvCall(FUNC_WEB_STATUS_RIGHT);
WSContentSend_P(PSTR("</div>")); WSContentSend_P(PSTR("</div>"));
#endif // USE_WEB_STATUS_LINE #endif // USE_WEB_STATUS_LINE
@ -2005,7 +2024,8 @@ bool HandleRootStatusRefresh(void) {
WSContentSend_P(PSTR("{t}")); // <table style='width:100%'> WSContentSend_P(PSTR("{t}")); // <table style='width:100%'>
WSContentSeparator(3); // Reset seperator to ignore previous outputs WSContentSeparator(3); // Reset seperator to ignore previous outputs
if (Settings->web_time_end) { if (Settings->web_time_end) {
WSContentSend_P(PSTR("{s}" D_TIME_OF_DAY "{m}%s{e}"), GetDateAndTime(DT_LOCAL).substring(Settings->web_time_start, Settings->web_time_end).c_str()); WSContentSend_P(PSTR("{s}" D_TIME_OF_DAY "{m}%s{e}"),
GetDateAndTime(DT_LOCAL).substring(Settings->web_time_start, Settings->web_time_end).c_str());
WSContentSeparator(0); // Print separator WSContentSeparator(0); // Print separator
} }
XsnsXdrvCall(FUNC_WEB_SENSOR); XsnsXdrvCall(FUNC_WEB_SENSOR);
@ -2020,10 +2040,18 @@ bool HandleRootStatusRefresh(void) {
WSContentSend_P(PSTR("{t}<tr>")); WSContentSend_P(PSTR("{t}<tr>"));
#ifdef USE_SONOFF_IFAN #ifdef USE_SONOFF_IFAN
if (IsModuleIfan()) { if (IsModuleIfan()) {
WSContentSend_P(HTTP_DEVICE_STATE, 36, (bitRead(TasmotaGlobal.power, 0)) ? PSTR("bold") : PSTR("normal"), 54, GetStateText(bitRead(TasmotaGlobal.power, 0))); WSContentSend_P(HTTP_DEVICE_STATE,
36,
(bitRead(TasmotaGlobal.power, 0)) ? PSTR("bold") : PSTR("normal"),
54,
GetStateText(bitRead(TasmotaGlobal.power, 0)));
uint32_t fanspeed = GetFanspeed(); uint32_t fanspeed = GetFanspeed();
snprintf_P(svalue, sizeof(svalue), PSTR("%d"), fanspeed); snprintf_P(svalue, sizeof(svalue), PSTR("%d"), fanspeed);
WSContentSend_P(HTTP_DEVICE_STATE, 64, (fanspeed) ? PSTR("bold") : PSTR("normal"), 54, (fanspeed) ? svalue : GetStateText(0)); WSContentSend_P(HTTP_DEVICE_STATE,
64,
(fanspeed) ? PSTR("bold") : PSTR("normal"),
54,
(fanspeed) ? svalue : GetStateText(0));
} else { } else {
#endif // USE_SONOFF_IFAN #endif // USE_SONOFF_IFAN
uint32_t cols = Web.buttons_non_light_non_shutter; uint32_t cols = Web.buttons_non_light_non_shutter;
@ -2033,7 +2061,11 @@ bool HandleRootStatusRefresh(void) {
if (bitRead(Web.light_shutter_button_mask, button_idx -1)) { continue; } // Skip non-sequential shutter button if (bitRead(Web.light_shutter_button_mask, button_idx -1)) { continue; } // Skip non-sequential shutter button
bool power_state = bitRead(TasmotaGlobal.power, button_idx -1); bool power_state = bitRead(TasmotaGlobal.power, button_idx -1);
snprintf_P(svalue, sizeof(svalue), PSTR("%d"), power_state); snprintf_P(svalue, sizeof(svalue), PSTR("%d"), power_state);
WSContentSend_P(HTTP_DEVICE_STATE, 100 / cols, (power_state) ? PSTR("bold") : PSTR("normal"), fontsize, (cols < 5) ? GetStateText(power_state) : svalue); WSContentSend_P(HTTP_DEVICE_STATE,
100 / cols,
(power_state) ? PSTR("bold") : PSTR("normal"),
fontsize,
(cols < 5) ? GetStateText(power_state) : svalue);
button_ptr++; button_ptr++;
if (button_ptr >= Web.buttons_non_light_non_shutter) { break; } if (button_ptr >= Web.buttons_non_light_non_shutter) { break; }
} }
@ -2115,11 +2147,15 @@ void WSContentSendNiceLists(uint32_t option) {
char stemp[30]; // Template number and Sensor name char stemp[30]; // Template number and Sensor name
for (uint32_t i = 0; i < nitems(kGpioNiceList); i++) { // GPIO: }2'0'>None (0)}3}2'17'>Button1 (17)}3... for (uint32_t i = 0; i < nitems(kGpioNiceList); i++) { // GPIO: }2'0'>None (0)}3}2'17'>Button1 (17)}3...
if (option && (1 == i)) { if (option && (1 == i)) {
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, AGPIO(GPIO_USER), PSTR(D_SENSOR_USER)); // }2'255'>User}3 WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX,
AGPIO(GPIO_USER),
PSTR(D_SENSOR_USER)); // }2'255'>User}3
} }
uint32_t ridx = pgm_read_word(&kGpioNiceList[i]) & 0xFFE0; uint32_t ridx = pgm_read_word(&kGpioNiceList[i]) & 0xFFE0;
uint32_t midx = BGPIO(ridx); uint32_t midx = BGPIO(ridx);
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames)); WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX,
ridx,
GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames));
} }
WSContentSend_P(PSTR("\";")); WSContentSend_P(PSTR("\";"));
@ -2158,11 +2194,15 @@ void WSContentSendAdcNiceList(uint32_t option) {
WSContentSend_P(PSTR("os=\"")); WSContentSend_P(PSTR("os=\""));
for (uint32_t i = 0; i < nitems(kAdcNiceList); i++) { // GPIO: }2'0'>None}3}2'17'>Analog}3... for (uint32_t i = 0; i < nitems(kAdcNiceList); i++) { // GPIO: }2'0'>None}3}2'17'>Analog}3...
if (option && (1 == i)) { if (option && (1 == i)) {
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, AGPIO(GPIO_USER), PSTR(D_SENSOR_USER)); // }2'15'>User}3 WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX,
AGPIO(GPIO_USER),
PSTR(D_SENSOR_USER)); // }2'15'>User}3
} }
uint32_t ridx = pgm_read_word(kAdcNiceList + i) & 0xFFE0; uint32_t ridx = pgm_read_word(kAdcNiceList + i) & 0xFFE0;
uint32_t midx = BGPIO(ridx); uint32_t midx = BGPIO(ridx);
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames)); WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX,
ridx,
GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames));
} }
} }
#endif // USE_ADC #endif // USE_ADC
@ -2234,6 +2274,7 @@ void HandleTemplateConfiguration(void) {
WSContentSend_P(HTTP_SCRIPT_TEMPLATE5); WSContentSend_P(HTTP_SCRIPT_TEMPLATE5);
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_TEMPLATE_PARAMETERS));
WSContentSend_P(HTTP_FORM_TEMPLATE); WSContentSend_P(HTTP_FORM_TEMPLATE);
WSContentSend_P(HTTP_TABLE100); // "<table style='width:100%%'>" WSContentSend_P(HTTP_TABLE100); // "<table style='width:100%%'>"
WSContentSend_P(PSTR("<tr><td><b>" D_TEMPLATE_NAME "</b></td><td style='width:200px'><input id='s1' placeholder='" D_TEMPLATE_NAME "'></td></tr>" WSContentSend_P(PSTR("<tr><td><b>" D_TEMPLATE_NAME "</b></td><td style='width:200px'><input id='s1' placeholder='" D_TEMPLATE_NAME "'></td></tr>"
@ -2261,6 +2302,8 @@ void HandleTemplateConfiguration(void) {
gpio_flag flag = ModuleFlag(); gpio_flag flag = ModuleFlag();
if (flag.data) { if (flag.data) {
WSContentSend_P(PSTR("<p></p>")); // Keep close so do not use <br>
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_TEMPLATE_FLAGS));
WSContentSend_P(HTTP_FORM_TEMPLATE_FLAG); WSContentSend_P(HTTP_FORM_TEMPLATE_FLAG);
} }
@ -2405,6 +2448,7 @@ void HandleModuleConfiguration(void) {
WSContentSend_P(PSTR("}wl(sl);")); WSContentSend_P(PSTR("}wl(sl);"));
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_MODULE_PARAMETERS));
WSContentSend_P(HTTP_FORM_MODULE, AnyModuleName(MODULE).c_str()); WSContentSend_P(HTTP_FORM_MODULE, AnyModuleName(MODULE).c_str());
for (uint32_t i = 0; i < nitems(template_gp.io); i++) { for (uint32_t i = 0; i < nitems(template_gp.io); i++) {
if (ValidGPIO(i, template_gp.io[i])) { if (ValidGPIO(i, template_gp.io[i])) {
@ -2511,8 +2555,12 @@ void HandleWifiConfiguration(void) {
WSContentStart_P(PSTR(D_CONFIGURE_WIFI), !WifiIsInManagerMode()); WSContentStart_P(PSTR(D_CONFIGURE_WIFI), !WifiIsInManagerMode());
WSContentSend_P(HTTP_SCRIPT_WIFI); WSContentSend_P(HTTP_SCRIPT_WIFI);
if (WifiIsInManagerMode()) { WSContentSend_P(HTTP_SCRIPT_HIDE); } if (WifiIsInManagerMode()) {
if (WIFI_TESTING == Wifi.wifiTest) { WSContentSend_P(HTTP_SCRIPT_RELOAD_TIME, HTTP_RESTART_RECONNECT_TIME); } WSContentSend_P(HTTP_SCRIPT_HIDE);
}
if (WIFI_TESTING == Wifi.wifiTest) {
WSContentSend_P(HTTP_SCRIPT_RELOAD_TIME, HTTP_RESTART_RECONNECT_TIME);
}
#ifdef USE_ENHANCED_GUI_WIFI_SCAN #ifdef USE_ENHANCED_GUI_WIFI_SCAN
WSContentSendStyle_P("%s", HTTP_HEAD_STYLE_SSI); WSContentSendStyle_P("%s", HTTP_HEAD_STYLE_SSI);
#else #else
@ -2580,7 +2628,8 @@ void HandleWifiConfiguration(void) {
if (!ssid_copy.length()) { ssid_copy = F("no_name"); } if (!ssid_copy.length()) { ssid_copy = F("no_name"); }
// Print SSID // Print SSID
if (!limitScannedNetworks) { if (!limitScannedNetworks) {
WSContentSend_P(PSTR("<div><a href='#p' onclick='c(this)'>%s</a><br>"), HtmlEscape(ssid_copy).c_str()); WSContentSend_P(PSTR("<div><a href='#p' onclick='c(this)'>%s</a><br>"),
HtmlEscape(ssid_copy).c_str());
} }
skipduplicated = false; skipduplicated = false;
String nextSSID = ""; String nextSSID = "";
@ -2607,7 +2656,9 @@ void HandleWifiConfiguration(void) {
#endif #endif
} else { } else {
// Print item // Print item
WSContentSend_P(PSTR("%s<span class='q'>(%d) <div class='si'>"), WiFi.BSSIDstr(indices[j]).c_str(), WiFi.channel(indices[j])); WSContentSend_P(PSTR("%s<span class='q'>(%d) <div class='si'>"),
WiFi.BSSIDstr(indices[j]).c_str(),
WiFi.channel(indices[j]));
#ifdef USE_HIGHLIGHT_CONNECTED_AP #ifdef USE_HIGHLIGHT_CONNECTED_AP
HighlightAP = WiFi.BSSIDstr(indices[j]) == WiFi.BSSIDstr(); HighlightAP = WiFi.BSSIDstr(indices[j]) == WiFi.BSSIDstr();
#endif #endif
@ -2615,9 +2666,14 @@ void HandleWifiConfiguration(void) {
// Print signal strength indicator // Print signal strength indicator
for (uint8_t k = 0; k < 4; k++) { for (uint8_t k = 0; k < 4; k++) {
#ifdef USE_HIGHLIGHT_CONNECTED_AP #ifdef USE_HIGHLIGHT_CONNECTED_AP
WSContentSend_P(PSTR("<i class='b%d%s'%s></i>"), k, (k >= num_bars) ? PSTR(" o30") : PSTR(""), HighlightAP ? PSTR(" style='background-color:var(--c_btn);'") : PSTR("")); WSContentSend_P(PSTR("<i class='b%d%s'%s></i>"),
k,
(k >= num_bars) ? PSTR(" o30") : PSTR(""),
HighlightAP ? PSTR(" style='background-color:var(--c_btn);'") : PSTR(""));
#else #else
WSContentSend_P(PSTR("<i class='b%d%s'></i>"), k, (k >= num_bars) ? PSTR(" o30") : PSTR("")); WSContentSend_P(PSTR("<i class='b%d%s'></i>"),
k,
(k >= num_bars) ? PSTR(" o30") : PSTR(""));
#endif #endif
} }
WSContentSend_P(PSTR("</div></span></div>")); WSContentSend_P(PSTR("</div></span></div>"));
@ -2670,16 +2726,27 @@ void HandleWifiConfiguration(void) {
} }
} }
WSContentSend_P(PSTR("<div><a href='/wi?scan='>%s</a></div><br>"), (limitScannedNetworks) ? PSTR(D_SHOW_MORE_WIFI_NETWORKS) : PSTR(D_SCAN_FOR_WIFI_NETWORKS)); WSContentSend_P(PSTR("<div><a href='/wi?scan='>%s</a></div><br>"),
WSContentSend_P(HTTP_FORM_WIFI_PART1, (WifiIsInManagerMode()) ? "" : PSTR(" (" STA_SSID1 ")"), SettingsTextEscaped(SET_STASSID1).c_str()); (limitScannedNetworks) ? PSTR(D_SHOW_MORE_WIFI_NETWORKS) : PSTR(D_SCAN_FOR_WIFI_NETWORKS));
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_WIFI_PARAMETERS));
WSContentSend_P(HTTP_FORM_WIFI_PART1,
(WifiIsInManagerMode()) ? "" : PSTR(" (" STA_SSID1 ")"),
SettingsTextEscaped(SET_STASSID1).c_str());
if (WifiIsInManagerMode()) { if (WifiIsInManagerMode()) {
// As WIFI_HOSTNAME may contain %s-%04d it cannot be part of HTTP_FORM_WIFI where it will exception // As WIFI_HOSTNAME may contain %s-%04d it cannot be part of HTTP_FORM_WIFI where it will exception
WSContentSend_P(PSTR("></p>")); WSContentSend_P(PSTR("></p>"));
} else { } else {
#ifdef USE_CORS #ifdef USE_CORS
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()); 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 #else
WSContentSend_P(HTTP_FORM_WIFI_PART2, SettingsTextEscaped(SET_STASSID2).c_str(), WIFI_HOSTNAME, WIFI_HOSTNAME, SettingsTextEscaped(SET_HOSTNAME).c_str()); WSContentSend_P(HTTP_FORM_WIFI_PART2,
SettingsTextEscaped(SET_STASSID2).c_str(),
WIFI_HOSTNAME, WIFI_HOSTNAME,
SettingsTextEscaped(SET_HOSTNAME).c_str());
#endif // USE_CORS #endif // USE_CORS
} }
@ -2692,13 +2759,16 @@ void HandleWifiConfiguration(void) {
WSContentSend_P(PSTR("<h3>")); WSContentSend_P(PSTR("<h3>"));
if (WIFI_TESTING == Wifi.wifiTest) { if (WIFI_TESTING == Wifi.wifiTest) {
WSContentSend_P(PSTR(D_TRYING_TO_CONNECT "<br>%s</h3></div>"), SettingsTextEscaped(SET_STASSID1).c_str()); WSContentSend_P(PSTR(D_TRYING_TO_CONNECT "<br>%s</h3></div>"),
SettingsTextEscaped(SET_STASSID1).c_str());
} else if (WIFI_TEST_FINISHED_BAD == Wifi.wifiTest) { } else if (WIFI_TEST_FINISHED_BAD == Wifi.wifiTest) {
WSContentSend_P(PSTR(D_CONNECT_FAILED_TO " %s<br>" D_CHECK_CREDENTIALS "</h3></div>"), SettingsTextEscaped(SET_STASSID1).c_str()); WSContentSend_P(PSTR(D_CONNECT_FAILED_TO " %s<br>" D_CHECK_CREDENTIALS "</h3></div>"),
SettingsTextEscaped(SET_STASSID1).c_str());
} }
// More Options Button // More Options Button
WSContentSend_P(PSTR("<div id=butmod style=\"display:%s;\"></div><p></p><form id=butmo style=\"display:%s;\"><button type='button' onclick='hidBtns()'>" D_SHOW_MORE_OPTIONS "</button></form>"), WSContentSend_P(PSTR("<div id=butmod style=\"display:%s;\"></div><p></p><form id=butmo style=\"display:%s;\"><button type='button' onclick='hidBtns()'>" D_SHOW_MORE_OPTIONS "</button></form>"),
(WIFI_TEST_FINISHED_BAD == Wifi.wifiTest) ? "none" : Web.initial_config ? "block" : "none", Web.initial_config ? "block" : "none" (WIFI_TEST_FINISHED_BAD == Wifi.wifiTest) ? "none" : Web.initial_config ? "block" : "none",
Web.initial_config ? "block" : "none"
); );
WSContentSpaceButton(BUTTON_RESTORE, !Web.initial_config); WSContentSpaceButton(BUTTON_RESTORE, !Web.initial_config);
WSContentButton(BUTTON_RESET_CONFIGURATION, !Web.initial_config); WSContentButton(BUTTON_RESET_CONFIGURATION, !Web.initial_config);
@ -2742,6 +2812,7 @@ void HandleLoggingConfiguration(void) {
WSContentStart_P(PSTR(D_CONFIGURE_LOGGING)); WSContentStart_P(PSTR(D_CONFIGURE_LOGGING));
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_LOGGING_PARAMETERS));
WSContentSend_P(HTTP_FORM_LOG1); WSContentSend_P(HTTP_FORM_LOG1);
char stemp1[45]; char stemp1[45];
char stemp2[32]; char stemp2[32];
@ -2760,7 +2831,10 @@ void HandleLoggingConfiguration(void) {
} }
WSContentSend_P(PSTR("</select></p>")); WSContentSend_P(PSTR("</select></p>"));
} }
WSContentSend_P(HTTP_FORM_LOG2, SettingsTextEscaped(SET_SYSLOG_HOST).c_str(), Settings->syslog_port, Settings->tele_period); WSContentSend_P(HTTP_FORM_LOG2,
SettingsTextEscaped(SET_SYSLOG_HOST).c_str(),
Settings->syslog_port,
Settings->tele_period);
WSContentSend_P(HTTP_FORM_END); WSContentSend_P(HTTP_FORM_END);
WSContentSpaceButton(BUTTON_CONFIGURATION); WSContentSpaceButton(BUTTON_CONFIGURATION);
WSContentStop(); WSContentStop();
@ -2799,10 +2873,17 @@ void HandleOtherConfiguration(void) {
WSContentSendStyle(); WSContentSendStyle();
TemplateJson(); TemplateJson();
WSContentSend_P(HTTP_FORM_OTHER, HtmlEscape(ResponseData()).c_str(), (USER_MODULE == Settings->module) ? PSTR(" checked disabled") : "",
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_OTHER_PARAMETERS));
WSContentSend_P(HTTP_FORM_OTHER1);
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_TEMPLATE));
WSContentSend_P(HTTP_FORM_OTHER2,
HtmlEscape(ResponseData()).c_str(),
(USER_MODULE == Settings->module) ? PSTR(" checked disabled") : "",
(Settings->flag5.disable_referer_chk) ? PSTR(" checked") : "", // SetOption128 - Enable HTTP API (Settings->flag5.disable_referer_chk) ? PSTR(" checked") : "", // SetOption128 - Enable HTTP API
(Settings->flag.mqtt_enabled) ? PSTR(" checked") : "", // SetOption3 - Enable MQTT (Settings->flag.mqtt_enabled) ? PSTR(" checked") : "", // SetOption3 - Enable MQTT
SettingsTextEscaped(SET_FRIENDLYNAME1).c_str(), SettingsTextEscaped(SET_DEVICENAME).c_str()); SettingsTextEscaped(SET_FRIENDLYNAME1).c_str(),
SettingsTextEscaped(SET_DEVICENAME).c_str());
char stemp[32]; char stemp[32];
uint32_t maxfn = (TasmotaGlobal.devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : (!TasmotaGlobal.devices_present) ? 1 : TasmotaGlobal.devices_present; uint32_t maxfn = (TasmotaGlobal.devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : (!TasmotaGlobal.devices_present) ? 1 : TasmotaGlobal.devices_present;
@ -2821,7 +2902,9 @@ void HandleOtherConfiguration(void) {
#ifdef USE_EMULATION #ifdef USE_EMULATION
#if defined(USE_EMULATION_WEMO) || defined(USE_EMULATION_HUE) #if defined(USE_EMULATION_WEMO) || defined(USE_EMULATION_HUE)
WSContentSend_P(PSTR("<p></p><fieldset><legend><b>&nbsp;" D_EMULATION "&nbsp;</b></legend><p>")); // Keep close to Friendlynames so do not use <br> WSContentSend_P(PSTR("<p></p>")); // Keep close to Friendlynames so do not use <br>
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_EMULATION));
WSContentSend_P(PSTR("<p>")); // Keep close to Friendlynames so do not use <br>
for (uint32_t i = 0; i < EMUL_MAX; i++) { for (uint32_t i = 0; i < EMUL_MAX; i++) {
#ifndef USE_EMULATION_WEMO #ifndef USE_EMULATION_WEMO
if (i == EMUL_WEMO) { i++; } if (i == EMUL_WEMO) { i++; }
@ -2935,7 +3018,8 @@ void HandleRestoreConfiguration(void) {
WSContentStart_P(PSTR(D_RESTORE_CONFIGURATION)); WSContentStart_P(PSTR(D_RESTORE_CONFIGURATION));
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_FORM_RST); WSContentSend_P(HTTP_DIV_BLOCK);
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_RESTORE_CONFIGURATION));
WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_START_RESTORE)); WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_START_RESTORE));
if (WifiIsInManagerMode()) { if (WifiIsInManagerMode()) {
WSContentSpaceButton(BUTTON_MAIN); WSContentSpaceButton(BUTTON_MAIN);
@ -2952,7 +3036,8 @@ void HandleRestoreConfiguration(void) {
\*********************************************************************************************/ \*********************************************************************************************/
void WSContentSeparatorI(uint32_t size) { 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:2px'%s>"),
(1 == size)?" size=1":"");
// WSContentSend_P(PSTR("</td></tr><tr><td colspan=2><hr style='font-size:%dpx'/>"), size); // WSContentSend_P(PSTR("</td></tr><tr><td colspan=2><hr style='font-size:%dpx'/>"), size);
// WSContentSend_P(PSTR("</td></tr><tr><td colspan=2><hr style='border_top:%dpx solid'/>"), size); // WSContentSend_P(PSTR("</td></tr><tr><td colspan=2><hr style='border_top:%dpx solid'/>"), size);
// WSContentSend_P(PSTR("</td></tr><tr><td colspan=2 style='border-bottom:%dpx solid #ccc;'>"), size); // WSContentSend_P(PSTR("</td></tr><tr><td colspan=2 style='border-bottom:%dpx solid #ccc;'>"), size);
@ -2988,12 +3073,17 @@ void HandleInformation(void) {
WSContentSend_P(HTTP_SCRIPT_INFO_BEGIN); WSContentSend_P(HTTP_SCRIPT_INFO_BEGIN);
WSContentSend_P(HTTP_MENU_HEAD, D_INFORMATION); WSContentSend_P(HTTP_MENU_HEAD, D_INFORMATION);
WSContentSend_P(PSTR("<table style='width:100%%'><tr><th>")); WSContentSend_P(PSTR("<table style='width:100%%'><tr><th>"));
WSContentSend_P(PSTR(D_PROGRAM_VERSION "}2%s %s %s"), TasmotaGlobal.version, TasmotaGlobal.image_name, GetCodeCores().c_str()); WSContentSend_P(PSTR(D_PROGRAM_VERSION "}2%s %s %s"),
TasmotaGlobal.version,
TasmotaGlobal.image_name,
GetCodeCores().c_str());
WSContentSend_P(PSTR("}1" D_BUILD_DATE_AND_TIME "}2%s"), GetBuildDateAndTime().c_str()); WSContentSend_P(PSTR("}1" D_BUILD_DATE_AND_TIME "}2%s"), GetBuildDateAndTime().c_str());
WSContentSend_P(PSTR("}1" D_CORE_AND_SDK_VERSION "}2" ARDUINO_CORE_RELEASE "/%s"), ESP.getSdkVersion()); WSContentSend_P(PSTR("}1" D_CORE_AND_SDK_VERSION "}2" ARDUINO_CORE_RELEASE "/%s"), ESP.getSdkVersion());
WSContentSend_P(PSTR("}1" D_UPTIME "}2%s"), GetUptime().c_str()); WSContentSend_P(PSTR("}1" D_UPTIME "}2%s"), GetUptime().c_str());
#ifdef ESP8266 #ifdef ESP8266
WSContentSend_P(PSTR("}1" D_FLASH_WRITE_COUNT "}2%d " D_AT " 0x%X"), Settings->save_flag, GetSettingsAddress()); WSContentSend_P(PSTR("}1" D_FLASH_WRITE_COUNT "}2%d " D_AT " 0x%X"),
Settings->save_flag,
GetSettingsAddress());
#endif // ESP8266 #endif // ESP8266
#ifdef ESP32 #ifdef ESP32
WSContentSend_P(PSTR("}1" D_FLASH_WRITE_COUNT "}2%d"), Settings->save_flag); WSContentSend_P(PSTR("}1" D_FLASH_WRITE_COUNT "}2%d"), Settings->save_flag);
@ -3005,11 +3095,15 @@ void HandleInformation(void) {
if (IsModuleIfan()) { maxfn = 1; } if (IsModuleIfan()) { maxfn = 1; }
#endif // USE_SONOFF_IFAN #endif // USE_SONOFF_IFAN
for (uint32_t i = 0; i < maxfn; i++) { for (uint32_t i = 0; i < maxfn; i++) {
WSContentSend_P(PSTR("}1" D_FRIENDLY_NAME " %d}2%s"), i +1, SettingsTextEscaped(SET_FRIENDLYNAME1 +i).c_str()); WSContentSend_P(PSTR("}1" D_FRIENDLY_NAME " %d}2%s"),
i +1,
SettingsTextEscaped(SET_FRIENDLYNAME1 +i).c_str());
} }
WSContentSeparatorIFat(); WSContentSeparatorIFat();
#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED #ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED
WSContentSend_P(PSTR("}1" D_HOSTED_MCU "}2%s (%s)"), GetHostedMCU().c_str(), GetHostedFwVersion(1).c_str()); WSContentSend_P(PSTR("}1" D_HOSTED_MCU "}2%s (%s)"),
GetHostedMCU().c_str(),
GetHostedFwVersion(1).c_str());
WSContentSeparatorIFat(); WSContentSeparatorIFat();
#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED #endif // CONFIG_ESP_WIFI_REMOTE_ENABLED
bool show_hr = false; bool show_hr = false;
@ -3029,7 +3123,9 @@ void HandleInformation(void) {
WiFi.channel(), WiFi.channel(),
WiFi.BSSIDstr().c_str()); WiFi.BSSIDstr().c_str());
WSContentSeparatorIFat(); WSContentSeparatorIFat();
WSContentSend_P(PSTR("}1" D_HOSTNAME "}2%s%s"), TasmotaGlobal.hostname, (Mdns.begun) ? PSTR(".local") : ""); WSContentSend_P(PSTR("}1" D_HOSTNAME "}2%s%s"),
TasmotaGlobal.hostname,
(Mdns.begun) ? PSTR(".local") : "");
#ifdef USE_IPV6 #ifdef USE_IPV6
String ipv6_addr = WifiGetIPv6Str(); String ipv6_addr = WifiGetIPv6Str();
if (ipv6_addr != "") { if (ipv6_addr != "") {
@ -3063,7 +3159,9 @@ void HandleInformation(void) {
if (show_hr) { if (show_hr) {
WSContentSeparatorIThin(); WSContentSeparatorIThin();
} }
WSContentSend_P(PSTR("}1" D_HOSTNAME "}2%s%s"), EthernetHostname(), (Mdns.begun) ? PSTR(".local") : ""); WSContentSend_P(PSTR("}1" D_HOSTNAME "}2%s%s"),
EthernetHostname(),
(Mdns.begun) ? PSTR(".local") : "");
#ifdef USE_IPV6 #ifdef USE_IPV6
String ipv6_eth_addr = EthernetGetIPv6Str(); String ipv6_eth_addr = EthernetGetIPv6Str();
if (ipv6_eth_addr != "") { if (ipv6_eth_addr != "") {
@ -3090,13 +3188,15 @@ void HandleInformation(void) {
} }
#endif // USE_ETHERNET #endif // USE_ETHERNET
WSContentSeparatorIFat(); WSContentSeparatorIFat();
WSContentSend_P(PSTR("}1" D_HTTP_API "}2%s"), Settings->flag5.disable_referer_chk ? PSTR(D_ENABLED) : PSTR(D_DISABLED)); // SetOption 128 WSContentSend_P(PSTR("}1" D_HTTP_API "}2%s"),
Settings->flag5.disable_referer_chk ? PSTR(D_ENABLED) : PSTR(D_DISABLED)); // SetOption 128
WSContentSeparatorIFat(); WSContentSeparatorIFat();
if (Settings->flag.mqtt_enabled) { // SetOption3 - Enable MQTT if (Settings->flag.mqtt_enabled) { // SetOption3 - Enable MQTT
WSContentSend_P(PSTR("}1" D_MQTT_HOST "}2%s"), SettingsTextEscaped(SET_MQTT_HOST).c_str()); WSContentSend_P(PSTR("}1" D_MQTT_HOST "}2%s"), SettingsTextEscaped(SET_MQTT_HOST).c_str());
WSContentSend_P(PSTR("}1" D_MQTT_PORT "}2%d"), Settings->mqtt_port); WSContentSend_P(PSTR("}1" D_MQTT_PORT "}2%d"), Settings->mqtt_port);
#ifdef USE_MQTT_TLS #ifdef USE_MQTT_TLS
WSContentSend_P(PSTR("}1" D_MQTT_TLS_ENABLE "}2%s"), Settings->flag4.mqtt_tls ? PSTR(D_ENABLED) : PSTR(D_DISABLED)); WSContentSend_P(PSTR("}1" D_MQTT_TLS_ENABLE "}2%s"),
Settings->flag4.mqtt_tls ? PSTR(D_ENABLED) : PSTR(D_DISABLED));
#endif // USE_MQTT_TLS #endif // USE_MQTT_TLS
WSContentSend_P(PSTR("}1" D_MQTT_USER "}2%s"), SettingsTextEscaped(SET_MQTT_USER).c_str()); WSContentSend_P(PSTR("}1" D_MQTT_USER "}2%s"), SettingsTextEscaped(SET_MQTT_USER).c_str());
WSContentSend_P(PSTR("}1" D_MQTT_CLIENT "}2%s"), TasmotaGlobal.mqtt_client); WSContentSend_P(PSTR("}1" D_MQTT_CLIENT "}2%s"), TasmotaGlobal.mqtt_client);
@ -3105,12 +3205,18 @@ void HandleInformation(void) {
for (uint32_t i = 0; i < MAX_GROUP_TOPICS; i++) { for (uint32_t i = 0; i < MAX_GROUP_TOPICS; i++) {
if (1 == i) { real_index = SET_MQTT_GRP_TOPIC2 -1; } if (1 == i) { real_index = SET_MQTT_GRP_TOPIC2 -1; }
if (strlen(SettingsText(real_index +i))) { if (strlen(SettingsText(real_index +i))) {
WSContentSend_P(PSTR("}1" D_MQTT_GROUP_TOPIC " %d}2%s"), 1 +i, GetGroupTopic_P(stopic, "", real_index +i)); WSContentSend_P(PSTR("}1" D_MQTT_GROUP_TOPIC " %d}2%s"),
1 +i,
GetGroupTopic_P(stopic, "",
real_index +i));
} }
} }
WSContentSend_P(PSTR("}1" D_MQTT_FULL_TOPIC "}2%s"), GetTopic_P(stopic, CMND, TasmotaGlobal.mqtt_topic, "")); WSContentSend_P(PSTR("}1" D_MQTT_FULL_TOPIC "}2%s"),
WSContentSend_P(PSTR("}1" D_MQTT " " D_FALLBACK_TOPIC "}2%s"), GetFallbackTopic_P(stopic, "")); GetTopic_P(stopic, CMND, TasmotaGlobal.mqtt_topic, ""));
WSContentSend_P(PSTR("}1" D_MQTT_NO_RETAIN "}2%s"), Settings->flag4.mqtt_no_retain ? PSTR(D_ENABLED) : PSTR(D_DISABLED)); WSContentSend_P(PSTR("}1" D_MQTT " " D_FALLBACK_TOPIC "}2%s"),
GetFallbackTopic_P(stopic, ""));
WSContentSend_P(PSTR("}1" D_MQTT_NO_RETAIN "}2%s"),
Settings->flag4.mqtt_no_retain ? PSTR(D_ENABLED) : PSTR(D_DISABLED));
} else { } else {
WSContentSend_P(PSTR("}1" D_MQTT "}2" D_DISABLED)); WSContentSend_P(PSTR("}1" D_MQTT "}2" D_DISABLED));
} }
@ -3119,11 +3225,13 @@ void HandleInformation(void) {
WSContentSeparatorIFat(); WSContentSeparatorIFat();
#endif // USE_EMULATION or USE_DISCOVERY #endif // USE_EMULATION or USE_DISCOVERY
#ifdef USE_EMULATION #ifdef USE_EMULATION
WSContentSend_P(PSTR("}1" D_EMULATION "}2%s"), GetTextIndexed(stopic, sizeof(stopic), Settings->flag2.emulation, kEmulationOptions)); WSContentSend_P(PSTR("}1" D_EMULATION "}2%s"),
GetTextIndexed(stopic, sizeof(stopic), Settings->flag2.emulation, kEmulationOptions));
#endif // USE_EMULATION #endif // USE_EMULATION
#ifdef USE_DISCOVERY #ifdef USE_DISCOVERY
WSContentSend_P(PSTR("}1" D_MDNS_DISCOVERY "}2%s"), (Settings->flag3.mdns_enabled) ? D_ENABLED : D_DISABLED); // SetOption55 - Control mDNS service WSContentSend_P(PSTR("}1" D_MDNS_DISCOVERY "}2%s"),
(Settings->flag3.mdns_enabled) ? D_ENABLED : D_DISABLED); // SetOption55 - Control mDNS service
if (Settings->flag3.mdns_enabled) { // SetOption55 - Control mDNS service if (Settings->flag3.mdns_enabled) { // SetOption55 - Control mDNS service
#ifdef WEBSERVER_ADVERTISE #ifdef WEBSERVER_ADVERTISE
WSContentSend_P(PSTR("}1" D_MDNS_ADVERTISE "}2" D_WEB_SERVER)); WSContentSend_P(PSTR("}1" D_MDNS_ADVERTISE "}2" D_WEB_SERVER));
@ -3134,7 +3242,9 @@ void HandleInformation(void) {
#endif // USE_DISCOVERY #endif // USE_DISCOVERY
WSContentSeparatorIFat(); WSContentSeparatorIFat();
WSContentSend_P(PSTR("}1" D_ESP_CHIP_ID "}2%d (%s)"), ESP_getChipId(), GetDeviceHardwareRevision().c_str()); WSContentSend_P(PSTR("}1" D_ESP_CHIP_ID "}2%d (%s)"),
ESP_getChipId(),
GetDeviceHardwareRevision().c_str());
WSContentSend_P(PSTR("}1" D_FLASH_CHIP_ID "}20x%06X (" D_TASMOTA_FLASHMODE ")"), ESP_getFlashChipId()); WSContentSend_P(PSTR("}1" D_FLASH_CHIP_ID "}20x%06X (" D_TASMOTA_FLASHMODE ")"), ESP_getFlashChipId());
#ifdef ESP32 #ifdef ESP32
WSContentSend_P(PSTR("}1" D_FLASH_CHIP_SIZE "}2%d KB"), ESP.getFlashChipSize() / 1024); WSContentSend_P(PSTR("}1" D_FLASH_CHIP_SIZE "}2%d KB"), ESP.getFlashChipSize() / 1024);
@ -3150,7 +3260,9 @@ void HandleInformation(void) {
#ifdef USE_GT911 #ifdef USE_GT911
WSContentSend_PD(PSTR("}1" D_FREE_MEMORY "}2%1_f KB"), &freemem); WSContentSend_PD(PSTR("}1" D_FREE_MEMORY "}2%1_f KB"), &freemem);
#else #else
WSContentSend_PD(PSTR("}1" D_FREE_MEMORY "}2%1_f KB (" D_FRAGMENTATION " %d%%)"), &freemem, ESP_getHeapFragmentation()); WSContentSend_PD(PSTR("}1" D_FREE_MEMORY "}2%1_f KB (" D_FRAGMENTATION " %d%%)"),
&freemem,
ESP_getHeapFragmentation());
#endif // USE_GT911 #endif // USE_GT911
if (UsePSRAM()) { if (UsePSRAM()) {
WSContentSend_P(PSTR("}1" D_PSR_MAX_MEMORY "}2%d KB"), ESP.getPsramSize() / 1024); WSContentSend_P(PSTR("}1" D_PSR_MAX_MEMORY "}2%d KB"), ESP.getPsramSize() / 1024);
@ -3204,10 +3316,10 @@ void HandleInformation(void) {
WSContentSend_P(HTTP_SCRIPT_INFO_END); WSContentSend_P(HTTP_SCRIPT_INFO_END);
WSContentSendStyle(); WSContentSendStyle();
// WSContentSend_P(PSTR("<fieldset><legend><b>&nbsp;Information&nbsp;</b></legend>")); // WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR("Information"));
WSContentSend_P(PSTR("<style>th{padding-right:5px;}</style>" WSContentSend_P(PSTR("<style>th{padding-right:5px;}</style>"
"<div id='i' name='i'></div>")); "<div id='i' name='i'></div>"));
// WSContentSend_P(PSTR("</fieldset>")); // WSContentSend_P(PSTR("</fieldset>"));
WSContentSpaceButton(BUTTON_MAIN); WSContentSpaceButton(BUTTON_MAIN);
WSContentStop(); WSContentStop();
} }
@ -3278,8 +3390,10 @@ void HandleUpgradeFirmware(void) {
WSContentStart_P(PSTR(D_FIRMWARE_UPGRADE)); WSContentStart_P(PSTR(D_FIRMWARE_UPGRADE));
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_MENU_HEAD, D_FIRMWARE_UPGRADE); WSContentSend_P(HTTP_MENU_HEAD, D_FIRMWARE_UPGRADE);
WSContentSend_P(HTTP_DIV_BLOCK);
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_UPGRADE_BY_WEBSERVER));
WSContentSend_P(HTTP_FORM_UPG, SettingsTextEscaped(SET_OTAURL).c_str()); WSContentSend_P(HTTP_FORM_UPG, SettingsTextEscaped(SET_OTAURL).c_str());
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_UPGRADE_BY_FILE_UPLOAD));
#ifdef ESP32 #ifdef ESP32
if (EspSingleOtaPartition() && !EspRunningFactoryPartition()) { if (EspSingleOtaPartition() && !EspRunningFactoryPartition()) {
WSContentSend_P(HTTP_FORM_RST_UPG_FCT, PSTR(D_START_UPGRADE)); WSContentSend_P(HTTP_FORM_RST_UPG_FCT, PSTR(D_START_UPGRADE));
@ -3346,7 +3460,8 @@ void HandleUploadDone(void) {
WSContentStart_P(PSTR(D_INFORMATION)); WSContentStart_P(PSTR(D_INFORMATION));
if (!Web.upload_error) { if (!Web.upload_error) {
WSContentSend_P(HTTP_SCRIPT_RELOAD_TIME, (UPL_TASMOTA == Web.upload_file_type) ? HTTP_OTA_RESTART_RECONNECT_TIME : HTTP_RESTART_RECONNECT_TIME); // Refesh main web ui after OTA upgrade WSContentSend_P(HTTP_SCRIPT_RELOAD_TIME,
(UPL_TASMOTA == Web.upload_file_type) ? HTTP_OTA_RESTART_RECONNECT_TIME : HTTP_RESTART_RECONNECT_TIME); // Refesh main web ui after OTA upgrade
} }
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(PSTR("<div style='text-align:center;'><b>" D_UPLOAD " <font color='#")); WSContentSend_P(PSTR("<div style='text-align:center;'><b>" D_UPLOAD " <font color='#"));

View File

@ -2055,7 +2055,6 @@ const char HTTP_BTN_MENU_MQTT[] PROGMEM =
"<p></p><form action='" WEB_HANDLE_MQTT "' method='get'><button>" D_CONFIGURE_MQTT "</button></form>"; "<p></p><form action='" WEB_HANDLE_MQTT "' method='get'><button>" D_CONFIGURE_MQTT "</button></form>";
const char HTTP_FORM_MQTT1[] PROGMEM = const char HTTP_FORM_MQTT1[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_MQTT_PARAMETERS "&nbsp;</b></legend>"
"<form method='get' action='" WEB_HANDLE_MQTT "'>" "<form method='get' action='" WEB_HANDLE_MQTT "'>"
"<p><b>" D_HOST "</b> (" MQTT_HOST ")<br><input id='mh' placeholder=\"" MQTT_HOST "\" value=\"%s\"></p>" "<p><b>" D_HOST "</b> (" MQTT_HOST ")<br><input id='mh' placeholder=\"" MQTT_HOST "\" value=\"%s\"></p>"
"<p><b>" D_PORT "</b> (" STR(MQTT_PORT) ")<br><input id='ml' placeholder='" STR(MQTT_PORT) "' value='%d'></p>" "<p><b>" D_PORT "</b> (" STR(MQTT_PORT) ")<br><input id='ml' placeholder='" STR(MQTT_PORT) "' value='%d'></p>"
@ -2085,6 +2084,7 @@ void HandleMqttConfiguration(void)
WSContentStart_P(PSTR(D_CONFIGURE_MQTT)); WSContentStart_P(PSTR(D_CONFIGURE_MQTT));
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_MQTT_PARAMETERS));
WSContentSend_P(HTTP_FORM_MQTT1, WSContentSend_P(HTTP_FORM_MQTT1,
SettingsTextEscaped(SET_MQTT_HOST).c_str(), SettingsTextEscaped(SET_MQTT_HOST).c_str(),
Settings->mqtt_port, Settings->mqtt_port,

View File

@ -640,7 +640,6 @@ const char HTTP_BTN_MENU_DOMOTICZ[] PROGMEM =
"<p></p><form action='" WEB_HANDLE_DOMOTICZ "' method='get'><button>" D_CONFIGURE_DOMOTICZ "</button></form>"; "<p></p><form action='" WEB_HANDLE_DOMOTICZ "' method='get'><button>" D_CONFIGURE_DOMOTICZ "</button></form>";
const char HTTP_FORM_DOMOTICZ[] PROGMEM = const char HTTP_FORM_DOMOTICZ[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_DOMOTICZ_PARAMETERS "&nbsp;</b></legend>"
"<form method='post' action='" WEB_HANDLE_DOMOTICZ "'>" "<form method='post' action='" WEB_HANDLE_DOMOTICZ "'>"
"<table>"; "<table>";
const char HTTP_FORM_DOMOTICZ_RELAY[] PROGMEM = const char HTTP_FORM_DOMOTICZ_RELAY[] PROGMEM =
@ -668,6 +667,7 @@ void HandleDomoticzConfiguration(void) {
WSContentStart_P(PSTR(D_CONFIGURE_DOMOTICZ)); WSContentStart_P(PSTR(D_CONFIGURE_DOMOTICZ));
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_DOMOTICZ_PARAMETERS));
WSContentSend_P(HTTP_FORM_DOMOTICZ); WSContentSend_P(HTTP_FORM_DOMOTICZ);
for (uint32_t i = 0; i < MAX_DOMOTICZ_IDX; i++) { for (uint32_t i = 0; i < MAX_DOMOTICZ_IDX; i++) {
if (i < TasmotaGlobal.devices_present) { if (i < TasmotaGlobal.devices_present) {

View File

@ -107,7 +107,7 @@ Domoticz_t* Domoticz;
* Driver Settings load and save * Driver Settings load and save
\*********************************************************************************************/ \*********************************************************************************************/
#define XDRV_07_KEY "drvset03" #define XDRV_07_KEY "drvset03" // Should have been drvset07
bool DomoticzLoadData(void) { bool DomoticzLoadData(void) {
char key[] = XDRV_07_KEY; char key[] = XDRV_07_KEY;
@ -876,7 +876,6 @@ const char HTTP_BTN_MENU_DOMOTICZ[] PROGMEM =
"<p></p><form action='" WEB_HANDLE_DOMOTICZ "' method='get'><button>" D_CONFIGURE_DOMOTICZ "</button></form>"; "<p></p><form action='" WEB_HANDLE_DOMOTICZ "' method='get'><button>" D_CONFIGURE_DOMOTICZ "</button></form>";
const char HTTP_FORM_DOMOTICZ[] PROGMEM = const char HTTP_FORM_DOMOTICZ[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_DOMOTICZ_PARAMETERS "&nbsp;</b></legend>"
"<form method='post' action='" WEB_HANDLE_DOMOTICZ "'>" "<form method='post' action='" WEB_HANDLE_DOMOTICZ "'>"
"<table>" "<table>"
"<tr><td style='width:116px'></td><td style='width:70px'><b>%s</b></td><td style='width:70px'><b>%s</b></td><td style='width:70px'></td></tr>"; "<tr><td style='width:116px'></td><td style='width:70px'><b>%s</b></td><td style='width:70px'><b>%s</b></td><td style='width:70px'></td></tr>";
@ -903,7 +902,9 @@ void HandleDomoticzConfiguration(void) {
WSContentStart_P(PSTR(D_CONFIGURE_DOMOTICZ)); WSContentStart_P(PSTR(D_CONFIGURE_DOMOTICZ));
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_FORM_DOMOTICZ, (Domoticz->switches)? D_DOMOTICZ_SWITCH :"", (Domoticz->keys)? D_DOMOTICZ_KEY :""); WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_DOMOTICZ_PARAMETERS));
WSContentSend_P(HTTP_FORM_DOMOTICZ,
(Domoticz->switches)? D_DOMOTICZ_SWITCH :"", (Domoticz->keys)? D_DOMOTICZ_KEY :"");
for (uint32_t i = 0; i < Domoticz->devices; i++) { for (uint32_t i = 0; i < Domoticz->devices; i++) {
WSContentSend_P(HTTP_FORM_DOMOTICZ_INDEX, i +1); WSContentSend_P(HTTP_FORM_DOMOTICZ_INDEX, i +1);
if (i < Domoticz->switches) { if (i < Domoticz->switches) {

View File

@ -10048,7 +10048,6 @@ const char HTTP_BTN_MENU_RULES[] PROGMEM =
"<p></p><form action='" WEB_HANDLE_SCRIPT "' method='get'><button>" D_CONFIGURE_SCRIPT "</button></form>"; "<p></p><form action='" WEB_HANDLE_SCRIPT "' method='get'><button>" D_CONFIGURE_SCRIPT "</button></form>";
const char HTTP_FORM_SCRIPT[] PROGMEM = const char HTTP_FORM_SCRIPT[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_SCRIPT "&nbsp;</b></legend>"
"<form method='post' action='" WEB_HANDLE_SCRIPT "'>"; "<form method='post' action='" WEB_HANDLE_SCRIPT "'>";
const char HTTP_FORM_SCRIPT1[] PROGMEM = const char HTTP_FORM_SCRIPT1[] PROGMEM =
@ -10456,6 +10455,7 @@ void HandleScriptConfiguration(void) {
WSContentStart_P(PSTR(D_CONFIGURE_SCRIPT)); WSContentStart_P(PSTR(D_CONFIGURE_SCRIPT));
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_SCRIPT));
WSContentSend_P(HTTP_FORM_SCRIPT); WSContentSend_P(HTTP_FORM_SCRIPT);
#ifdef xSCRIPT_STRIP_COMMENTS #ifdef xSCRIPT_STRIP_COMMENTS

View File

@ -519,7 +519,6 @@ const char HTTP_BTN_MENU_PCF8574[] PROGMEM =
"<p></p><form action='" WEB_HANDLE_PCF8574 "' method='get'><button>" D_CONFIGURE_PCF8574 "</button></form>"; "<p></p><form action='" WEB_HANDLE_PCF8574 "' method='get'><button>" D_CONFIGURE_PCF8574 "</button></form>";
const char HTTP_FORM_I2C_PCF8574_1[] PROGMEM = const char HTTP_FORM_I2C_PCF8574_1[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_PCF8574_PARAMETERS "&nbsp;</b></legend>"
"<form method='get' action='" WEB_HANDLE_PCF8574 "'>" "<form method='get' action='" WEB_HANDLE_PCF8574 "'>"
"<p><label><input id='b1' name='b1' type='checkbox'%s><b>" D_INVERT_PORTS "</b></label></p><hr/>"; "<p><label><input id='b1' name='b1' type='checkbox'%s><b>" D_INVERT_PORTS "</b></label></p><hr/>";
@ -544,6 +543,7 @@ void HandlePcf8574(void) {
WSContentStart_P(D_CONFIGURE_PCF8574); WSContentStart_P(D_CONFIGURE_PCF8574);
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_PCF8574_PARAMETERS));
WSContentSend_P(HTTP_FORM_I2C_PCF8574_1, (Settings->flag3.pcf8574_ports_inverted) ? PSTR(" checked") : ""); // SetOption81 - Invert all ports on PCF8574 devices WSContentSend_P(HTTP_FORM_I2C_PCF8574_1, (Settings->flag3.pcf8574_ports_inverted) ? PSTR(" checked") : ""); // SetOption81 - Invert all ports on PCF8574 devices
WSContentSend_P(HTTP_TABLE100); WSContentSend_P(HTTP_TABLE100);
for (uint32_t idx = 0; idx < Pcf8574.max_devices; idx++) { for (uint32_t idx = 0; idx < Pcf8574.max_devices; idx++) {

View File

@ -1271,9 +1271,6 @@ const char UFS_CURRDIR[] PROGMEM =
#define D_CURR_DIR "Folder" #define D_CURR_DIR "Folder"
#endif #endif
const char UFS_FORM_FILE_UPLOAD[] PROGMEM =
"<div id='f1' name='f1' style='display:block;'>"
"<fieldset><legend><b>&nbsp;" D_MANAGE_FILE_SYSTEM "&nbsp;</b></legend>";
const char UFS_FORM_FILE_UPGc[] PROGMEM = const char UFS_FORM_FILE_UPGc[] PROGMEM =
"<div style='text-align:left;color:#%06x;'>" D_FS_SIZE " %s MB - " D_FS_FREE " %s MB"; "<div style='text-align:left;color:#%06x;'>" D_FS_SIZE " %s MB - " D_FS_FREE " %s MB";
@ -1329,7 +1326,6 @@ const char UFS_FORM_SDC_HREFedit[] PROGMEM =
"<a href='ufse?file=%s/%s'>&#x1F4DD;</a>"; // 📝 "<a href='ufse?file=%s/%s'>&#x1F4DD;</a>"; // 📝
const char HTTP_EDITOR_FORM_START[] PROGMEM = const char HTTP_EDITOR_FORM_START[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_EDIT_FILE "&nbsp;</b></legend>"
"<form>" "<form>"
"<label for='name'>" D_FILE ":</label><input type='text' id='name' name='name' value='%s'><br><hr width='98%%'>" "<label for='name'>" D_FILE ":</label><input type='text' id='name' name='name' value='%s'><br><hr width='98%%'>"
"<textarea id='content' name='content' wrap='off' rows='8' cols='80' style='font-size: 12pt'>"; "<textarea id='content' name='content' wrap='off' rows='8' cols='80' style='font-size: 12pt'>";
@ -1427,7 +1423,8 @@ void UfsDirectory(void) {
WSContentStart_P(PSTR(D_MANAGE_FILE_SYSTEM)); WSContentStart_P(PSTR(D_MANAGE_FILE_SYSTEM));
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(UFS_FORM_FILE_UPLOAD); WSContentSend_P(HTTP_DIV_BLOCK);
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_MANAGE_FILE_SYSTEM));
char ts[FLOATSZ]; char ts[FLOATSZ];
dtostrfd((float)UfsInfo(0, ufs_dir == 2 ? 1:0) / 1000, 3, ts); dtostrfd((float)UfsInfo(0, ufs_dir == 2 ? 1:0) / 1000, 3, ts);
@ -1756,6 +1753,7 @@ void UfsEditor(void) {
WSContentStart_P(PSTR(D_EDIT_FILE)); WSContentStart_P(PSTR(D_EDIT_FILE));
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_EDIT_FILE));
char *bfname = fname +1; char *bfname = fname +1;
WSContentSend_P(HTTP_EDITOR_FORM_START, bfname); // Skip leading slash WSContentSend_P(HTTP_EDITOR_FORM_START, bfname); // Skip leading slash

View File

@ -3584,7 +3584,6 @@ const char HTTP_BTN_MENU_BLE[] PROGMEM =
"<p></p><form action='" WEB_HANDLE_BLE "' method='get'><button>" D_CONFIGURE_BLE "</button></form>"; "<p></p><form action='" WEB_HANDLE_BLE "' method='get'><button>" D_CONFIGURE_BLE "</button></form>";
const char HTTP_FORM_BLE[] PROGMEM = const char HTTP_FORM_BLE[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_BLE_PARAMETERS "&nbsp;</b></legend>"
"<form method='get' action='" WEB_HANDLE_BLE "'>" "<form method='get' action='" WEB_HANDLE_BLE "'>"
"<p><label><input id='e0' type='checkbox'%s><b>" D_BLE_ENABLE "</b></label></p>" "<p><label><input id='e0' type='checkbox'%s><b>" D_BLE_ENABLE "</b></label></p>"
"<p><label><input id='e1' type='checkbox'%s><b>" D_BLE_ACTIVESCAN "</b></label></p>" "<p><label><input id='e1' type='checkbox'%s><b>" D_BLE_ACTIVESCAN "</b></label></p>"
@ -3593,7 +3592,7 @@ const char HTTP_FORM_BLE[] PROGMEM =
const char HTTP_BLE_DEV_STYLE[] PROGMEM = "th, td { padding-left:5px; }"; const char HTTP_BLE_DEV_STYLE[] PROGMEM = "th, td { padding-left:5px; }";
const char HTTP_BLE_DEV_START[] PROGMEM = const char HTTP_BLE_DEV_START[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_BLE_DEVICES "&nbsp;</b></legend><table>" "<table>"
"<tr><th><label>mac(type)</label></th><th><label>alias</label></th><th><label>name</label></th><th><label>RSSI</label></th><th><label>Age(max)</label></th></tr>"; "<tr><th><label>mac(type)</label></th><th><label>alias</label></th><th><label>name</label></th><th><label>RSSI</label></th><th><label>Age(max)</label></th></tr>";
const char HTTP_BLE_DEV[] PROGMEM = const char HTTP_BLE_DEV[] PROGMEM =
"<tr><td><label>%s(%d)</label></td><td><label>%s</label></td><td><label>%s</label></td><td><label>%d</label></td><td><label>%d(%d)</label></td></tr>"; "<tr><td><label>%s(%d)</label></td><td><label>%s</label></td><td><label>%s</label></td><td><label>%d</label></td><td><label>%d(%d)</label></td></tr>";
@ -3644,6 +3643,7 @@ void HandleBleConfiguration(void)
WSContentStart_P(PSTR(D_CONFIGURE_BLE)); WSContentStart_P(PSTR(D_CONFIGURE_BLE));
WSContentSendStyle_P(HTTP_BLE_DEV_STYLE); WSContentSendStyle_P(HTTP_BLE_DEV_STYLE);
//WSContentSendStyle(); //WSContentSendStyle();
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_BLE_PARAMETERS));
WSContentSend_P(HTTP_FORM_BLE, WSContentSend_P(HTTP_FORM_BLE,
(Settings->flag5.mi32_enable) ? " checked" : "", (Settings->flag5.mi32_enable) ? " checked" : "",
(BLEScanActiveMode) ? " checked" : "" (BLEScanActiveMode) ? " checked" : ""
@ -3655,6 +3655,7 @@ void HandleBleConfiguration(void)
//TasAutoMutex localmutex(&BLEOperationsRecursiveMutex, "BLEConf"); //TasAutoMutex localmutex(&BLEOperationsRecursiveMutex, "BLEConf");
int number = seenDevices.size(); int number = seenDevices.size();
if (number){ if (number){
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_BLE_DEVICES));
WSContentSend_P(HTTP_BLE_DEV_START); WSContentSend_P(HTTP_BLE_DEV_START);
uint64_t now = esp_timer_get_time(); uint64_t now = esp_timer_get_time();
now = now/1000L; now = now/1000L;

View File

@ -621,15 +621,13 @@ const char HTTP_BTN_MENU_MAIN_HX711[] PROGMEM =
const char HTTP_BTN_MENU_HX711[] PROGMEM = const char HTTP_BTN_MENU_HX711[] PROGMEM =
"<p></p><form action='" WEB_HANDLE_HX711 "' method='get'><button>" D_CONFIGURE_HX711 "</button></form>"; "<p></p><form action='" WEB_HANDLE_HX711 "' method='get'><button>" D_CONFIGURE_HX711 "</button></form>";
const char HTTP_FORM_HX711[] PROGMEM = const char HTTP_FORM_HX711a[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_CALIBRATION "&nbsp;</b></legend>"
"<form method='post' action='" WEB_HANDLE_HX711 "'>" "<form method='post' action='" WEB_HANDLE_HX711 "'>"
"<p><b>" D_REFERENCE_WEIGHT "</b> (" D_UNIT_KILOGRAM ")<br><input type='number' step='0.001' id='p1' placeholder='0' value='%s'></p>" "<p><b>" D_REFERENCE_WEIGHT "</b> (" D_UNIT_KILOGRAM ")<br><input type='number' step='0.001' id='p1' placeholder='0' value='%s'></p>"
"<br><button name='calibrate' type='submit'>" D_CALIBRATE "</button>" "<br><button name='calibrate' type='submit'>" D_CALIBRATE "</button>"
"</form>" "</form>"
"</fieldset><br><br>" "</fieldset><br><br>";
const char HTTP_FORM_HX711b[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_HX711_PARAMETERS "&nbsp;</b></legend>"
"<form method='post' action='" WEB_HANDLE_HX711 "'>" "<form method='post' action='" WEB_HANDLE_HX711 "'>"
"<p><b>" D_ITEM_WEIGHT "</b> (" D_UNIT_KILOGRAM ")<br><input type='number' max='6.5535' step='0.0001' id='p2' placeholder='0.0' value='%s'></p>"; "<p><b>" D_ITEM_WEIGHT "</b> (" D_UNIT_KILOGRAM ")<br><input type='number' max='6.5535' step='0.0001' id='p2' placeholder='0.0' value='%s'></p>";
@ -670,10 +668,12 @@ void HandleHxAction(void) {
WSContentStart_P(PSTR(D_CONFIGURE_HX711)); WSContentStart_P(PSTR(D_CONFIGURE_HX711));
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_CALIBRATION));
dtostrfd((float)Settings->weight_reference / 1000, 3, stemp1); dtostrfd((float)Settings->weight_reference / 1000, 3, stemp1);
char stemp2[20]; WSContentSend_P(HTTP_FORM_HX711a, stemp1);
dtostrfd((float)Settings->weight_item / 10000, 4, stemp2); WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_HX711_PARAMETERS));
WSContentSend_P(HTTP_FORM_HX711, stemp1, stemp2); dtostrfd((float)Settings->weight_item / 10000, 4, stemp1);
WSContentSend_P(HTTP_FORM_HX711b, stemp1);
WSContentSend_P(HTTP_FORM_END); WSContentSend_P(HTTP_FORM_END);
WSContentSpaceButton(BUTTON_CONFIGURATION); WSContentSpaceButton(BUTTON_CONFIGURATION);
WSContentStop(); WSContentStop();