Skip to content

Conversation

@yun-wulian
Copy link

This PR adds two new features to GP2040-CE:

  1. Per-Profile Keyboard Mapping Support
  • Each GPIO profile (1-6) can have its own keyboard mapping configuration
  • When switching profiles via hotkey, keyboard mappings switch together
  • Profile 1 uses the existing base keyboard mapping
  • Profiles 2-6 store keyboard mappings in their respective GPIO profile settings
  1. Per-Pin GPIO Polarity/Inversion Support
  • Global toggle Enable Per-Pin Inversion in Settings > Gamepad Settings
  • Per-pin Invert checkbox in Pin Mapping page
  • Supports optical switches with pull-up resistors (active-high)
  • Default behavior unchanged (all pins inverted = active-low)

Backward Compatibility

  • All new fields have sensible defaults
  • No breaking changes to existing configurations

yun-wulian and others added 3 commits December 17, 2025 18:57
### Details
- Add keyboardMapping field to GpioMappings proto message for per-profile storage
- Update storagemanager to return profile-aware keyboard mapping
- Add keyboard mapping read/write to webconfig profile API
- Add profile selector UI in SettingsPage for keyboard mode
- Add KeyboardMappingType to useProfilesStore
- Add localization strings (en, zh-CN)
- Include implementation plan document

Key files:
- proto/config.proto: Added keyboardMapping to GpioMappings
- src/storagemanager.cpp: Profile-aware getKeyboardMapping()
- src/webconfig.cpp: Profile API keyboard mapping support
- www/src/Pages/SettingsPage.jsx: Profile selector dropdown

### Impact
- User-facing: yes
- Breaking change: no
### Details
- Add invertPolarity field to GpioMappingInfo proto (default: true)
- Add enablePinInversion global toggle to GamepadOptions (default: false)
- Implement getInversionMask() in storagemanager to build per-pin mask
- Modify debounceGpioGetAll() to use XOR with inversion mask
- Add per-pin Invert checkbox in Pin Mapping UI
- Add global Enable Per-Pin Inversion toggle in Settings page
- Add localization strings (en, zh-CN)

Key files:
- proto/config.proto: New invertPolarity and enablePinInversion fields
- src/gp2040.cpp: XOR-based selective inversion in debounceGpioGetAll()
- src/storagemanager.cpp: getInversionMask() implementation
- www/src/Pages/PinMapping.tsx: Per-pin inversion toggle UI

### Impact
- User-facing: yes
- Breaking change: no
@TheTrainGoes
Copy link
Contributor

Hi @yun-wulian ,

Thank you for this submission.

The build attempt failed. Let me try a re-run just incase it was a GitHub issue, past that please take a look.

@yun-wulian
Copy link
Author

你好@yun-wulian

感谢您的投稿。

构建尝试失败。我再尝试重新运行一次,以防是 GitHub 的问题,除此之外,请您再看一下。

Im checking this too. the build was successful in my local machine, and tested the function. (im using it.)

@TheTrainGoes
Copy link
Contributor

Thanks @yun-wulian the re-try of the action run worked.

We will check it out!

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.

2 participants