Skip to content

fix(cli): report all config packets in info via a table-driven renderer - #150

Merged
g4bri3lDev merged 2 commits into
mainfrom
fix/info-table-driven-config-report
Jul 30, 2026
Merged

fix(cli): report all config packets in info via a table-driven renderer#150
g4bri3lDev merged 2 commits into
mainfrom
fix/info-table-driven-config-report

Conversation

@g4bri3lDev

Copy link
Copy Markdown
Member

Problem

info enumerated config fields by hand, so packets added to GlobalConfig since the command was written were never reported. It covered 9 of the 15 packet types in the canonical schema, and printed several values as raw ids.

Never reported — four of them populated on hardware I have here:

Packet Packet
0x24 data_bus ✅ live 0x2a nfc_config ✅ live
0x28 touch_controller ✅ live 0x2b flash_config ✅ live
0x29 passive_buzzer ✅ live 0x2c data_extended ✅ live

Field-level gaps: PIPE_WRITE (transmission_modes bit 0x10) was missing from the mode list, so a device advertising sliding-window support looked like it lacked it; partial_update_support and display_technology were never shown; resolution printed width only (1872px).

Approach

Replaced the three hand-written layers with a declarative spec (_INFO_SECTIONS / _INFO_LIST_SECTIONS) that both the tree and --json walk, so a new packet needs a spec entry rather than a new branch in each renderer.

Opaque values now resolve to names: PANEL_IC_NAMES (112 panel ids) and DisplayTechnology are generated from the same config.yaml the Config Builder renders from, so both tools describe a panel identically. Unknown ids still fall back to raw hex (tested). Also wired up BinaryInputType, which existed but was unused.

Before / after on a reTerminal E1003:

  Panel         0x0bb8                    Panel         E Ink ED103TC2 + IT8951 (10.3", 1872x1404, 1bpp) (0x0bb8)
  Resolution    1872px             ->     Resolution    1872x1404px
  Transmission  STREAMING DIRECT_WRITE    Transmission  STREAMING DIRECT_WRITE PIPE_WRITE
  Button 0  type 0x01                     Button 0      DIGITAL
  (no touch/buzzer/bus/identity)          Touch 0       GT911  (i2c 0x14, bus 0)
                                          Buzzer 0      pin 45, 50% duty
                                          Identity      reTerminal E1003

Compatibility

--json is additive only: existing keys keep their names and valuessleep_timeout_s stays seconds (not the raw ms), deep_sleep_* stay numeric-or-null. Pinned by tests, since the restructure broke all three of those before they were caught.

Testing

Adds tests/unit/test_cli_info_report.py — 29 tests, and the first test coverage for the CLI, which had none. Full suite 892 passing; prek run --all-files clean.

Verified against five devices — three MCU families, five panels, three colour schemes:

Device MCU Panel (id → name) Path exercised
reTerminal E1003 ESP32-S3 ED103TC2 (0x0bb8) touch, buzzer, bus, identity, PIPE_WRITE
Spectra frame nRF52840 Spectra 6/7 (0x0023) BWGBRY, security section
Solum M3 2.6" EFR32BG22 GDEY0266F51 (0x001c) NFC + flash
Solum M3 3.5" EFR32BG22 GDEM035F51 (0x0036) NFC + flash, no-buttons omission
EN05 nRF52840 Waveshare 4.26" (0x0027) FULL_FRAME partial, USB power, identity ×4

Every panel id resolved to a real name, and packets absent from a device stayed absent from its report.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.66355% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/opendisplay/cli.py 97.59% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

`info` enumerated fields by hand, so every packet added to GlobalConfig
since the command was written went unreported. It covered 9 of the 15
packet types in the canonical schema (Web toolbox config.yaml, minor 4),
and rendered several values as raw ids that mean nothing to a reader.

Never reported until now:

  0x24 data_bus         0x28 touch_controller   0x29 passive_buzzer
  0x2a nfc_config       0x2b flash_config       0x2c data_extended

Field-level gaps: PIPE_WRITE (transmission_modes bit 0x10) was missing
from the mode list, so a device advertising sliding-window support looked
like it lacked it; partial_update_support and display_technology were
never shown; resolution printed width only.

Replace the three hand-written layers with a declarative spec
(_INFO_SECTIONS / _INFO_LIST_SECTIONS) that both the tree and the --json
output walk, so new packets surface without a new branch per field.

Make opaque values readable: add PANEL_IC_NAMES (112 panel ids) and
DisplayTechnology to models/enums.py, generated from the same config.yaml
the Config Builder renders from, so both tools describe a panel
identically. Unknown panel ids still fall back to the raw hex. Wire up
BinaryInputType (present but unused) and spell out the partial-update
modes.

JSON output stays backward compatible: existing keys keep their names and
values (sleep_timeout_s stays seconds, deep_sleep_* stay numeric-or-null);
new keys are additive.

Adds tests/unit/test_cli_info_report.py -- the first test coverage for the
CLI, which had none.

Verified against five devices spanning three MCU families, five panels and
three colour schemes: reTerminal E1003 (ESP32-S3; touch, buzzer, bus,
identity, PIPE_WRITE), Spectra picture frame (nRF52840, BWGBRY), 2.6" and
3.5" Solum M3 (EFR32BG22; NFC + flash) and EN05 (USB-powered, FULL_FRAME
partial support).
The info-report tests exercised no config with LEDs, sensors or WiFi, so
_led_name, _sensor_name, _wifi_encryption, _wifi_server and the deep-sleep
tree label went unrun (codecov flagged 21 uncovered lines on the patch).

Adds cases for those paths plus the unknown-value fallbacks for LED type,
WiFi encryption and partial-update support, which are what keep an
unrecognised id rendering as hex instead of crashing.

Patch coverage 90% -> 99%; the two remaining lines are defensive guards
made unreachable by the section availability gates.
@g4bri3lDev
g4bri3lDev force-pushed the fix/info-table-driven-config-report branch from 5b3adad to 9ca7b05 Compare July 30, 2026 17:46
@g4bri3lDev
g4bri3lDev merged commit 3d723a2 into main Jul 30, 2026
4 checks passed
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