TasksModule¶
Lists active FreeRTOS tasks on ESP32, or reports empty on PC. Introduced in Release 4, Sprint 7.
What it does¶
TasksModule calls pal::task_list() in loop1s() (called by the Scheduler at ~1 Hz) to refresh a snapshot of all running FreeRTOS tasks. Each task entry shows name, core affinity, priority, and stack high-water mark (in words). On PC no FreeRTOS scheduler is present so the display is empty.
No state is persisted.
Controls¶
| Key | Type | Description | PC |
|---|---|---|---|
tasks |
display |
Multi-line task table; one entry per FreeRTOS task | empty |
task_count |
display |
Number of tasks currently in the table | 0 |
healthReport format¶
task_count=<n>
Platform notes¶
ESP32: uses uxTaskGetSystemState() with a 32-slot TaskStatus_t array allocated on the heap for the duration of the call and freed immediately. Queries up to 32 tasks per sample. xCoreID is an ESP32 FreeRTOS extension; values are 0, 1, or - (no affinity).
PC: task_list() is a no-op; the display remains empty and task_count stays 0.
Footprint¶
| Field | Size |
|---|---|
classSize() |
~1064 B (1024 B task list buffer + 4 B float + 36 B vtable/overhead) |
| Heap | 32 × sizeof(TaskStatus_t) (~2 KB) allocated and freed during each loop1s() call on ESP32; zero on PC |
Test coverage¶
Unit tests in tests/test_system_utils.cpp:
| Test | Level | What is verified |
|---|---|---|
| Lifecycle does not crash | smoke |
setup/loop/loop1s/teardown without crash |
| healthReport format contains task_count= | format |
healthReport string has expected key |
| getSchema exposes tasks and task_count | format |
schema contains both display controls |
| task_count is non-negative after setup | behavioral |
count is 0 on PC; non-negative on any platform |