From 091e8566eb2cf38a8ff3ba674f05b78994d33bd7 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Mon, 15 Feb 2021 12:24:23 +0100 Subject: [PATCH] Showing more precise memory heap in web page only --- tasmota/xdrv_01_webserver.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 38116bcdb..419002ddd 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -2062,6 +2062,7 @@ void HandleInformation(void) { if (!HttpCheckPriviledgedAccess()) { return; } + float freemem = ((float)ESP_getFreeHeap()) / 1024; AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_INFORMATION)); char stopic[TOPSZ]; @@ -2181,13 +2182,13 @@ void HandleInformation(void) WSContentSend_P(PSTR("}1" D_FREE_PROGRAM_SPACE "}2%d kB"), ESP.getFreeSketchSpace() / 1024); #ifdef ESP32 int32_t freeMaxMem = 100 - (int32_t)(ESP_getMaxAllocHeap() * 100 / ESP_getFreeHeap()); - WSContentSend_P(PSTR("}1" D_FREE_MEMORY "}2%d kB (" D_FRAGMENTATION " %d%%)"), ESP_getFreeHeap1024(), freeMaxMem); + WSContentSend_P(PSTR("}1" D_FREE_MEMORY "}2%1_f kB (" D_FRAGMENTATION " %d%%)"), &freemem, freeMaxMem); if (psramFound()) { 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); } #else // ESP32 - WSContentSend_P(PSTR("}1" D_FREE_MEMORY "}2%d kB"), ESP_getFreeHeap1024()); + WSContentSend_P(PSTR("}1" D_FREE_MEMORY "}2%1_f kB"), &freemem); #endif // ESP32 WSContentSend_P(PSTR(""));