[PR #87] [MERGED] Add configurable lizard-mode binding table (replaces hardcoded button map) #193

Closed
opened 2026-10-22 05:07:22 +00:00 by roman · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/safijari/openpuck/pull/87
Author: @Copilot
Created: 6/25/2026
Status: ✅ Merged
Merged: 7/5/2026
Merged by: @safijari

Base: main ← Head: copilot/add-remap-pure-lizard-mode-shortcuts


📝 Commits (4)

  • 9fb6539 Add lizard_map binding system and rewrite mode_lizard to use it
  • 55cce32 Actually working now
  • 8849c4a Merge main into lizard-map branch: reconcile lizard rewrite with multi-controller/stability rework
  • 3b37d8e Merge branch 'main' into copilot/add-remap-pure-lizard-mode-shortcuts

📊 Changes

9 files changed (+817 additions, -190 deletions)

View changed files

📝 OpenPuck/OpenPuck.ino (+10 -0)
➕ OpenPuck/lizard_map.cpp (+155 -0)
➕ OpenPuck/lizard_map.h (+72 -0)
📝 OpenPuck/mode_lizard.cpp (+207 -158)
📝 OpenPuck/mode_lizard.h (+16 -12)
📝 OpenPuck/puck_hid.cpp (+24 -11)
📝 OpenPuck/webusb_config.cpp (+95 -8)
📝 docs/PROTOCOL.md (+23 -0)
📝 docs/index.html (+215 -1)

📄 Description

Hardcoded button→keyboard/mouse mappings in mode_lizard.cpp can't be user-customized. This PR replaces them with a runtime-editable LizardMap table — laying the groundwork for both a WebUSB/browser remapping UI and future emulated-controller remapping using the same engine.

New files

  • lizard_map.h — data model: LizardBinding (16 bytes each), LizardMap (count + up to 32 bindings), output-type constants (LZ_OUT_KBD_CHORD, LZ_OUT_MOUSE_BTN, LZ_OUT_MOUSE_AXIS, LZ_OUT_SCROLL, LZ_OUT_CONSUMER), analog-source constants, virtual stick-deflection trigger bits (LZ_BTN_LSTICK_*, ORed in at eval time since SC2 never sets bits 28–31)
  • lizard_map.cpp — defaultLizardMap() (26 bindings reproducing the original hardcoded behavior), saveLizardMap() / loadLizardMap() with LittleFS persistence (magic 0xB1, version byte, graceful reset to defaults on mismatch)

Modified files

  • mode_lizard.h/cpp — rfLizard drops the raw rep pointer (reads g_in[0] directly, consistent with all other modes); body replaced by a loop over g_lizardMap.bindings[] that accumulates keyboard chord, mouse button/axis, scroll, and edge-triggered consumer outputs. A kbdConsumed bitmask suppresses simpler single-button bindings when a hold-modifier combo (e.g. Steam+X) has already claimed those trigger bits.

Still pending (won't compile yet)

  • puck_hid.cpp call site update (drop rep arg)
  • OpenPuck.ino setup: #include "lizard_map.h" + loadLizardMap()
  • webusb_config.cpp: version 9→10, opcodes 0x0D/0x0E/0x0F (GET/SET/RESET map)
  • serial_console.cpp: 'f' (dump) / 'u' (reset) debug commands
  • docs/index.html: "Lizard / Desktop shortcuts" binding editor card

🔄 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/87 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 6/25/2026 **Status:** ✅ Merged **Merged:** 7/5/2026 **Merged by:** [@safijari](https://github.com/safijari) **Base:** `main` ← **Head:** `copilot/add-remap-pure-lizard-mode-shortcuts` --- ### 📝 Commits (4) - [`9fb6539`](https://github.com/safijari/openpuck/commit/9fb65396d1c0c6cbb0d9e3eb0ccf6b0575598ee8) Add lizard_map binding system and rewrite mode_lizard to use it - [`55cce32`](https://github.com/safijari/openpuck/commit/55cce321944b2ab552805510cb83463cbc8406d7) Actually working now - [`8849c4a`](https://github.com/safijari/openpuck/commit/8849c4a1d667f2a93c615916bab8d51b8f9ac1a9) Merge main into lizard-map branch: reconcile lizard rewrite with multi-controller/stability rework - [`3b37d8e`](https://github.com/safijari/openpuck/commit/3b37d8e1d7e8cacd294276332fcb545d425cd520) Merge branch 'main' into copilot/add-remap-pure-lizard-mode-shortcuts ### 📊 Changes **9 files changed** (+817 additions, -190 deletions) <details> <summary>View changed files</summary> 📝 `OpenPuck/OpenPuck.ino` (+10 -0) ➕ `OpenPuck/lizard_map.cpp` (+155 -0) ➕ `OpenPuck/lizard_map.h` (+72 -0) 📝 `OpenPuck/mode_lizard.cpp` (+207 -158) 📝 `OpenPuck/mode_lizard.h` (+16 -12) 📝 `OpenPuck/puck_hid.cpp` (+24 -11) 📝 `OpenPuck/webusb_config.cpp` (+95 -8) 📝 `docs/PROTOCOL.md` (+23 -0) 📝 `docs/index.html` (+215 -1) </details> ### 📄 Description Hardcoded button→keyboard/mouse mappings in `mode_lizard.cpp` can't be user-customized. This PR replaces them with a runtime-editable `LizardMap` table — laying the groundwork for both a WebUSB/browser remapping UI and future emulated-controller remapping using the same engine. ## New files - **`lizard_map.h`** — data model: `LizardBinding` (16 bytes each), `LizardMap` (`count` + up to 32 bindings), output-type constants (`LZ_OUT_KBD_CHORD`, `LZ_OUT_MOUSE_BTN`, `LZ_OUT_MOUSE_AXIS`, `LZ_OUT_SCROLL`, `LZ_OUT_CONSUMER`), analog-source constants, virtual stick-deflection trigger bits (`LZ_BTN_LSTICK_*`, ORed in at eval time since SC2 never sets bits 28–31) - **`lizard_map.cpp`** — `defaultLizardMap()` (26 bindings reproducing the original hardcoded behavior), `saveLizardMap()` / `loadLizardMap()` with LittleFS persistence (magic `0xB1`, version byte, graceful reset to defaults on mismatch) ## Modified files - **`mode_lizard.h/cpp`** — `rfLizard` drops the raw `rep` pointer (reads `g_in[0]` directly, consistent with all other modes); body replaced by a loop over `g_lizardMap.bindings[]` that accumulates keyboard chord, mouse button/axis, scroll, and edge-triggered consumer outputs. A `kbdConsumed` bitmask suppresses simpler single-button bindings when a hold-modifier combo (e.g. Steam+X) has already claimed those trigger bits. ## Still pending (won't compile yet) - `puck_hid.cpp` call site update (drop `rep` arg) - `OpenPuck.ino` setup: `#include "lizard_map.h"` + `loadLizardMap()` - `webusb_config.cpp`: version 9→10, opcodes `0x0D`/`0x0E`/`0x0F` (GET/SET/RESET map) - `serial_console.cpp`: `'f'` (dump) / `'u'` (reset) debug commands - `docs/index.html`: "Lizard / Desktop shortcuts" binding editor card --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
roman 2026-10-22 05:07:22 +00:00
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#193
No description provided.