feat: droid management (switch/manage droids) (PR 7/9) - #42
Merged
Conversation
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>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, joiningcalibration_store.cppin 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.XbeeControlis 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.DroidSwitcher(currently always reports "No XBee link" until PR 8 lands).TextEntryWidgetfor 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.consumeDroidStoreChanged()signal a normal add/delete uses, soSnipsController.inopersists it identically either way.Test plan
pio test -e native— all 139 test cases passgcovr --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🤖 Generated with Claude Code