Skip to content

Configurable controller mappings (settings)#62

Draft
mringsby wants to merge 1 commit into
feature/dock-holdfrom
feature/controller-mapping
Draft

Configurable controller mappings (settings)#62
mringsby wants to merge 1 commit into
feature/dock-holdfrom
feature/controller-mapping

Conversation

@mringsby

@mringsby mringsby commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

What

Controller bindings were hardcoded in controller.py. This adds a logical-action → physical-input map that can be edited from the settings UI and persisted — firmware is unaffected (purely topside input routing).

  • Controller loads DEFAULT_MAPPING (reproducing the previous hardcoded bindings) and reads the stick axes, manipulator triggers, the pitch/roll shift, and the dock/frame buttons through the map. get/set/reset_mapping support live reload.
  • Persisted under controller_map in data/config.json, reapplied on startup.
  • New endpoints: GET/POST /api/controller/mapping, POST /api/controller/mapping/reset, and GET /api/controller/live-input (publishes pressed buttons + axis values for capture).
  • The ⚙️ settings modal gets a Controller Mapping table: per-action SDL/Raw index, an invert toggle (axes), plus press-to-bind capture, Save, and Reset.

⚠️ Stacked PR (top of the stack)

Based on feature/dock-hold. Full stack order: feature/light-controlfeature/global-framefeature/dock-holdfeature/controller-mapping. Review/merge in that order.

Notes / scope

  • Light up/down stays on the D-pad (hat vs button differs across SDL/raw) — out of this remap by design.
  • The settings modal is included on the Home page (⚙️), so the mapping editor is reachable from there.

Verification

  • ruff check . + ruff format --check . — pass.
  • pytest tests/test_controller.py — pass (override/ignore-unknown, reset-to-defaults, and a test that remapping changes which axis drives surge). Existing input tests still pass since defaults reproduce prior behavior.

🤖 Generated with Claude Code

Controller bindings were hardcoded. Add a logical-action -> physical-input map so
they can be edited from the settings UI and persisted. Firmware is unaffected
(the map is purely topside input routing).

- Controller loads DEFAULT_MAPPING (reproducing the previous hardcoded bindings)
  and reads stick axes, manipulator triggers, the pitch/roll shift, and the
  dock/frame buttons through it; get/set/reset_mapping support live reload.
- Persisted under 'controller_map' in data/config.json and reapplied on startup.
- New endpoints: GET/POST /api/controller/mapping, POST .../reset, and
  GET /api/controller/live-input (publishes pressed buttons + axis values).
- Settings modal gets a Controller Mapping table: per-action SDL/Raw index, an
  invert toggle for axes, plus press-to-bind capture, Save, and Reset.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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