Skip to content

refactor: drive bool settings from a descriptor table#36

Closed
Swissola wants to merge 3 commits into
anthropics:mainfrom
Swissola:refactor/settings-table
Closed

refactor: drive bool settings from a descriptor table#36
Swissola wants to merge 3 commits into
anthropics:mainfrom
Swissola:refactor/settings-table

Conversation

@Swissola
Copy link
Copy Markdown

Summary

Replace six parallel hardcoded lists with a single BOOL_SETTINGS[] descriptor table in stats.h. Adding a new bool setting now requires one entry in the table; settingsLoad(), settingsSave(), drawSettings(), and applySetting() all derive from it automatically.

Motivation

Every bool setting previously had to be registered in six separate places:

  1. Settings struct field
  2. settingsLoad() NVS read
  3. settingsSave() NVS write
  4. settingsItems[] menu label
  5. applySetting() switch case
  6. drawSettings() vals[] display array

Miss any one of them and the setting silently misbehaves with no compiler warning. This is a maintenance hazard that compounds as more settings are added.

What changed

  • BoolSettingDef struct added to stats.h — label, NVS key, pointer-to-member, default
  • BOOL_SETTINGS[] table replaces the scattered definitions for sound, bt, wifi, led, hud
  • SETTINGS_N is now derived: 1 + BOOL_SETTINGS_N + 4 — stays correct as the table grows
  • Non-bool settings (clockRot) and special actions (brightness, pet, reset, back) remain explicit
  • No behaviour change — NVS keys, defaults, and menu order are identical

Test plan

  • All existing settings toggle correctly
  • Values persist across reboot
  • Menu order unchanged
  • Factory reset clears all settings

🤖 Generated with Claude Code

Swissola and others added 3 commits May 22, 2026 17:37
sleep=Donald Duck, idle=Bongo Cat, busy=SpongeBob multitasking,
attention=Surprised Pikachu (Nouns glasses), celebrate=Peanuts party,
dizzy=Powerpuff Girls spiral eyes, heart=heart eyes ghost.

Source GIFs in characters/memes-src/, device-ready pack in characters/memes/.
Built with prep_character.py at 96x98px, 64 colours per frame.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Track the current peer BD address in onConnect (extended overload).
bleRemoveCurrentBond() removes only that peer's LTK from NVS. The
"unpair" JSON command now calls this instead of bleClearBonds(), so
each host unpairs itself independently. bleClearBonds() is reserved
for factory reset only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the parallel lists in settingsLoad(), settingsSave(), settingsItems[],
applySetting(), and drawSettings() with a single BOOL_SETTINGS[] table in
stats.h. Adding a new bool setting now requires one entry in the table;
everything else derives from it automatically. Non-bool settings (clockRot)
and special actions (brightness, pet, reset, back) stay explicit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Swissola
Copy link
Copy Markdown
Author

Closing as this is outside the scope of the upstream reference implementation per CONTRIBUTING.md. This change is maintained in the community fork at https://github.com/Swissola/claude-desktop-buddy — see the enhance/haptics-and-settings branch.

@Swissola Swissola closed this May 23, 2026
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