Skip to content

feat: on-device menu core, Device Info, Factory Reset (PR 6/9) - #41

Merged
thePunderWoman merged 1 commit into
mainfrom
firmware-rewrite/pr6-menu-system-core
Sep 8, 2026
Merged

feat: on-device menu core, Device Info, Factory Reset (PR 6/9)#41
thePunderWoman merged 1 commit into
mainfrom
firmware-rewrite/pr6-menu-system-core

Conversation

@thePunderWoman

Copy link
Copy Markdown
Owner

Summary

PR 6 of the firmware rewrite (PR 1: #35, PR 2: #36, PR 3: #38, PR 4: #39, PR 5: #40). Adds the on-device menu system.

  • MenuController (include/menu.h / src/menu.cpp): pure state machine. Knows nothing about real buttons or the display. Held-combo detection (Left Up+Down for 1s) opens the menu from inactive; once open, onUp()/onDown() scroll, onEnter() confirms, onBack() cancels/exits.
  • renderMenuScreen(): pure function deciding what text goes on screen for the menu's current state — the existing OledDisplay/ScreenBuffer split from PR 3 does the actual drawing.
  • Menu tree covers what's genuinely local and already has everything it needs:
    • Calibrate Stick / Calibrate Trigger — wires up the guided-calibration flows built in PR 5 (previously unused), persisting results via CalibrationStore.
    • Device Info — placeholder for now; querying the XBee's SL needs PR 8's SPI transport, which doesn't exist yet.
    • Factory Reset — confirm-gated, currently clears calibration data; will extend to the droid list once DroidStore exists (PR 7).
    • Switch Droid/Manage Droids (PR 7) and Display Config (PR 9) aren't in the tree yet — they need subsystems that don't exist.
  • TextEntryWidget (include/text_entry.h / src/text_entry.cpp): the reusable one-character-at-a-time entry widget (full alphanumeric, or hex-only) PR 7's Manage Droids screen will need for name/PAN ID entry. Built now alongside the rest of the framework per the rewrite plan; not wired to anything yet.
  • SnipsController.ino: Left Up/Down + Stick Click + Bumper are "stolen" for nav only while the menu is open — harmless since the packet protocol (PR 8) doesn't exist yet for Amidala to see them any other way. Display only redraws on an actual state change, not every tick.

Test plan

  • pio test -e native — all 104 test cases pass
  • gcovr --exclude 'src/SnipsController\.ino' --exclude 'src/oled\.cpp' --exclude 'src/rgb_led\.cpp' --exclude 'src/calibration_store\.cpp' --fail-under-line 90 — 98.5% line coverage (remaining gaps are defensive branches unreachable through the public state machine)
  • pio run -e esp32s3 — builds successfully
  • Flash to real hardware once boards arrive: hold Left Up+Down for 1s to open the menu, scroll through all four items, run both calibration flows end to end, confirm Factory Reset clears calibration, confirm the display restores the boot screen when the menu closes

🤖 Generated with Claude Code

Adds the on-device menu system: hold Left Up+Down together for 1s to
open it, then Left Up/Down scroll, Stick Click confirms, Bumper backs
out. All pure logic — MenuController (menu.h/.cpp) knows nothing about
real buttons or the display; SnipsController.ino translates button
edges into its four nav calls, and renderMenuScreen() turns menu state
into a ScreenBuffer for the existing OledDisplay to draw.

Menu tree covers everything that's genuinely local and has everything
it needs already built:
- Calibrate Stick / Calibrate Trigger — wires up the guided-calibration
  flows built in PR 5 (previously unused), persisting results via
  CalibrationStore
- Device Info — placeholder pending PR 8's XBee SPI transport, which is
  what will actually let this query the module's SL
- Factory Reset — confirm-gated, currently clears calibration data;
  extends to the droid list once DroidStore exists (PR 7)

Switch Droid/Manage Droids (PR 7) and Display Config (PR 9) aren't part
of this menu tree yet — they need subsystems that don't exist.

Also adds TextEntryWidget (text_entry.h/.cpp), the reusable one-
character-at-a-time entry widget (full alphanumeric charset, or
hex-only) that PR 7's Manage Droids screen will need for name/PAN ID
entry — built now alongside the rest of the menu framework per the
rewrite plan, not yet wired to anything.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@thePunderWoman
thePunderWoman merged commit ddffb03 into main Sep 8, 2026
2 checks passed
@thePunderWoman
thePunderWoman deleted the firmware-rewrite/pr6-menu-system-core branch September 8, 2026 01: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