Skip to content

feat: droid management (switch/manage droids) (PR 7/9) - #42

Merged
thePunderWoman merged 1 commit into
mainfrom
firmware-rewrite/pr7-droid-management
Sep 8, 2026
Merged

feat: droid management (switch/manage droids) (PR 7/9)#42
thePunderWoman merged 1 commit into
mainfrom
firmware-rewrite/pr7-droid-management

Conversation

@thePunderWoman

Copy link
Copy Markdown
Owner

Summary

PR 7 of the firmware rewrite (PR 1: #35, PR 2: #36, PR 3: #38, PR 4: #39, PR 5: #40, PR 6: #41). Adds Switch Droid and Manage Droids — the two menu items deferred out of PR 6 pending this subsystem, which completes the menu tree (only Display Config, PR 9, remains outside it).

  • DroidStore (include/droid_store.h / src/droid_store.cpp): pure in-memory name+PAN ID list, add/remove, capacity-bounded (8 entries). DroidPersistence (src/droid_persistence.cpp) is the thin NVS adapter, joining calibration_store.cpp in the native build/coverage exclusion list.
  • DroidSwitcher + XbeeTransport (include/xbee_control.h / src/xbee_control.cpp): pure orchestration of the leave/set-PAN/rejoin sequence, tested against a fake transport. XbeeControl is an honest stub reporting failure at every step — the real XBee SPI/AT-command implementation is PR 8's job. It's not added to the hardware-exclusion list yet since it has no real hardware calls to exclude — it'll join once PR 8 gives it real SPI calls.
  • Menu additions, both riding PR 6's framework:
    • Switch Droid — list + result screen, invoking DroidSwitcher (currently always reports "No XBee link" until PR 8 lands).
    • Manage Droids — list with "+ Add New", add flow using TextEntryWidget for name then PAN ID (alphanumeric then hex), delete with confirm. Edit is deliberately out of scope — delete + re-add covers it for now; a straight edit flow can follow later if wanted.
  • Factory Reset now also clears the in-memory droid list and reports it through the same consumeDroidStoreChanged() signal a normal add/delete uses, so SnipsController.ino persists it identically either way.

Test plan

  • pio test -e native — all 139 test cases pass
  • gcovr --exclude 'src/SnipsController\.ino' --exclude 'src/oled\.cpp' --exclude 'src/rgb_led\.cpp' --exclude 'src/calibration_store\.cpp' --exclude 'src/droid_persistence\.cpp' --fail-under-line 90 — 98.3% line coverage (menu.cpp itself at 97%; remaining gaps are defensive branches unreachable through the public state machine)
  • pio run -e esp32s3 — builds successfully
  • Flash to real hardware once boards arrive: add a droid, verify it persists across reboot, delete it, confirm Factory Reset clears the list, confirm Switch Droid reports "No XBee link" (expected until PR 8)

🤖 Generated with Claude Code

Adds Switch Droid and Manage Droids to the menu tree, completing it —
these were the two items deferred out of PR 6 pending this subsystem.

- DroidStore (droid_store.h/.cpp): pure in-memory name+PAN ID list,
  add/remove, capacity-bounded. DroidPersistence (droid_persistence.cpp)
  is the thin NVS adapter, joining the native build/coverage exclusion
  list alongside calibration_store.cpp.
- DroidSwitcher + XbeeTransport (xbee_control.h/.cpp): pure orchestration
  of the leave/set-PAN/rejoin sequence, tested against a fake transport.
  XbeeControl is an honest stub reporting failure for every step — the
  real XBee SPI/AT-command implementation is PR 8's job. NOT yet added
  to the hardware-exclusion list since it has no real hardware calls to
  exclude yet; it'll join once PR 8 gives it real SPI calls.
- Menu additions: Switch Droid (list + result screens) and Manage Droids
  (list, add via TextEntryWidget for name then PAN ID, delete with
  confirm) reuse PR 6's framework. Edit is deliberately out of scope for
  now — delete + re-add covers it; a straight edit flow can follow later
  if wanted.
- Factory Reset now also clears the in-memory droid list and reports it
  through the same consumeDroidStoreChanged() signal a normal add/delete
  uses, so SnipsController.ino persists it the same way either way.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@thePunderWoman
thePunderWoman merged commit 032076d into main Sep 8, 2026
2 checks passed
@thePunderWoman
thePunderWoman deleted the firmware-rewrite/pr7-droid-management branch September 8, 2026 01:33
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