Skip to content

feat: add factory reset functionality#37

Merged
b4nst merged 1 commit intomainfrom
feat/factory-reset
Jan 26, 2026
Merged

feat: add factory reset functionality#37
b4nst merged 1 commit intomainfrom
feat/factory-reset

Conversation

@b4nst
Copy link
Owner

@b4nst b4nst commented Jan 26, 2026

Summary

Hold Setup button for 3 seconds to reset all settings to factory defaults.

Closes #22

Changes

  • Add warning LED patterns (medium red at 1s, full red at 2s)
  • Add success pattern (green at 3s)
  • Add flash_factory_reset() function
  • Track setup button hold time in timer event
  • Use volatile for shared timer/interrupt variables
  • Fix FlashData structure alignment for ARM Cortex-M3

Reset Sequence

  1. 1 second: Grid shows medium red warning
  2. 2 seconds: Grid shows full red warning
  3. 3 seconds: Reset executes, green success pattern
  4. 500ms later: Returns to normal display

Behavior

  • Short press (< 1s): Normal setup mode toggle (unchanged)
  • Release during warning: Cancels reset, returns to previous display
  • Hold 3+ seconds: Factory reset executes

Test plan

  • Short press still toggles setup mode
  • 1 second hold shows medium red warning
  • 2 second hold shows full red warning
  • 3 second hold executes reset and shows green
  • Release during warning cancels and refreshes display
  • All pages reset to defaults
  • Flash updated with defaults
  • Unit tests pass (97 tests)
  • ARM build succeeds

🤖 Generated with Claude Code

Hold Setup button for 3 seconds to reset all settings to defaults:
- 1 second: Medium red warning on grid
- 2 seconds: Full red warning on grid
- 3 seconds: Execute reset, green success pattern

Features:
- Resets all 4 pages to default settings
- Saves defaults to flash
- Reinitializes application state
- Short press (< 1s) still toggles setup mode

Implementation:
- Add render_factory_reset_warning_slow/fast/success() in layout.c
- Add flash_factory_reset() in flash.c
- Track setup button hold time in app.c timer event
- Use volatile for shared timer/interrupt variables
- Fix FlashData alignment for ARM Cortex-M3

Closes #22

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@b4nst b4nst force-pushed the feat/factory-reset branch from 2100f28 to 19a1618 Compare January 26, 2026 19:38
@b4nst b4nst merged commit c2bfedd into main Jan 26, 2026
1 check passed
@b4nst b4nst deleted the feat/factory-reset branch January 26, 2026 19:39
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.

feat: Add factory reset functionality

1 participant