Sometimes heap_caps_get_largest_free_block() crashes

This commit is contained in:
CommanderRedYT
2023-02-22 01:56:33 +01:00
parent acae32a704
commit 0803e2339c
2 changed files with 14 additions and 0 deletions

7
Kconfig.projbuild Normal file
View File

@ -0,0 +1,7 @@
menu "ESPAsyncOTA"
config ESPASYNCOTA_DISABLE_HEAP_CAPS_LOG
bool "Disable heap_caps_get_largest_free_block() log"
default n
endmenu

View File

@ -226,11 +226,18 @@ void EspAsyncOta::update()
if (bits & REQUEST_VERIFYING_BIT)
ESP_LOGI(TAG, "OTA Verifying");
else if (m_totalSize)
#ifdef ESPASYNCOTA_DISABLE_HEAP_CAPS_LOG
ESP_LOGI(TAG, "OTA Progress %i of %i (%.2f%%) heap8=disabled",
m_progress,
*m_totalSize,
100.f*m_progress / *m_totalSize);
#else
ESP_LOGI(TAG, "OTA Progress %i of %i (%.2f%%) heap8=%zd",
m_progress,
*m_totalSize,
100.f*m_progress / *m_totalSize,
heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT));
#endif
else
ESP_LOGI(TAG, "OTA Progress %i of unknown", m_progress);
}