From f28c9b6ea9ace995f036dc376f718be80457d204 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 17 Jan 2024 18:17:46 +0100 Subject: [PATCH] Slicing GUI information --- .../xdrv_01_9_webserver.ino | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index a82104452..4bb006d75 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -2373,8 +2373,24 @@ void HandleRestoreConfiguration(void) #ifndef FIRMWARE_MINIMAL_ONLY -void HandleInformation(void) -{ +void WSContentSeparatorI(uint32_t size) { + WSContentSend_P(PSTR("
"), (1 == size)?" size=1":""); +// WSContentSend_P(PSTR("
"), size); +// WSContentSend_P(PSTR("
"), size); +// WSContentSend_P(PSTR(""), size); +} + +void WSContentSeparatorIFat(void) { +// WSContentSend_P(PSTR("}1}2 ")); // Empty line =   + WSContentSeparatorI(2); +} + +void WSContentSeparatorIThin(void) { +// WSContentSend_P(PSTR("}1
}2
")); //

+ WSContentSeparatorI(1); +} + +void HandleInformation(void) { if (!HttpCheckPriviledgedAccess()) { return; } float freemem = ((float)ESP_getFreeHeap()) / 1024; @@ -2407,13 +2423,13 @@ void HandleInformation(void) 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}2 ")); // Empty line + WSContentSeparatorIFat(); bool show_hr = false; if ((WiFi.getMode() >= WIFI_AP) && (static_cast(WiFi.softAPIP()) != 0)) { 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_GATEWAY "}2%_I"), (uint32_t)WiFi.softAPIP()); - WSContentSend_P(PSTR("}1
}2
")); + WSContentSeparatorIThin(); } if (Settings->flag4.network_wifi) { int32_t rssi = WiFi.RSSI(); @@ -2424,7 +2440,7 @@ void HandleInformation(void) pgm_read_byte(&kWifiPhyMode[WiFi.getPhyMode() & 0x3]), WiFi.channel(), WiFi.BSSIDstr().c_str()); - WSContentSend_P(PSTR("}1}2 ")); // Empty line + WSContentSeparatorIFat(); WSContentSend_P(PSTR("}1" D_HOSTNAME "}2%s%s"), TasmotaGlobal.hostname, (Mdns.begun) ? PSTR(".local") : ""); #ifdef USE_IPV6 String ipv6_addr = WifiGetIPv6Str(); @@ -2456,7 +2472,7 @@ void HandleInformation(void) #if defined(ESP32) && CONFIG_IDF_TARGET_ESP32 && defined(USE_ETHERNET) if (EthernetHasIP()) { if (show_hr) { - WSContentSend_P(PSTR("}1
}2
")); + WSContentSeparatorIThin(); } WSContentSend_P(PSTR("}1" D_HOSTNAME "}2%s%s"), EthernetHostname(), (Mdns.begun) ? PSTR(".local") : ""); #ifdef USE_IPV6 @@ -2484,9 +2500,9 @@ void HandleInformation(void) #endif // USE_IPV6 } #endif // USE_ETHERNET - WSContentSend_P(PSTR("}1}2 ")); // 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}2 ")); // Empty line + WSContentSeparatorIFat(); 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_PORT "}2%d"), Settings->mqtt_port); @@ -2511,11 +2527,12 @@ void HandleInformation(void) } #if defined(USE_EMULATION) || defined(USE_DISCOVERY) - WSContentSend_P(PSTR("}1}2 ")); // Empty line + WSContentSeparatorIFat(); #endif // USE_EMULATION or USE_DISCOVERY #ifdef USE_EMULATION WSContentSend_P(PSTR("}1" D_EMULATION "}2%s"), GetTextIndexed(stopic, sizeof(stopic), Settings->flag2.emulation, kEmulationOptions)); #endif // USE_EMULATION + #ifdef USE_DISCOVERY 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 @@ -2527,7 +2544,7 @@ void HandleInformation(void) } #endif // USE_DISCOVERY - WSContentSend_P(PSTR("}1}2 ")); // Empty line + WSContentSeparatorIFat(); 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()); #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_FREE_MEMORY "}2%d KB"), ESP.getFreePsram() / 1024); } - WSContentSend_P(PSTR("}1}2 ")); // Empty line + WSContentSeparatorIFat(); uint32_t cur_part = ESP_PARTITION_SUBTYPE_APP_FACTORY; // 0 const esp_partition_t *running_ota = esp_ota_get_running_partition(); if (running_ota) { cur_part = running_ota->subtype; } // 16 - 32 @@ -2590,7 +2607,7 @@ void HandleInformation(void) #else // not ESP32 WSContentSend_PD(PSTR("}1" D_FREE_MEMORY "}2%1_f KB"), &freemem); #ifdef USE_UFILESYS - WSContentSend_P(PSTR("}1}2 ")); // Empty line + WSContentSeparatorIFat(); WSContentSend_P(PSTR("}1" D_FILE_SYSTEM_SIZE "}2%d KB"), UfsSize()); #endif // USE_UFILESYS #endif // ESP32 @@ -2599,7 +2616,7 @@ void HandleInformation(void) WSContentSend_P(HTTP_SCRIPT_INFO_END); WSContentSendStyle(); // WSContentSend_P(PSTR("
 Information ")); - WSContentSend_P(PSTR("" + WSContentSend_P(PSTR("" "
")); // WSContentSend_P(PSTR("
")); WSContentSpaceButton(BUTTON_MAIN);