Changed Memory display on ESP32 to not include IRAM (i.e. less by 40-50KB)

This commit is contained in:
Stephan Hadinger 2021-10-07 18:37:58 +02:00
parent 0f3a6297c6
commit ee0678774b
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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;
}