Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate profiles to use GpioMappings, allowing extra buttons, DDI, and sliders in profiles #652

Merged
merged 10 commits into from
Dec 6, 2023

Conversation

bsstephan
Copy link
Contributor

This refactors the profile code to be extra copies of GpioMappings, which moved the core code (and now the profiles, with this change) from button-to-pin to pin-to-action mapping. The core change allowed for arbitrary extra buttons and also moved the DDI and slider pin assignments into the core pin configuration, and now the same applies to profiles.

@Pelsin contributed all the UI code, and I am as always thankful for that. Note that the profiles have moved to the pin mapping page, and now the pin mapping page has four tabs, for the core config + 3 extra profiles.

CAVEATS:

  • The ability to remap buttons extends to the Function button! If users remap away their Function button, and are using it for profiles, they won't be able to hotkey their way back to another profile and will have to go into the webconfig to switch profiles again. This seems like a corner case/fair trade to me, so the code takes no particular precaution here.
  • The same applies to the buttons critical to boot hotkeys! If you map away your S2, you won't be able to get into webconfig unless you nuke the config or use something like the forced webconfig boot .uf2.
  • DDI and the slider add-ons must still be enabled for their pin mappings to matter; the caveat here is that the add-ons are enabled globally, despite profiles, so if you have the slider enabled, its default option (or active pins) override the hotkey-changeable controller setting. If you have a profile enabled that doesn't have slider pins, your only option in that profile is the default option. This also seems like a corner case to me, but maybe a future refactor can make this easier on people.

Getting this one out there for people to play with and review.

bsstephan and others added 9 commits December 6, 2023 09:09
now that the core GpioMappings is a simple array, profiles can just
simply be more arrays. this updates the protobuf config and migration,
and *mostly* covers the gamepad functionality. "normal" profile changes
work fine, but it doesn't yet know how to un/remap DDI and sliders,
since those are currently managed at addon init time and don't get
altered.

I'll probably just have to add some hooks to reinit those, until we fold
them into core proper
this allows profiles, which can map the DDI, JS slider, and SOCD slider
options to pins in the core profile, to change those mappings in other
profiles. this is of dubious utility for the sliders (you have to enable
and thus they apply the default even if you don't have a pin mapped to
them, so their default mode will override the ability to hotkey change
them, and thus every practical use will probably keep the slider pins
the same in all profiles), but relevant for DDI, where you may have DDI
buttons on some profiles and extra inputs on others.

nevertheless this is tested on all three of the "simple" addons
@Pelsin
Copy link
Contributor

Pelsin commented Dec 6, 2023

Nice! As a tiny addition, it's also possible to map all profiles with the gamepad record thingy.

Here is a preview on the ui with the base + profiles merged:
Skärmavbild 2023-12-06 kl  16 39 38

Copy link
Contributor

@arntsonl arntsonl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really small change and a question about the exact="true" stuff since I don't know what that means.

www/src/Components/Navigation.jsx Outdated Show resolved Hide resolved
www/src/Locales/en/PinMapping.jsx Outdated Show resolved Hide resolved
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.

None yet

3 participants