Skip to content

Add live sensor summary display with data-driven updates - #10

Merged
elkanamol merged 11 commits into
masterfrom
feature/tg-4.2-display-live-summary
Feb 21, 2026
Merged

Add live sensor summary display with data-driven updates#10
elkanamol merged 11 commits into
masterfrom
feature/tg-4.2-display-live-summary

Conversation

@elkanamol

Copy link
Copy Markdown
Owner

Implement a multi-line display function for sensor data, enhancing the display formatting and handling data updates efficiently. Introduce unit tests to ensure functionality and reliability, while cleaning up debug output for better console readability. Complete the task for TG 4.2, confirming all tests pass successfully.

- Formatting module: 4-line layout (headline, T/RH, accel, gyro) with 14-char per-line bounds
- Multi-line write API in display_minimal HAL with bounds validation
- Display thread dual Zbus subscriptions (env_data_chan, imu_data_chan) with ACTIVE-only gating
- 10 new unit tests (format, multi-line API, thread integration); all 143/143 passing
- Eliminated -Wformat-truncation warnings via intermediate buffer pattern

Build: 133 KB flash, 34 KB RAM, zero warnings
Task: TG 4.2 - Display Live Sensor Summary
Dependencies: TG 1.0 ✅, TG 3.0 ✅, TG 2.0 ✅, TG 2.1 ✅
Bug: Display thread was blocking indefinitely on display_cmd_sub with K_FOREVER,
never checking display_data_sub for incoming sensor data messages. Manual commands
worked, but automatic data-driven display updates never triggered because the
event loop was stuck waiting for commands.

Root cause: First wait call on display_cmd_sub blocks the entire loop; sensor
data arriving on env_data_chan/imu_data_chan doesn't wake display_cmd_sub,
so data handler code after the first wait never executes.

Fix: Restructure event loop to:
1. Check data messages first (non-blocking K_NO_WAIT)
2. Wait for command messages with timeout (K_MSEC(250)) instead of K_FOREVER
3. This ensures data is polled regularly while remaining responsive to commands

Result: Display now updates automatically when sensors send data in ACTIVE state.
Manual commands still work. Polling interval ~250ms matches 1Hz sensor rate.

All tests pass: 143/143, zero warnings
Build: 133 KB flash, 34 KB RAM
Issue: Console output flooded with verbose debug messages from display functions
(init, on/off, write_lines) every ~250ms during data-driven updates.

Fix: Removed all generic debug/info printk statements:
- display_minimal_init(): Keep only errors, remove init progress messages
- display_minimal_on(): Keep only errors, remove status messages
- display_minimal_off(): Keep only errors, remove status messages
- display_minimal_write_line(): Keep only errors, remove progress messages
- display_minimal_write_lines(): Keep only errors, remove per-line debug output

Retained ERROR and WARNING messages for actual failures.

Result: Clean console output, display continues working correctly.

Code reduction: 132 KB flash (was 133 KB)
Tests: 143/143 passing
Build: Zero warnings
…y and display_thread_handle_data_update functions
@elkanamol
elkanamol marked this pull request as ready for review February 21, 2026 23:14
@elkanamol
elkanamol merged commit cc1bcc7 into master Feb 21, 2026
2 checks passed
@elkanamol
elkanamol deleted the feature/tg-4.2-display-live-summary branch February 21, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant