@@ -112,9 +112,53 @@ void EspClass::restart(void)
112
112
esp_restart ();
113
113
}
114
114
115
+ // uint32_t EspClass::getFreeHeap(void)
116
+ // {
117
+ // return esp_get_free_heap_size();
118
+ // }
119
+
120
+ uint32_t EspClass::getHeapSize (void )
121
+ {
122
+ multi_heap_info_t info;
123
+ heap_caps_get_info (&info, MALLOC_CAP_INTERNAL);
124
+ return info.total_free_bytes + info.total_allocated_bytes ;
125
+ }
126
+
115
127
uint32_t EspClass::getFreeHeap (void )
116
128
{
117
- return esp_get_free_heap_size ();
129
+ return heap_caps_get_free_size (MALLOC_CAP_INTERNAL);
130
+ }
131
+
132
+ uint32_t EspClass::getMinFreeHeap (void )
133
+ {
134
+ return heap_caps_get_minimum_free_size (MALLOC_CAP_INTERNAL);
135
+ }
136
+
137
+ uint32_t EspClass::getMaxAllocHeap (void )
138
+ {
139
+ return heap_caps_get_largest_free_block (MALLOC_CAP_INTERNAL);
140
+ }
141
+
142
+ uint32_t EspClass::getPsramSize (void )
143
+ {
144
+ multi_heap_info_t info;
145
+ heap_caps_get_info (&info, MALLOC_CAP_SPIRAM);
146
+ return info.total_free_bytes + info.total_allocated_bytes ;
147
+ }
148
+
149
+ uint32_t EspClass::getFreePsram (void )
150
+ {
151
+ return heap_caps_get_free_size (MALLOC_CAP_SPIRAM);
152
+ }
153
+
154
+ uint32_t EspClass::getMinFreePsram (void )
155
+ {
156
+ return heap_caps_get_minimum_free_size (MALLOC_CAP_SPIRAM);
157
+ }
158
+
159
+ uint32_t EspClass::getMaxAllocPsram (void )
160
+ {
161
+ return heap_caps_get_largest_free_block (MALLOC_CAP_SPIRAM);
118
162
}
119
163
120
164
uint8_t EspClass::getChipRevision (void )
0 commit comments