[PR #245] Add per-section reset-to-defaults buttons in WebUSB panel #255

Open
opened 2026-10-22 05:08:20 +00:00 by roman · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/safijari/openpuck/pull/245
Author: @nabaxo
Created: 8/22/2026
Status: 🔄 Open

Base: main ← Head: panel-reset-defaults


📝 Commits (2)

  • 5a96ecf Add per-section "reset to defaults" buttons to WebUSB panel
  • 714d3e4 Better reactivity

📊 Changes

1 file changed (+140 additions, -0 deletions)

View changed files

📝 docs/index.html (+140 -0)

📄 Description

Summary

  • Adds a Reset button to each config section (chords, mouse sensitivity, gyro mapping, rumble, per-type button mapping) that restores factory defaults via the existing setField() WebUSB path
  • Adds a global Reset all settings button after the Backup card
  • Every reset spawns a confirmation modal (reuses the existing betaPopup() pattern) before writing
  • Buttons auto-disable when current values already match firmware defaults (checked on every blob read)
  • No firmware changes — panel-only, writes known default values from config.cpp

Details

  • DEFAULTS constant mirrors firmware defaults from config.cpp (chords, mouse div/friction, rumble scale/style, gyro mapping, per-type back/qam/abSwap/padHaptics/led/rumble/padStick)
  • updateResetButtons(p) runs at the end of applyBlob(), comparing raw blob bytes against defaults to enable/disable each button
  • Per-type reset buttons are added dynamically inside buildTypeCfgs() alongside existing controls
  • Backward compatible with older firmware protocol versions (gracefully handles missing capabilities)

Test plan

  • Connect puck, verify all reset buttons appear in their sections
  • Verify buttons are disabled when values match defaults (fresh puck should have all disabled)
  • Change a setting, verify the corresponding reset button enables
  • Click reset → confirm modal appears → cancel does nothing
  • Click reset → confirm → values revert to defaults, button disables
  • Click "Reset all settings" → all sections revert
  • Reconnect puck → verify defaults persisted

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/safijari/openpuck/pull/245 **Author:** [@nabaxo](https://github.com/nabaxo) **Created:** 8/22/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `panel-reset-defaults` --- ### 📝 Commits (2) - [`5a96ecf`](https://github.com/safijari/openpuck/commit/5a96ecf6147c8759fa7e1238a3b898456cdd8be2) Add per-section "reset to defaults" buttons to WebUSB panel - [`714d3e4`](https://github.com/safijari/openpuck/commit/714d3e4bc2d506957e1d3a30498d6d3b983586c9) Better reactivity ### 📊 Changes **1 file changed** (+140 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/index.html` (+140 -0) </details> ### 📄 Description ## Summary - Adds a **Reset** button to each config section (chords, mouse sensitivity, gyro mapping, rumble, per-type button mapping) that restores factory defaults via the existing `setField()` WebUSB path - Adds a global **Reset all settings** button after the Backup card - Every reset spawns a confirmation modal (reuses the existing `betaPopup()` pattern) before writing - Buttons auto-disable when current values already match firmware defaults (checked on every blob read) - No firmware changes — panel-only, writes known default values from `config.cpp` ## Details - `DEFAULTS` constant mirrors firmware defaults from `config.cpp` (chords, mouse div/friction, rumble scale/style, gyro mapping, per-type back/qam/abSwap/padHaptics/led/rumble/padStick) - `updateResetButtons(p)` runs at the end of `applyBlob()`, comparing raw blob bytes against defaults to enable/disable each button - Per-type reset buttons are added dynamically inside `buildTypeCfgs()` alongside existing controls - Backward compatible with older firmware protocol versions (gracefully handles missing capabilities) ## Test plan - [ ] Connect puck, verify all reset buttons appear in their sections - [ ] Verify buttons are disabled when values match defaults (fresh puck should have all disabled) - [ ] Change a setting, verify the corresponding reset button enables - [ ] Click reset → confirm modal appears → cancel does nothing - [ ] Click reset → confirm → values revert to defaults, button disables - [ ] Click "Reset all settings" → all sections revert - [ ] Reconnect puck → verify defaults persisted 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
safijari/openpuck#255
No description provided.