Merge pull request #13294 from s-hadinger/fix_ram_display

Changed Memory display on ESP32 to not include IRAM (i.e. less by 40-50KB)
This commit is contained in:
Theo Arends 2021-10-08 10:52:23 +02:00 committed by GitHub
commit 0d435d2ccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
}