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

New Add-On: Rotate Input + Tilt Input = Analog Modification Input #558

Closed
wants to merge 57 commits into from

Conversation

jack2game
Copy link

@jack2game jack2game commented Oct 5, 2023

Edit: Hide the old post

Old post ## Rotate Input
  • Rotate 1 Pin - The GPIO pin used for the Rotate 1 (Clockwise Rotation).
  • Rotate 1 Degree for Left Stick
  • Rotate 1 Degree for Right Stick
  • Rotate 2 Pin - The GPIO pin used for the Rotate 2 (Counter Clockwise Rotation).
  • Rotate 2 Degree for Left Stick
  • Rotate 2 Degree for Right Stick
  • Rotate SOCD Mode - Choose the default SOCD Cleaning Mode (Neutral, Last Win, Up Priority).

The Rotate feature in this add-on allows users to control analog stick values on both Left and Right Analogs.

Rotate 1 and Rotate 2 buttons, when pressed with directional buttons, adjust the analog values, with Rotate 1 makes your sticks rotate clockwise and Rotate 2 makes them rotate counter clockwise.

The angle can be adjusted in the web configurator. If you set the rotation angle to be 180, you will effectively swap your Up&Down and Left&Right for your sticks.

Additionally, pressing Rotate 1 and Rotate 2 simultaneously allows the Right stick to function as the D-Pad directions.

@jack2game
Copy link
Author

jack2game commented Oct 5, 2023

I want to add that Rotate feature only works when DPad mode is either set as L Stick or R Stick.

If DPad is set to function as a DPad, the Rotate feature will have no impact, as expected.

By using both Rotate 1 & 2, users will have access to a total of 24 different angles on their sticks, a meaningful improvement from the 8-way stick.

@mikepparks
Copy link
Contributor

Could you possibly elaborate on use cases for this? Seems like this would be better covered by the Analog addon that already exists with improvements to Invert options.

@jack2game
Copy link
Author

jack2game commented Oct 6, 2023

Could you possibly elaborate on use cases for this? Seems like this would be better covered by the Analog addon that already exists with improvements to Invert options.

Not really… allow me to explain.

  1. Analog addon requires additional ADC input, taking 4 extra pins only at 26, 27, 28, 29. It is possible to add rotation (and 2 more buttons) to Analog addon too, but probably much less meaningful. Rotate addon works with all pins and only need 1 or 2 extra buttons. Plus Analog addon doesn't give you precise and consistent angle input like Rotate addon, given Rotate doesn't require ADC inputs. They are very different and for different purposes.
  2. Rotate addon allows you to have 360 different possibilities. Invert is only one of them when you set the angle as 180.
  3. One typical use would be set Rotate 1 Degree to be 15, and Rotate 2 Degree to be 15, which gives you a total of 24 angles, with only 2 extra pins. A simple illustration can be found below. I only drew the possibilities when using Rotate 1 or 2 together with Up and Right buttons, but it will work with all diagonals.
  4. Rotate
  5. This is extremely useful for MetroidVania games such as Bloodstained, which requires both motion inputs and more granularity on angle inputs for right stick when aiming. Another example is the free aim function in Metroid Dread. With Rotate add-on, and DPad mode as default, I only need 3 buttons to achieve 24 angle inputs on Left or Right Stick: Rotate1, Rotate2, and Another button in Slider Addon which changes DPad mode to Left or Right Stick when holding.

Reference:

  • Bloodstained Motion Inputs: Link
  • Bloodstained Control Scheme (requiring Right Stick for aiming): Link
  • Free Aim in Metroid Series: Link

@jack2game jack2game marked this pull request as draft October 7, 2023 17:15
@jack2game jack2game changed the title New Add-On: Rotate Input New Add-On: Rotate Input + Tilt Input = Analog Modification Input Oct 7, 2023
@jack2game
Copy link
Author

jack2game commented Oct 7, 2023

Edit: Hide the old post

Old post ## Analog Modification Input ![settings](https://github.com/OpenStickCommunity/GP2040-CE/assets/16070158/82b5cef2-309f-4341-8872-f6edbe1a00bf) ### Tilt Tilt 1 and Tilt 2 buttons, when pressed with directional buttons, adjust the analog values. Default settings tilt the Left stick at 65% for Tilt 1 and 35% for Tilt 2. The Right stick shifts down for Tilt 1 and up for Tilt 2 by default. Tilt 1 has priority over Tilt 2 when modifying Left Stick. Pressing Tilt 1 and Tilt 2 simultaneously with Right Stick will function as the D-Pad. Tilt has priority over Rotate. * `Tilt 1 Pin` - The GPIO pin used for the Tilt 1 direction. * `Tilt 2 Pin` - The GPIO pin used for the Tilt 2 direction. * `Tilt 1 X-Axis Factor for Left Stick` * `Tilt 1 Y-Axis Factor for Left Stick` * `Tilt 1 X-Axis Factor for Right Stick` * `Tilt 1 Y-Axis Factor for Right Stick` * `Tilt 2 X-Axis Factor for Left Stick` * `Tilt 2 Y-Axis Factor for Left Stick` * `Tilt 2 X-Axis Factor for Right Stick` * `Tilt 2 Y-Axis Factor for Right Stick`

Rotate

Rotate 1 and Rotate 2 buttons, when pressed with directional buttons, adjust the analog values.
Rotate 1 makes sticks rotate clockwise and Rotate 2 makes them rotate counter clockwise.
Rotate 1 has priority over Rotate 2 when modifying Left Stick.
Pressing Rotate 1 and Rotate 2 simultaneously with Right Stick will function as the D-Pad.

  • Rotate 1 Pin - The GPIO pin used for the Rotate 1 (Clockwise Rotation).
  • Rotate 2 Pin - The GPIO pin used for the Rotate 2 (Counter Clockwise Rotation).
  • Rotate 1 Degree for Left Stick
  • Rotate 1 Degree for Right Stick
  • Rotate 2 Degree for Left Stick
  • Rotate 2 Degree for Right Stick

Analog Stick Pins

User can also set dedicated analog stick pins to work with Tilt and Rotate features.
Setting dedicated analog stick pins will overwrite the settings in DPad mode slider addon.

  • Analog Modification Left Analog Up Pin - The GPIO pin used for the Up direction on the Left analog stick.
  • Analog Modification Left Analog Down Pin - The GPIO pin used for the Down direction on the Left analog stick.
  • Analog Modification Left Analog Left Pin - The GPIO pin used for the Left direction on the Left analog stick.
  • Analog Modification Left Analog Right Pin - The GPIO pin used for the Right direction on the Left analog stick.
  • Analog Modification Right Analog Up Pin - The GPIO pin used for the Up direction on the Right analog stick.
  • Analog Modification Right Analog Down Pin - The GPIO pin used for the Down direction on the Right analog stick.
  • Analog Modification Right Analog Left Pin - The GPIO pin used for the Left direction on the Right analog stick.
  • Analog Modification Right Analog Right Pin - The GPIO pin used for the Right direction on the Right analog stick.

SOCD

  • Analog Modification SOCD Mode - Choose the default Analog Mod SOCD Cleaning Mode (Neutral, Last Win, Up Priority).

@jack2game jack2game marked this pull request as ready for review October 7, 2023 19:52
@jack2game jack2game marked this pull request as ready for review October 19, 2023 15:20
@jack2game jack2game marked this pull request as draft October 19, 2023 15:41
jack2game and others added 3 commits October 19, 2023 17:56
* Fixes Macro type Press and Loop issue (OpenStickCommunity#587)

* Fix looping macro first input line duration error

* Fix Press macro interruptible check with debounce

* Remove onboard LED pin definition from devices without an onboard LED (OpenStickCommunity#590)

---------

Co-authored-by: deeebug <[email protected]>
Co-authored-by: TheTrain <[email protected]>
@mikepparks
Copy link
Contributor

So far, my biggest concern with all of this is the unrequested changing of names on things that do not need to be changed just to make the desired adjustments. It muddies the waters for the sake of semantics. I see more commits here that change what exists in name only than I do things that actually improve or modify functionality. My advice would be to step back, reincorporate your actual changes from this PR into the existing addon as a new PR, and leave the structural and semantic concepts for the team to decide.

@Fortinbra Fortinbra requested review from Pelsin, mthiesen, bsstephan, mikepparks, arntsonl and deeebug and removed request for mthiesen and Pelsin October 20, 2023 01:20
@jack2game
Copy link
Author

Updated proto in commit 3dbb341. Just want to note that following fields are left untouched but no longer used.

Legacy pronto fields optional int32 tiltFunctionPin = 4;
optional int32 tiltLeftAnalogUpPin = 5;
optional int32 tiltLeftAnalogDownPin = 6;
optional int32 tiltLeftAnalogLeftPin = 7;
optional int32 tiltLeftAnalogRightPin = 8;
optional int32 tiltRightAnalogUpPin = 9;
optional int32 tiltRightAnalogDownPin = 10;
optional int32 tiltRightAnalogLeftPin = 11;
optional int32 tiltRightAnalogRightPin = 12;
optional SOCDMode tiltSOCDMode = 13;

@jack2game jack2game marked this pull request as ready for review October 20, 2023 09:18
@arntsonl
Copy link
Contributor

Let me first say thank you for adding onto the tilt add-on! After some thought, I'm going to close this PR and have you submit a new one with just the rotation changes with the following requests:

  1. Change analogmod.* back to tilt.*, we've established this as the tilt add-on and do not want to change the meaning of tilt
  2. Change all of the renames in protobuf back to tilt* nomenclature.
  3. Resubmit the PR once the files and naming has been changed back to tilt, that way it should be WAY less code and much easier to track in github.

@arntsonl arntsonl closed this Oct 24, 2023
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.

4 participants