diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 4a9484a72..14e327046 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -477,7 +477,7 @@ void CmndStatus(void) } if ((0 == payload) || (4 == payload)) { - float freeMem = ((float)ESP_getFreeHeap()) / 1024; + float freeMem = ESP_getFreeHeap1024(); Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS4_MEMORY "\":{\"" D_JSON_PROGRAMSIZE "\":%d,\"" D_JSON_FREEMEMORY "\":%d,\"" D_JSON_HEAPSIZE "\":%1_f,\"" #ifdef ESP32 D_JSON_PSRMAXMEMORY "\":%d,\"" D_JSON_PSRFREEMEMORY "\":%d,\"" diff --git a/tasmota/support_esp32.ino b/tasmota/support_esp32.ino index a17dda4ef..c2206dd89 100644 --- a/tasmota/support_esp32.ino +++ b/tasmota/support_esp32.ino @@ -47,6 +47,10 @@ uint32_t ESP_getFreeHeap(void) { return ESP.getFreeHeap(); } +float ESP_getFreeHeap1024(void) { + return ((float)ESP_getFreeHeap()) / 1024; +} + void ESP_Restart(void) { // ESP.restart(); // This results in exception 3 on restarts on core 2.3.0 ESP.reset(); @@ -411,6 +415,10 @@ uint32_t ESP_getFreeHeap(void) { return ESP.getFreeHeap(); } +float ESP_getFreeHeap1024(void) { + return ((float)ESP_getFreeHeap()) / 1024; +} + uint32_t ESP_getMaxAllocHeap(void) { // largest block of heap that can be allocated at once uint32_t free_block_size = ESP.getMaxAllocHeap(); diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index 18217fcbd..5826e2327 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -658,7 +658,7 @@ void MqttShowPWMState(void) void MqttShowState(void) { char stemp1[TOPSZ]; - float freeMem = ((float)ESP_getFreeHeap()) / 1024; + float freeMem = ESP_getFreeHeap1024(); ResponseAppendTime(); ResponseAppend_P(PSTR(",\"" D_JSON_UPTIME "\":\"%s\",\"UptimeSec\":%u"), GetUptime().c_str(), UpTime()); diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 047d97984..12ee2d6cd 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -2063,7 +2063,7 @@ void HandleInformation(void) char stopic[TOPSZ]; - float freeMem = ((float)ESP_getFreeHeap()) / 1024; + float freeMem = ESP_getFreeHeap1024(); WSContentStart_P(PSTR(D_INFORMATION)); // Save 1k of code space replacing table html with javascript replace codes