Browse Source

better heap info

ugv_io
Alex Mikhalev 6 years ago
parent
commit
792b49512f
  1. 8
      main/ugv_main.c

8
main/ugv_main.c

@ -160,11 +160,13 @@ void loop(void) {
do { do {
u8g2_DrawRFrame(&u8g2, 0, 0, OLED_W, OLED_H, 4); 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_SetFont(&u8g2, u8g2_font_4x6_mf);
u8g2_DrawStr(&u8g2, 4, 8, "Hello World!"); u8g2_DrawStr(&u8g2, 4, 8, "Hello World!");
char buf[40]; char buf[32];
snprintf(buf, 40, "free heap: %d", free_heap); 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); u8g2_DrawStr(&u8g2, 4, 8 + 8, buf);
if (packet.buffer_len) { if (packet.buffer_len) {

Loading…
Cancel
Save