- Abstract the memory stats into its own class.

- Fix a bug with debug mqtt
- nrf52 needs more love, there's a strange error while linking. Help appreciated
This commit is contained in:
Thomas Göttgens
2023-02-17 12:31:51 +01:00
parent e2f5e9206d
commit 4967a16abe
8 changed files with 91 additions and 25 deletions

46
src/memGet.cpp Normal file
View File

@@ -0,0 +1,46 @@
#include "memGet.h"
#include "configuration.h"
MemGet memGet;
uint32_t MemGet::getFreeHeap()
{
#ifdef ARCH_ESP32
return ESP.getFreeHeap();
#elif defined(ARCH_NRF52)
return dbgHeapFree();
#else
// this platform does not have heap management function implemented
return UINT32_MAX;
#endif
}
uint32_t MemGet::getHeapSize()
{
#ifdef ARCH_ESP32
return ESP.getHeapSize();
#elif defined(ARCH_NRF52)
return dbgHeapTotal();
#else
// this platform does not have heap management function implemented
return UINT32_MAX;
#endif
}
uint32_t MemGet::getFreePsram()
{
#ifdef ARCH_ESP32
return ESP.getFreePsram();
#else
return 0;
#endif
}
uint32_t MemGet::getPsramSize()
{
#ifdef ARCH_ESP32
return ESP.getPsramSize();
#else
return 0;
#endif
}