systematically fetch heap mem settings, before allocating buffers so console and web show same results

This commit is contained in:
Proddy
2023-01-11 23:34:27 +01:00
parent 97451d2b7a
commit 3dc2ab54ac
4 changed files with 43 additions and 12 deletions

View File

@@ -230,6 +230,20 @@ class System {
return appused_;
}
// memory in kb
static uint32_t getMaxAllocMem() {
return max_alloc_mem_;
}
static uint32_t getHeapMem() {
return heap_mem_;
}
static void refreshHeapMem() {
#ifndef EMSESP_STANDALONE
max_alloc_mem_ = ESP.getMaxAllocHeap() / 1024;
heap_mem_ = ESP.getFreeHeap() / 1024;
#endif
}
static bool test_set_all_active() {
return test_set_all_active_;
}
@@ -241,6 +255,8 @@ class System {
static uuid::log::Logger logger_;
static bool restart_requested_;
static bool test_set_all_active_; // force all entities in a device to have a value
static uint32_t max_alloc_mem_;
static uint32_t heap_mem_;
// button
static PButton myPButton_; // PButton instance