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

Allow for the enabling and disabling of profiles #1149

Merged
merged 9 commits into from
Sep 27, 2024

Conversation

bsstephan
Copy link
Contributor

This...

  • adds an enabled flag to GpioMappings (so in both the core gamepad Profile 1, and the alternative Profiles 2-4 structures)
  • updates the set/next/previousProfile calls to only set or cycle through enabled profiles; if you have 1 and 2 enabled and 3 and 4 are disabled or don't exist, next toggles 1 -> 2 -> 1, or activating the hotkey to set profile 4 just doesn't do anything (neither trigger a change, so the OLED doesn't even update --- the request is essentially silently ignored)
  • allows the user to manage the enabled flag via the webconfig for profiles 2(!) through 4
    • profile 1 cannot be disabled and is always assumed to be enabled in the code
  • because profiles no longer have to be populated/can be disabled, profile 1 is no longer copied into 2-4 when initializing a fresh board
    • there is now a migration to disable profiles that look like they are still copies of profile 1 (I guess in retrospect they could be deleted, but whatever)
  • because profiles 2-4 may not exist, the webconfig also allows the user to create them for the first time, based on profile 1, where they can then populate them

I have played with the hotkeys to select (or not) profiles heavily, and also have tested the webconfig on a migrated board, a reconfigured board, and a nuked board. Everything seems good. And thanks again to another awesome UI job by @Pelsin.

bsstephan and others added 9 commits September 25, 2024 10:40
with this flag we no longer need to copy profile 1 to 2-4 by default, so
that migration goes away, but because of that we need to migrate the old
way of doing things and only enable profiles that are actually different
than the base.

in the end, new fresh boards should have profile 1 only enabled, and
profiles 2-4 blank (no copying, disabled by default), and migrated
configs should have profiles (that exist) that differ from profile 1
enabled and profiles that don't disabled
Enable profile flag in the UI and support adding profiles that are not yet defined (or enabled)
@bsstephan
Copy link
Contributor Author

This resolves #1140.

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.

Looks great! Next/Previous makes sense, just loop through until you find a valid profile, which could be the profile you're currently on.

@arntsonl arntsonl merged commit 20c5433 into OpenStickCommunity:main Sep 27, 2024
44 checks passed
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.

3 participants