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

multi mapping page #7

Merged

Conversation

Pelsin
Copy link

@Pelsin Pelsin commented Feb 14, 2024

Starting point, adds a route: /multi-mapping
Things that are left:

  • Translations keys
  • implement /api/getPinMappingsV2
  • action
  • customDpadMask
  • customButtonMask
  • Button labels depending on mode
  • Better name for api endpoints :)
  • Should it handle profiles also?
  • Backup / export
  • Update pin mapping after setting multi mapping
Screenshot 2024-02-14 at 02 07 52

bsstephan and others added 4 commits February 13, 2024 12:13
before it returned just the actions, which was fine, but now we're
adding more stuff to the infos, so return the whole struct rather than
just the GpioAction within it
this expands GpioMappingInfo to include dpad and button masks and uses
those masks when setting up the button maps in Gamepad. this allows for
a GPIO pin to trigger any arbitrary set of buttons
@bsstephan bsstephan force-pushed the one-pin-multiple-buttons branch 2 times, most recently from 603ed4f to 33607b1 Compare February 22, 2024 22:31
@bsstephan
Copy link
Owner

@Pelsin I have updated my branch with a couple bugfixes and an implementation of /api/getPinMappingsV2. The payload looks like this.

{
    "pin00": {
        "action": 14,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin01": {
        "action": 20,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin02": {
        "action": 0,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin03": {
        "action": 0,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin04": {
        "action": 0,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin05": {
        "action": 12,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin06": {
        "action": 11,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin07": {
        "action": 6,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin08": {
        "action": 5,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin09": {
        "action": 10,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin10": {
        "action": 9,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin11": {
        "action": 8,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin12": {
        "action": 7,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin13": {
        "action": 14,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin14": {
        "action": 15,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin15": {
        "action": 13,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin16": {
        "action": 4,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin17": {
        "action": 3,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin18": {
        "action": 1,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin19": {
        "action": 2,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin20": {
        "action": 16,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin21": {
        "action": 17,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin22": {
        "action": 18,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin23": {
        "action": 20,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin24": {
        "action": 21,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin25": {
        "action": -5,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin26": {
        "action": 22,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin27": {
        "action": 23,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin28": {
        "action": 20,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin29": {
        "action": 19,
        "customButtonMask": 0,
        "customDpadMask": 0
    }
}

I didn't get a chance to update app.js or anything yet, but this should give something to go on.

before it returned just the actions, which was fine, but now we're
adding more stuff to the infos, so return the whole struct rather than
just the GpioAction within it
this expands GpioMappingInfo to include dpad and button masks and uses
those masks when setting up the button maps in Gamepad. this allows for
a GPIO pin to trigger any arbitrary set of buttons
@Pelsin
Copy link
Author

Pelsin commented Feb 28, 2024

Tried in the current state saving a customButtonMask with this payload:
Screenshot 2024-02-29 at 00 49 57

{
    "pin00": {
        "action": -10,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin01": {
        "action": -10,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin02": {
        "action": 33,
        "customButtonMask": 6,
        "customDpadMask": 0
    },
    "pin03": {
        "action": 2,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin04": {
        "action": 4,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin05": {
        "action": 3,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin06": {
        "action": 5,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin07": {
        "action": 6,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin08": {
        "action": 12,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin09": {
        "action": 11,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin10": {
        "action": 7,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin11": {
        "action": 8,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin12": {
        "action": 10,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin13": {
        "action": 9,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin14": {
        "action": 32,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin15": {
        "action": -10,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin16": {
        "action": 13,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin17": {
        "action": 14,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin18": {
        "action": 17,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin19": {
        "action": 18,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin20": {
        "action": 15,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin21": {
        "action": 16,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin22": {
        "action": -10,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin23": {
        "action": -10,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin24": {
        "action": -10,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin25": {
        "action": -10,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin26": {
        "action": 17,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin27": {
        "action": 1,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin28": {
        "action": 0,
        "customButtonMask": 0,
        "customDpadMask": 0
    },
    "pin29": {
        "action": -10,
        "customButtonMask": 0,
        "customDpadMask": 0
    }
}

Got a 200 response but it does not persist, am i sending the action incorrectly?

@bsstephan
Copy link
Owner

@Pelsin - thinko in my side of webconfig.cpp, should be fixed now.

While testing it (I was able to successfully use the web UI to assign a pin to B1+B2+B3, yay), it looked like the Up/Down/Left/Right selections in the field weren't adding to customDpadMask and were instead just making impossibly large customButtonMask values. But the buttons (or at least the ones I tested) seemed to work fine. We're getting there!

@Pelsin
Copy link
Author

Pelsin commented Feb 29, 2024

@bsstephan Nice!
Yeah i'm reusing the buttonMask structure in the hotkeys atm. it seems we are just sending one mask including the buttonMask and dPad if i understand it correctly: https://github.com/bsstephan/GP2040-CE/blob/one-pin-multiple-buttons/src/configs/webconfig.cpp#L311

Just need to do some small changes on the frontend so that hotkeys and multi mapping can use the same data

@Pelsin
Copy link
Author

Pelsin commented Mar 1, 2024

@bsstephan We should now be in a good enough state i think!

@Pelsin Pelsin changed the title WIP: multi mapping page multi mapping page Mar 3, 2024
@bsstephan
Copy link
Owner

Looks and works great! I'm going to try one hack for the profiles as we discussed, but otherwise I think this is ready for a PR against the main repo. Thanks so much!

@bsstephan bsstephan merged commit a01e3ab into bsstephan:one-pin-multiple-buttons Mar 9, 2024
bsstephan pushed a commit that referenced this pull request Mar 22, 2024
* remove double initialization of gamepad GPIOs

* have getProfilePinMappings return whole GpioMappingInfos

before it returned just the actions, which was fine, but now we're
adding more stuff to the infos, so return the whole struct rather than
just the GpioAction within it

* define a custom button combo to a GPIO pin

this expands GpioMappingInfo to include dpad and button masks and uses
those masks when setting up the button maps in Gamepad. this allows for
a GPIO pin to trigger any arbitrary set of buttons

* Add a WIP multi mapping page

* have getProfilePinMappings return whole GpioMappingInfos

before it returned just the actions, which was fine, but now we're
adding more stuff to the infos, so return the whole struct rather than
just the GpioAction within it

* define a custom button combo to a GPIO pin

this expands GpioMappingInfo to include dpad and button masks and uses
those masks when setting up the button maps in Gamepad. this allows for
a GPIO pin to trigger any arbitrary set of buttons

* implement get/setPinMappingsV2 which includes the new masks

* Start moving to new payload structure, new endpoint, translation keys

* Set action if mask is set

* Multi-mapping route added to webconfig, start adding customDpadMask

* Revert endpoint test for v2

* fix issue where setPinMappingsV2 was actually ignoring input

* Rename BUTTON_MASK -> BUTTON_MASK_OPTIONS to prepare for multi mapping data

* Removed some unused imports

* Add support for dpad mask

* Add text for assigned to multi mapping on pin mapping page

* Add support for swapping button labels

* Update pins after setting multi pin

* Set correct default in multi mapping, disables selection on non selectable actions
bsstephan pushed a commit that referenced this pull request Mar 25, 2024
* remove double initialization of gamepad GPIOs

* have getProfilePinMappings return whole GpioMappingInfos

before it returned just the actions, which was fine, but now we're
adding more stuff to the infos, so return the whole struct rather than
just the GpioAction within it

* define a custom button combo to a GPIO pin

this expands GpioMappingInfo to include dpad and button masks and uses
those masks when setting up the button maps in Gamepad. this allows for
a GPIO pin to trigger any arbitrary set of buttons

* Add a WIP multi mapping page

* have getProfilePinMappings return whole GpioMappingInfos

before it returned just the actions, which was fine, but now we're
adding more stuff to the infos, so return the whole struct rather than
just the GpioAction within it

* define a custom button combo to a GPIO pin

this expands GpioMappingInfo to include dpad and button masks and uses
those masks when setting up the button maps in Gamepad. this allows for
a GPIO pin to trigger any arbitrary set of buttons

* implement get/setPinMappingsV2 which includes the new masks

* Start moving to new payload structure, new endpoint, translation keys

* Set action if mask is set

* Multi-mapping route added to webconfig, start adding customDpadMask

* Revert endpoint test for v2

* fix issue where setPinMappingsV2 was actually ignoring input

* Rename BUTTON_MASK -> BUTTON_MASK_OPTIONS to prepare for multi mapping data

* Removed some unused imports

* Add support for dpad mask

* Add text for assigned to multi mapping on pin mapping page

* Add support for swapping button labels

* Update pins after setting multi pin

* Set correct default in multi mapping, disables selection on non selectable actions
bsstephan pushed a commit that referenced this pull request Mar 28, 2024
* remove double initialization of gamepad GPIOs

* have getProfilePinMappings return whole GpioMappingInfos

before it returned just the actions, which was fine, but now we're
adding more stuff to the infos, so return the whole struct rather than
just the GpioAction within it

* define a custom button combo to a GPIO pin

this expands GpioMappingInfo to include dpad and button masks and uses
those masks when setting up the button maps in Gamepad. this allows for
a GPIO pin to trigger any arbitrary set of buttons

* Add a WIP multi mapping page

* have getProfilePinMappings return whole GpioMappingInfos

before it returned just the actions, which was fine, but now we're
adding more stuff to the infos, so return the whole struct rather than
just the GpioAction within it

* define a custom button combo to a GPIO pin

this expands GpioMappingInfo to include dpad and button masks and uses
those masks when setting up the button maps in Gamepad. this allows for
a GPIO pin to trigger any arbitrary set of buttons

* implement get/setPinMappingsV2 which includes the new masks

* Start moving to new payload structure, new endpoint, translation keys

* Set action if mask is set

* Multi-mapping route added to webconfig, start adding customDpadMask

* Revert endpoint test for v2

* fix issue where setPinMappingsV2 was actually ignoring input

* Rename BUTTON_MASK -> BUTTON_MASK_OPTIONS to prepare for multi mapping data

* Removed some unused imports

* Add support for dpad mask

* Add text for assigned to multi mapping on pin mapping page

* Add support for swapping button labels

* Update pins after setting multi pin

* Set correct default in multi mapping, disables selection on non selectable actions
bsstephan added a commit that referenced this pull request Jun 8, 2024
commit 16c34b6
Merge: 3b21858 8b915e0
Author: ian <ian@vidales.se>
Date:   Sat Jun 8 18:14:42 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

    # Conflicts:
    #	proto/config.proto
    #	www/package-lock.json
    #	www/package.json
    #	www/src/Addons/Wii.tsx
    #	www/src/Pages/InputMacroAddonPage.tsx

commit 3b21858
Author: ian <ian@vidales.se>
Date:   Sat May 4 20:59:19 2024 +0200

    Simplify type juggling by making separate components for base pin and profiles mappings

commit 77c30d6
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:59:17 2024 +0200

    Remove old multi mapping path

commit 2f0892f
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:48:01 2024 +0200

    Fix merge issue

commit 12ed309
Merge: be460f9 22ed9a7
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:37:50 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

    # Conflicts:
    #	www/package-lock.json
    #	www/src/Locales/en/Index.jsx
    #	www/src/Pages/InputMacroAddonPage.tsx

commit be460f9
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:19:54 2024 +0200

    Implement UX for multi selection for base profile and single selection for profiles

commit 7dd59ce
Author: ian <ian@vidales.se>
Date:   Fri Apr 26 13:34:20 2024 +0200

    Evaluate if css grids is suitable for the pin mapping page, add nav pills for profiles

commit 0e120b3
Author: ian <ian@vidales.se>
Date:   Mon Apr 22 22:38:24 2024 +0200

    WIP make pin mappping page handle masks

commit 5712845
Author: ian <ian@vidales.se>
Date:   Mon Apr 22 22:25:40 2024 +0200

    Add lodash types

commit 9d10afb
Author: ian <ian@vidales.se>
Date:   Thu Apr 18 10:09:36 2024 +0200

    Remove multmapping page and start merging it with pinMapping page

commit 5f3fa47
Merge: 2e040a4 d384d8e
Author: ian <ian@vidales.se>
Date:   Wed Apr 17 18:08:56 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

commit 2e040a4
Merge: c4a3c78 7fb30b9
Author: ian <ian@vidales.se>
Date:   Sun Apr 14 23:43:49 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

    # Conflicts:
    #	proto/enums.proto
    #	www/src/Data/Pins.ts
    #	www/src/Locales/en/PinMapping.jsx
    #	www/src/Pages/InputMacroAddonPage.jsx
    #	www/src/Pages/PinMapping.tsx
    #	www/src/Pages/SettingsPage.jsx

commit c4a3c78
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Fri Mar 22 16:53:27 2024 -0500

    fix usage of button masks for hotkeys

    I probably introduced this in a bad rebase

commit 580eb5e
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Sat Mar 9 15:20:06 2024 -0600

    add a disclaimer about multi mapping only working on Profile 1

commit 7aef83e
Author: Pelsin <ian@vidales.se>
Date:   Sat Mar 9 21:16:55 2024 +0100

    multi mapping page (#7)

    * remove double initialization of gamepad GPIOs

    * have getProfilePinMappings return whole GpioMappingInfos

    before it returned just the actions, which was fine, but now we're
    adding more stuff to the infos, so return the whole struct rather than
    just the GpioAction within it

    * define a custom button combo to a GPIO pin

    this expands GpioMappingInfo to include dpad and button masks and uses
    those masks when setting up the button maps in Gamepad. this allows for
    a GPIO pin to trigger any arbitrary set of buttons

    * Add a WIP multi mapping page

    * have getProfilePinMappings return whole GpioMappingInfos

    before it returned just the actions, which was fine, but now we're
    adding more stuff to the infos, so return the whole struct rather than
    just the GpioAction within it

    * define a custom button combo to a GPIO pin

    this expands GpioMappingInfo to include dpad and button masks and uses
    those masks when setting up the button maps in Gamepad. this allows for
    a GPIO pin to trigger any arbitrary set of buttons

    * implement get/setPinMappingsV2 which includes the new masks

    * Start moving to new payload structure, new endpoint, translation keys

    * Set action if mask is set

    * Multi-mapping route added to webconfig, start adding customDpadMask

    * Revert endpoint test for v2

    * fix issue where setPinMappingsV2 was actually ignoring input

    * Rename BUTTON_MASK -> BUTTON_MASK_OPTIONS to prepare for multi mapping data

    * Removed some unused imports

    * Add support for dpad mask

    * Add text for assigned to multi mapping on pin mapping page

    * Add support for swapping button labels

    * Update pins after setting multi pin

    * Set correct default in multi mapping, disables selection on non selectable actions

commit f842e25
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Wed Feb 28 18:28:27 2024 -0600

    fix issue where setPinMappingsV2 was actually ignoring input

commit a2853d8
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Thu Feb 22 16:28:06 2024 -0600

    implement get/setPinMappingsV2 which includes the new masks

commit 26bbcbe
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Wed Dec 27 00:44:22 2023 -0600

    define a custom button combo to a GPIO pin

    this expands GpioMappingInfo to include dpad and button masks and uses
    those masks when setting up the button maps in Gamepad. this allows for
    a GPIO pin to trigger any arbitrary set of buttons

commit 55fb9e5
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Wed Dec 27 00:25:10 2023 -0600

    have getProfilePinMappings return whole GpioMappingInfos

    before it returned just the actions, which was fine, but now we're
    adding more stuff to the infos, so return the whole struct rather than
    just the GpioAction within it

Co-authored-by: ian <ian@vidales.se>
Co-authored-by: Pelsin <ian@vidales.se>
bsstephan added a commit that referenced this pull request Jun 8, 2024
commit 16c34b6
Merge: 3b21858 8b915e0
Author: ian <ian@vidales.se>
Date:   Sat Jun 8 18:14:42 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

    # Conflicts:
    #	proto/config.proto
    #	www/package-lock.json
    #	www/package.json
    #	www/src/Addons/Wii.tsx
    #	www/src/Pages/InputMacroAddonPage.tsx

commit 3b21858
Author: ian <ian@vidales.se>
Date:   Sat May 4 20:59:19 2024 +0200

    Simplify type juggling by making separate components for base pin and profiles mappings

commit 77c30d6
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:59:17 2024 +0200

    Remove old multi mapping path

commit 2f0892f
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:48:01 2024 +0200

    Fix merge issue

commit 12ed309
Merge: be460f9 22ed9a7
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:37:50 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

    # Conflicts:
    #	www/package-lock.json
    #	www/src/Locales/en/Index.jsx
    #	www/src/Pages/InputMacroAddonPage.tsx

commit be460f9
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:19:54 2024 +0200

    Implement UX for multi selection for base profile and single selection for profiles

commit 7dd59ce
Author: ian <ian@vidales.se>
Date:   Fri Apr 26 13:34:20 2024 +0200

    Evaluate if css grids is suitable for the pin mapping page, add nav pills for profiles

commit 0e120b3
Author: ian <ian@vidales.se>
Date:   Mon Apr 22 22:38:24 2024 +0200

    WIP make pin mappping page handle masks

commit 5712845
Author: ian <ian@vidales.se>
Date:   Mon Apr 22 22:25:40 2024 +0200

    Add lodash types

commit 9d10afb
Author: ian <ian@vidales.se>
Date:   Thu Apr 18 10:09:36 2024 +0200

    Remove multmapping page and start merging it with pinMapping page

commit 5f3fa47
Merge: 2e040a4 d384d8e
Author: ian <ian@vidales.se>
Date:   Wed Apr 17 18:08:56 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

commit 2e040a4
Merge: c4a3c78 7fb30b9
Author: ian <ian@vidales.se>
Date:   Sun Apr 14 23:43:49 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

    # Conflicts:
    #	proto/enums.proto
    #	www/src/Data/Pins.ts
    #	www/src/Locales/en/PinMapping.jsx
    #	www/src/Pages/InputMacroAddonPage.jsx
    #	www/src/Pages/PinMapping.tsx
    #	www/src/Pages/SettingsPage.jsx

commit c4a3c78
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Fri Mar 22 16:53:27 2024 -0500

    fix usage of button masks for hotkeys

    I probably introduced this in a bad rebase

commit 580eb5e
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Sat Mar 9 15:20:06 2024 -0600

    add a disclaimer about multi mapping only working on Profile 1

commit 7aef83e
Author: Pelsin <ian@vidales.se>
Date:   Sat Mar 9 21:16:55 2024 +0100

    multi mapping page (#7)

    * remove double initialization of gamepad GPIOs

    * have getProfilePinMappings return whole GpioMappingInfos

    before it returned just the actions, which was fine, but now we're
    adding more stuff to the infos, so return the whole struct rather than
    just the GpioAction within it

    * define a custom button combo to a GPIO pin

    this expands GpioMappingInfo to include dpad and button masks and uses
    those masks when setting up the button maps in Gamepad. this allows for
    a GPIO pin to trigger any arbitrary set of buttons

    * Add a WIP multi mapping page

    * have getProfilePinMappings return whole GpioMappingInfos

    before it returned just the actions, which was fine, but now we're
    adding more stuff to the infos, so return the whole struct rather than
    just the GpioAction within it

    * define a custom button combo to a GPIO pin

    this expands GpioMappingInfo to include dpad and button masks and uses
    those masks when setting up the button maps in Gamepad. this allows for
    a GPIO pin to trigger any arbitrary set of buttons

    * implement get/setPinMappingsV2 which includes the new masks

    * Start moving to new payload structure, new endpoint, translation keys

    * Set action if mask is set

    * Multi-mapping route added to webconfig, start adding customDpadMask

    * Revert endpoint test for v2

    * fix issue where setPinMappingsV2 was actually ignoring input

    * Rename BUTTON_MASK -> BUTTON_MASK_OPTIONS to prepare for multi mapping data

    * Removed some unused imports

    * Add support for dpad mask

    * Add text for assigned to multi mapping on pin mapping page

    * Add support for swapping button labels

    * Update pins after setting multi pin

    * Set correct default in multi mapping, disables selection on non selectable actions

commit f842e25
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Wed Feb 28 18:28:27 2024 -0600

    fix issue where setPinMappingsV2 was actually ignoring input

commit a2853d8
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Thu Feb 22 16:28:06 2024 -0600

    implement get/setPinMappingsV2 which includes the new masks

commit 26bbcbe
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Wed Dec 27 00:44:22 2023 -0600

    define a custom button combo to a GPIO pin

    this expands GpioMappingInfo to include dpad and button masks and uses
    those masks when setting up the button maps in Gamepad. this allows for
    a GPIO pin to trigger any arbitrary set of buttons

commit 55fb9e5
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Wed Dec 27 00:25:10 2023 -0600

    have getProfilePinMappings return whole GpioMappingInfos

    before it returned just the actions, which was fine, but now we're
    adding more stuff to the infos, so return the whole struct rather than
    just the GpioAction within it

Co-authored-by: ian <ian@vidales.se>
Co-authored-by: Pelsin <ian@vidales.se>
@Pelsin Pelsin deleted the one-pin-multiple-buttons branch June 8, 2024 18:01
bsstephan added a commit that referenced this pull request Jun 11, 2024
commit 16c34b6
Merge: 3b21858 8b915e0
Author: ian <ian@vidales.se>
Date:   Sat Jun 8 18:14:42 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

    # Conflicts:
    #	proto/config.proto
    #	www/package-lock.json
    #	www/package.json
    #	www/src/Addons/Wii.tsx
    #	www/src/Pages/InputMacroAddonPage.tsx

commit 3b21858
Author: ian <ian@vidales.se>
Date:   Sat May 4 20:59:19 2024 +0200

    Simplify type juggling by making separate components for base pin and profiles mappings

commit 77c30d6
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:59:17 2024 +0200

    Remove old multi mapping path

commit 2f0892f
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:48:01 2024 +0200

    Fix merge issue

commit 12ed309
Merge: be460f9 22ed9a7
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:37:50 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

    # Conflicts:
    #	www/package-lock.json
    #	www/src/Locales/en/Index.jsx
    #	www/src/Pages/InputMacroAddonPage.tsx

commit be460f9
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:19:54 2024 +0200

    Implement UX for multi selection for base profile and single selection for profiles

commit 7dd59ce
Author: ian <ian@vidales.se>
Date:   Fri Apr 26 13:34:20 2024 +0200

    Evaluate if css grids is suitable for the pin mapping page, add nav pills for profiles

commit 0e120b3
Author: ian <ian@vidales.se>
Date:   Mon Apr 22 22:38:24 2024 +0200

    WIP make pin mappping page handle masks

commit 5712845
Author: ian <ian@vidales.se>
Date:   Mon Apr 22 22:25:40 2024 +0200

    Add lodash types

commit 9d10afb
Author: ian <ian@vidales.se>
Date:   Thu Apr 18 10:09:36 2024 +0200

    Remove multmapping page and start merging it with pinMapping page

commit 5f3fa47
Merge: 2e040a4 d384d8e
Author: ian <ian@vidales.se>
Date:   Wed Apr 17 18:08:56 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

commit 2e040a4
Merge: c4a3c78 7fb30b9
Author: ian <ian@vidales.se>
Date:   Sun Apr 14 23:43:49 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

    # Conflicts:
    #	proto/enums.proto
    #	www/src/Data/Pins.ts
    #	www/src/Locales/en/PinMapping.jsx
    #	www/src/Pages/InputMacroAddonPage.jsx
    #	www/src/Pages/PinMapping.tsx
    #	www/src/Pages/SettingsPage.jsx

commit c4a3c78
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Fri Mar 22 16:53:27 2024 -0500

    fix usage of button masks for hotkeys

    I probably introduced this in a bad rebase

commit 580eb5e
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Sat Mar 9 15:20:06 2024 -0600

    add a disclaimer about multi mapping only working on Profile 1

commit 7aef83e
Author: Pelsin <ian@vidales.se>
Date:   Sat Mar 9 21:16:55 2024 +0100

    multi mapping page (#7)

    * remove double initialization of gamepad GPIOs

    * have getProfilePinMappings return whole GpioMappingInfos

    before it returned just the actions, which was fine, but now we're
    adding more stuff to the infos, so return the whole struct rather than
    just the GpioAction within it

    * define a custom button combo to a GPIO pin

    this expands GpioMappingInfo to include dpad and button masks and uses
    those masks when setting up the button maps in Gamepad. this allows for
    a GPIO pin to trigger any arbitrary set of buttons

    * Add a WIP multi mapping page

    * have getProfilePinMappings return whole GpioMappingInfos

    before it returned just the actions, which was fine, but now we're
    adding more stuff to the infos, so return the whole struct rather than
    just the GpioAction within it

    * define a custom button combo to a GPIO pin

    this expands GpioMappingInfo to include dpad and button masks and uses
    those masks when setting up the button maps in Gamepad. this allows for
    a GPIO pin to trigger any arbitrary set of buttons

    * implement get/setPinMappingsV2 which includes the new masks

    * Start moving to new payload structure, new endpoint, translation keys

    * Set action if mask is set

    * Multi-mapping route added to webconfig, start adding customDpadMask

    * Revert endpoint test for v2

    * fix issue where setPinMappingsV2 was actually ignoring input

    * Rename BUTTON_MASK -> BUTTON_MASK_OPTIONS to prepare for multi mapping data

    * Removed some unused imports

    * Add support for dpad mask

    * Add text for assigned to multi mapping on pin mapping page

    * Add support for swapping button labels

    * Update pins after setting multi pin

    * Set correct default in multi mapping, disables selection on non selectable actions

commit f842e25
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Wed Feb 28 18:28:27 2024 -0600

    fix issue where setPinMappingsV2 was actually ignoring input

commit a2853d8
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Thu Feb 22 16:28:06 2024 -0600

    implement get/setPinMappingsV2 which includes the new masks

commit 26bbcbe
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Wed Dec 27 00:44:22 2023 -0600

    define a custom button combo to a GPIO pin

    this expands GpioMappingInfo to include dpad and button masks and uses
    those masks when setting up the button maps in Gamepad. this allows for
    a GPIO pin to trigger any arbitrary set of buttons

commit 55fb9e5
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Wed Dec 27 00:25:10 2023 -0600

    have getProfilePinMappings return whole GpioMappingInfos

    before it returned just the actions, which was fine, but now we're
    adding more stuff to the infos, so return the whole struct rather than
    just the GpioAction within it

Co-authored-by: ian <ian@vidales.se>
Co-authored-by: Pelsin <ian@vidales.se>
bsstephan added a commit that referenced this pull request Jun 17, 2024
* have getProfilePinMappings return whole GpioMappingInfos

before it returned just the actions, which was fine, but now we're
adding more stuff to the infos, so return the whole struct rather than
just the GpioAction within it

* define a custom button combo to a GPIO pin

this expands GpioMappingInfo to include dpad and button masks and uses
those masks when setting up the button maps in Gamepad. this allows for
a GPIO pin to trigger any arbitrary set of buttons

* implement get/setPinMappingsV2 which includes the new masks

* fix issue where setPinMappingsV2 was actually ignoring input

* Squashed commit of Pelsin/one-pin-multiple-buttons-ui-revamp:

commit 16c34b6
Merge: 3b21858 8b915e0
Author: ian <ian@vidales.se>
Date:   Sat Jun 8 18:14:42 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

    # Conflicts:
    #	proto/config.proto
    #	www/package-lock.json
    #	www/package.json
    #	www/src/Addons/Wii.tsx
    #	www/src/Pages/InputMacroAddonPage.tsx

commit 3b21858
Author: ian <ian@vidales.se>
Date:   Sat May 4 20:59:19 2024 +0200

    Simplify type juggling by making separate components for base pin and profiles mappings

commit 77c30d6
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:59:17 2024 +0200

    Remove old multi mapping path

commit 2f0892f
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:48:01 2024 +0200

    Fix merge issue

commit 12ed309
Merge: be460f9 22ed9a7
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:37:50 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

    # Conflicts:
    #	www/package-lock.json
    #	www/src/Locales/en/Index.jsx
    #	www/src/Pages/InputMacroAddonPage.tsx

commit be460f9
Author: ian <ian@vidales.se>
Date:   Sat May 4 18:19:54 2024 +0200

    Implement UX for multi selection for base profile and single selection for profiles

commit 7dd59ce
Author: ian <ian@vidales.se>
Date:   Fri Apr 26 13:34:20 2024 +0200

    Evaluate if css grids is suitable for the pin mapping page, add nav pills for profiles

commit 0e120b3
Author: ian <ian@vidales.se>
Date:   Mon Apr 22 22:38:24 2024 +0200

    WIP make pin mappping page handle masks

commit 5712845
Author: ian <ian@vidales.se>
Date:   Mon Apr 22 22:25:40 2024 +0200

    Add lodash types

commit 9d10afb
Author: ian <ian@vidales.se>
Date:   Thu Apr 18 10:09:36 2024 +0200

    Remove multmapping page and start merging it with pinMapping page

commit 5f3fa47
Merge: 2e040a4 d384d8e
Author: ian <ian@vidales.se>
Date:   Wed Apr 17 18:08:56 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

commit 2e040a4
Merge: c4a3c78 7fb30b9
Author: ian <ian@vidales.se>
Date:   Sun Apr 14 23:43:49 2024 +0200

    Merge branch 'main' into one-pin-multiple-buttons-ui-revamp

    # Conflicts:
    #	proto/enums.proto
    #	www/src/Data/Pins.ts
    #	www/src/Locales/en/PinMapping.jsx
    #	www/src/Pages/InputMacroAddonPage.jsx
    #	www/src/Pages/PinMapping.tsx
    #	www/src/Pages/SettingsPage.jsx

commit c4a3c78
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Fri Mar 22 16:53:27 2024 -0500

    fix usage of button masks for hotkeys

    I probably introduced this in a bad rebase

commit 580eb5e
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Sat Mar 9 15:20:06 2024 -0600

    add a disclaimer about multi mapping only working on Profile 1

commit 7aef83e
Author: Pelsin <ian@vidales.se>
Date:   Sat Mar 9 21:16:55 2024 +0100

    multi mapping page (#7)

    * remove double initialization of gamepad GPIOs

    * have getProfilePinMappings return whole GpioMappingInfos

    before it returned just the actions, which was fine, but now we're
    adding more stuff to the infos, so return the whole struct rather than
    just the GpioAction within it

    * define a custom button combo to a GPIO pin

    this expands GpioMappingInfo to include dpad and button masks and uses
    those masks when setting up the button maps in Gamepad. this allows for
    a GPIO pin to trigger any arbitrary set of buttons

    * Add a WIP multi mapping page

    * have getProfilePinMappings return whole GpioMappingInfos

    before it returned just the actions, which was fine, but now we're
    adding more stuff to the infos, so return the whole struct rather than
    just the GpioAction within it

    * define a custom button combo to a GPIO pin

    this expands GpioMappingInfo to include dpad and button masks and uses
    those masks when setting up the button maps in Gamepad. this allows for
    a GPIO pin to trigger any arbitrary set of buttons

    * implement get/setPinMappingsV2 which includes the new masks

    * Start moving to new payload structure, new endpoint, translation keys

    * Set action if mask is set

    * Multi-mapping route added to webconfig, start adding customDpadMask

    * Revert endpoint test for v2

    * fix issue where setPinMappingsV2 was actually ignoring input

    * Rename BUTTON_MASK -> BUTTON_MASK_OPTIONS to prepare for multi mapping data

    * Removed some unused imports

    * Add support for dpad mask

    * Add text for assigned to multi mapping on pin mapping page

    * Add support for swapping button labels

    * Update pins after setting multi pin

    * Set correct default in multi mapping, disables selection on non selectable actions

commit f842e25
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Wed Feb 28 18:28:27 2024 -0600

    fix issue where setPinMappingsV2 was actually ignoring input

commit a2853d8
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Thu Feb 22 16:28:06 2024 -0600

    implement get/setPinMappingsV2 which includes the new masks

commit 26bbcbe
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Wed Dec 27 00:44:22 2023 -0600

    define a custom button combo to a GPIO pin

    this expands GpioMappingInfo to include dpad and button masks and uses
    those masks when setting up the button maps in Gamepad. this allows for
    a GPIO pin to trigger any arbitrary set of buttons

commit 55fb9e5
Author: Brian S. Stephan <bss@incorporeal.org>
Date:   Wed Dec 27 00:25:10 2023 -0600

    have getProfilePinMappings return whole GpioMappingInfos

    before it returned just the actions, which was fine, but now we're
    adding more stuff to the infos, so return the whole struct rather than
    just the GpioAction within it

Co-authored-by: ian <ian@vidales.se>
Co-authored-by: Pelsin <ian@vidales.se>

* fix thinko in saving custom button/dpad masks

* move get/setPinMappingsV2 into the original method

upon conversations with Pelsin, we don't need this distinction anymore
(if we ever did), and the React side will be updated to accommodate. the
same treatment will be done to get/setProfileOptions, which need to be
updated to accept the masks in order to allow the multiselect to work on
profiles 2-4

* add the button and dpad masks to get/setProfileOptions

this will allow the webconfig to do multiselect buttons on all the
profiles, not just profile 1

* Convert profile pin structure to handle masks

* yet again, don't cast the button/dpad masks as GpioActions

---------

Co-authored-by: ian <ian@vidales.se>
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

2 participants