Skip to content

Commit 65511b2

Browse files
committed
Add separate method to get free PSRAM and report only internal in getFreeHeap
1 parent 14d6f6e commit 65511b2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Diff for: cores/esp32/Esp.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ void EspClass::restart(void)
114114

115115
uint32_t EspClass::getFreeHeap(void)
116116
{
117-
return esp_get_free_heap_size();
117+
return heap_caps_get_free_size(MALLOC_CAP_INTERNAL);
118+
}
119+
120+
uint32_t EspClass::getFreePsram(void)
121+
{
122+
return heap_caps_get_free_size(MALLOC_CAP_SPIRAM);
118123
}
119124

120125
uint8_t EspClass::getChipRevision(void)

Diff for: cores/esp32/Esp.h

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class EspClass
5757
~EspClass() {}
5858
void restart();
5959
uint32_t getFreeHeap();
60+
uint32_t getFreePsram();
6061
uint8_t getChipRevision();
6162
uint8_t getCpuFreqMHz(){ return CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ; }
6263
uint32_t getCycleCount();

0 commit comments

Comments
 (0)