From ee0678774b5b79be1bccc2161a23b589b4b463b7 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Thu, 7 Oct 2021 18:37:58 +0200 Subject: [PATCH] Changed Memory display on ESP32 to not include IRAM (i.e. less by 40-50KB) --- CHANGELOG.md | 1 + tasmota/support_esp.ino | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8b56d978..9876321df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. ### Breaking Changed - ESP32 LVGL updated to v8.0.2 +- Changed Memory display on ESP32 to not include IRAM (i.e. less by 40-50KB) ### Changed - Removed command ``EnergyReset`` as it is replaced by new commands diff --git a/tasmota/support_esp.ino b/tasmota/support_esp.ino index 6f94bf3f7..90bfe93f1 100644 --- a/tasmota/support_esp.ino +++ b/tasmota/support_esp.ino @@ -387,12 +387,13 @@ uint32_t ESP_getSketchSize(void) { } uint32_t ESP_getFreeHeap(void) { - return ESP.getFreeHeap(); + // ESP_getFreeHeap() returns also IRAM which we don't use + return heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); } uint32_t ESP_getMaxAllocHeap(void) { - // largest block of heap that can be allocated at once - uint32_t free_block_size = ESP.getMaxAllocHeap(); + // arduino returns IRAM but we want only DRAM + uint32_t free_block_size = heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); if (free_block_size > 100) { free_block_size -= 100; } return free_block_size; }