Slicing GUI information

This commit is contained in:
Theo Arends 2024-01-17 18:17:46 +01:00
parent 9d86ac8816
commit f28c9b6ea9

View File

@ -2373,8 +2373,24 @@ void HandleRestoreConfiguration(void)
#ifndef FIRMWARE_MINIMAL_ONLY #ifndef FIRMWARE_MINIMAL_ONLY
void HandleInformation(void) 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);
// 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);
}
void WSContentSeparatorIFat(void) {
// WSContentSend_P(PSTR("}1}2&nbsp;")); // Empty line = </td></tr><tr><th></th><td>&nbsp;
WSContentSeparatorI(2);
}
void WSContentSeparatorIThin(void) {
// WSContentSend_P(PSTR("}1<hr/>}2<hr/>")); // </td></tr><tr><th><hr/></th><td><hr/>
WSContentSeparatorI(1);
}
void HandleInformation(void) {
if (!HttpCheckPriviledgedAccess()) { return; } if (!HttpCheckPriviledgedAccess()) { return; }
float freemem = ((float)ESP_getFreeHeap()) / 1024; float freemem = ((float)ESP_getFreeHeap()) / 1024;
@ -2407,13 +2423,13 @@ void HandleInformation(void)
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());
} }
WSContentSend_P(PSTR("}1}2&nbsp;")); // Empty line WSContentSeparatorIFat();
bool show_hr = false; bool show_hr = false;
if ((WiFi.getMode() >= WIFI_AP) && (static_cast<uint32_t>(WiFi.softAPIP()) != 0)) { if ((WiFi.getMode() >= WIFI_AP) && (static_cast<uint32_t>(WiFi.softAPIP()) != 0)) {
WSContentSend_P(PSTR("}1" D_MAC_ADDRESS "}2%s"), WiFi.softAPmacAddress().c_str()); WSContentSend_P(PSTR("}1" D_MAC_ADDRESS "}2%s"), WiFi.softAPmacAddress().c_str());
WSContentSend_P(PSTR("}1" D_IP_ADDRESS " (AP)}2%_I"), (uint32_t)WiFi.softAPIP()); WSContentSend_P(PSTR("}1" D_IP_ADDRESS " (AP)}2%_I"), (uint32_t)WiFi.softAPIP());
WSContentSend_P(PSTR("}1" D_GATEWAY "}2%_I"), (uint32_t)WiFi.softAPIP()); WSContentSend_P(PSTR("}1" D_GATEWAY "}2%_I"), (uint32_t)WiFi.softAPIP());
WSContentSend_P(PSTR("}1<hr/>}2<hr/>")); WSContentSeparatorIThin();
} }
if (Settings->flag4.network_wifi) { if (Settings->flag4.network_wifi) {
int32_t rssi = WiFi.RSSI(); int32_t rssi = WiFi.RSSI();
@ -2424,7 +2440,7 @@ void HandleInformation(void)
pgm_read_byte(&kWifiPhyMode[WiFi.getPhyMode() & 0x3]), pgm_read_byte(&kWifiPhyMode[WiFi.getPhyMode() & 0x3]),
WiFi.channel(), WiFi.channel(),
WiFi.BSSIDstr().c_str()); WiFi.BSSIDstr().c_str());
WSContentSend_P(PSTR("}1}2&nbsp;")); // Empty line 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();
@ -2456,7 +2472,7 @@ void HandleInformation(void)
#if defined(ESP32) && CONFIG_IDF_TARGET_ESP32 && defined(USE_ETHERNET) #if defined(ESP32) && CONFIG_IDF_TARGET_ESP32 && defined(USE_ETHERNET)
if (EthernetHasIP()) { if (EthernetHasIP()) {
if (show_hr) { if (show_hr) {
WSContentSend_P(PSTR("}1<hr/>}2<hr/>")); 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
@ -2484,9 +2500,9 @@ void HandleInformation(void)
#endif // USE_IPV6 #endif // USE_IPV6
} }
#endif // USE_ETHERNET #endif // USE_ETHERNET
WSContentSend_P(PSTR("}1}2&nbsp;")); // Empty line 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
WSContentSend_P(PSTR("}1}2&nbsp;")); // Empty line 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);
@ -2511,11 +2527,12 @@ void HandleInformation(void)
} }
#if defined(USE_EMULATION) || defined(USE_DISCOVERY) #if defined(USE_EMULATION) || defined(USE_DISCOVERY)
WSContentSend_P(PSTR("}1}2&nbsp;")); // Empty line 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
@ -2527,7 +2544,7 @@ void HandleInformation(void)
} }
#endif // USE_DISCOVERY #endif // USE_DISCOVERY
WSContentSend_P(PSTR("}1}2&nbsp;")); // Empty line 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
@ -2550,7 +2567,7 @@ void HandleInformation(void)
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);
WSContentSend_P(PSTR("}1" D_PSR_FREE_MEMORY "}2%d KB"), ESP.getFreePsram() / 1024); WSContentSend_P(PSTR("}1" D_PSR_FREE_MEMORY "}2%d KB"), ESP.getFreePsram() / 1024);
} }
WSContentSend_P(PSTR("}1}2&nbsp;")); // Empty line WSContentSeparatorIFat();
uint32_t cur_part = ESP_PARTITION_SUBTYPE_APP_FACTORY; // 0 uint32_t cur_part = ESP_PARTITION_SUBTYPE_APP_FACTORY; // 0
const esp_partition_t *running_ota = esp_ota_get_running_partition(); const esp_partition_t *running_ota = esp_ota_get_running_partition();
if (running_ota) { cur_part = running_ota->subtype; } // 16 - 32 if (running_ota) { cur_part = running_ota->subtype; } // 16 - 32
@ -2590,7 +2607,7 @@ void HandleInformation(void)
#else // not ESP32 #else // not ESP32
WSContentSend_PD(PSTR("}1" D_FREE_MEMORY "}2%1_f KB"), &freemem); WSContentSend_PD(PSTR("}1" D_FREE_MEMORY "}2%1_f KB"), &freemem);
#ifdef USE_UFILESYS #ifdef USE_UFILESYS
WSContentSend_P(PSTR("}1}2&nbsp;")); // Empty line WSContentSeparatorIFat();
WSContentSend_P(PSTR("}1" D_FILE_SYSTEM_SIZE "}2%d KB"), UfsSize()); WSContentSend_P(PSTR("}1" D_FILE_SYSTEM_SIZE "}2%d KB"), UfsSize());
#endif // USE_UFILESYS #endif // USE_UFILESYS
#endif // ESP32 #endif // ESP32
@ -2599,7 +2616,7 @@ 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(PSTR("<fieldset><legend><b>&nbsp;Information&nbsp;</b></legend>"));
WSContentSend_P(PSTR("<style>td{padding:0px 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);