better heap info

This commit is contained in:
Alex Mikhalev 2018-12-30 23:56:51 -07:00
parent d3eccdbcb1
commit 792b49512f

View File

@ -160,11 +160,13 @@ void loop(void) {
do {
u8g2_DrawRFrame(&u8g2, 0, 0, OLED_W, OLED_H, 4);
uint32_t free_heap = xPortGetFreeHeapSize();
multi_heap_info_t heap_info;
heap_caps_get_info(&heap_info, MALLOC_CAP_DEFAULT);
u8g2_SetFont(&u8g2, u8g2_font_4x6_mf);
u8g2_DrawStr(&u8g2, 4, 8, "Hello World!");
char buf[40];
snprintf(buf, 40, "free heap: %d", free_heap);
char buf[32];
memset(buf, 0, 32);
snprintf(buf, 32, "heap allc/free %d/%d", heap_info.total_allocated_bytes, heap_info.total_free_bytes);
u8g2_DrawStr(&u8g2, 4, 8 + 8, buf);
if (packet.buffer_len) {