aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/screens/SystemInfo.cpp
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2023-03-26 14:53:34 +0200
committerJF <JF002@users.noreply.github.com>2023-05-18 19:58:09 +0200
commit611e0ff7684818949f7f18546b540ff55de9b8ce (patch)
tree250ed0efe624fdc7992b27d6ab40ed5092d6bc87 /src/displayapp/screens/SystemInfo.cpp
parent1911e2d9285cb5b0a6ecd3bf3de864783f2b0e3e (diff)
Enable malloc error and stack overflow error detection in FreeRTOS. Count them and display them in the SystemInfo app.
Diffstat (limited to 'src/displayapp/screens/SystemInfo.cpp')
-rw-r--r--src/displayapp/screens/SystemInfo.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp
index d6fa7365..dd15221b 100644
--- a/src/displayapp/screens/SystemInfo.cpp
+++ b/src/displayapp/screens/SystemInfo.cpp
@@ -177,6 +177,8 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
return std::make_unique<Screens::Label>(1, 5, label);
}
+extern int mallocFailedCount;
+extern int stackOverflowCount;
std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
lv_mem_monitor_t mon;
lv_mem_monitor(&mon);
@@ -188,22 +190,23 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
"#808080 BLE MAC#\n"
" %02x:%02x:%02x:%02x:%02x:%02x"
"\n"
- "#808080 LVGL Memory#\n"
- " #808080 used# %d (%d%%)\n"
- " #808080 max used# %lu\n"
- " #808080 frag# %d%%\n"
- " #808080 free# %d",
+ "\n"
+ "#808080 Memory heap#\n"
+ " #808080 Free# %d\n"
+ " #808080 Min free# %d\n"
+ " #808080 Alloc err# %d\n"
+ " #808080 Ovrfl err# %d\n",
bleAddr[5],
bleAddr[4],
bleAddr[3],
bleAddr[2],
bleAddr[1],
bleAddr[0],
- static_cast<int>(mon.total_size - mon.free_size),
- mon.used_pct,
- mon.max_used,
- mon.frag_pct,
- static_cast<int>(mon.free_biggest_size));
+ xPortGetFreeHeapSize(),
+ xPortGetMinimumEverFreeHeapSize(),
+ mallocFailedCount,
+ stackOverflowCount
+ );
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
return std::make_unique<Screens::Label>(2, 5, label);
}