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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
92c4a05
Placeholder file for Rotation
Oct 5, 2023
efbb796
Rotate placeholder
Oct 5, 2023
fddfa50
update source
Oct 5, 2023
1a2aea0
function done
Oct 5, 2023
e704fde
add rotation function
Oct 5, 2023
fbebc2e
add rotation function
Oct 5, 2023
45f07ff
Create AnalogMod
Oct 7, 2023
f7d6a7f
Combined Rotate and Tilt
Oct 7, 2023
6b4c035
Update app.js
Oct 7, 2023
8afb4c2
Update analogmod.h
Oct 8, 2023
8eb2b04
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 8, 2023
5608c83
Fix conflict files
jack2game Oct 8, 2023
42ee986
Merge branch 'mergeRotation20231009' into Rotation
jack2game Oct 8, 2023
e5ef90b
Merge branch 'OpenStickCommunity:main' into Rotation + Add new doc
jack2game Oct 8, 2023
6f1ef3d
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 9, 2023
45b334e
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 10, 2023
6bd6402
Set default value relaying PR #567
jack2game Oct 11, 2023
d86d5ce
Merge branch 'Rotation' of https://github.com/jack2game/GP2040-CE int…
jack2game Oct 11, 2023
33428bf
Update default value for Tilt
jack2game Oct 11, 2023
cfddaa5
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 11, 2023
beaac38
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 11, 2023
4843efb
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 13, 2023
15e1c5e
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 14, 2023
383da4f
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 18, 2023
39e1756
update proto with backward compatibility
jack2game Oct 18, 2023
125cae5
Update Tilt Behavior as PR #577 + Streamline functions with cases re-…
jack2game Oct 18, 2023
ea94f74
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 18, 2023
0e5c594
Merge branch '20231018RotationMerge' into Rotation
jack2game Oct 18, 2023
fed8c65
discountinued tilt.cpp
jack2game Oct 18, 2023
d6f7a43
Merge branch 'OpenStickCommunity-main' into Rotation
jack2game Oct 18, 2023
3283e17
update dpadToAnalog function with input_Mode parameter
jack2game Oct 18, 2023
8b44238
Change all rotation to clockwise, allow 0-360 degree
jack2game Oct 18, 2023
3e60fdc
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 18, 2023
fb426a3
update config page
jack2game Oct 18, 2023
740beee
Merge branch 'Rotation' of https://github.com/jack2game/GP2040-CE int…
jack2game Oct 18, 2023
0c50ec4
update docs + using new mid point
jack2game Oct 18, 2023
c5f3c7c
update doc + update comments
jack2game Oct 18, 2023
573a3bc
Retire tilt.cpp. Tilt will not overwrite LS/RS in AnalogMod therefore…
jack2game Oct 19, 2023
8256559
Retire tilt.cpp. Tilt will not overwrite LS/RS in AnalogMod therefore…
jack2game Oct 19, 2023
ebb236d
Reflecting Changes in #585, updating the Tilt1+Tilt2 and Rotate1+Rota…
jack2game Oct 19, 2023
e48a7b8
Added First Win SOCD mode
jack2game Oct 19, 2023
2af3f78
Updating All Gamepad MID Macros to use our mid-function (#583)
jack2game Oct 19, 2023
32acbd4
Merge branch 'OpenStickCommunity-main' into Rotation
jack2game Oct 19, 2023
2de575d
remove junk in configs/Pico/BoardConfig.h
jack2game Oct 19, 2023
6818e85
Separate SOCD for LS and RS
jack2game Oct 19, 2023
2e90257
Better trigonometry + more rotation
jack2game Oct 19, 2023
b12cd72
Update analogmod.md
jack2game Oct 19, 2023
8ea273d
Update BoardConfig.h
jack2game Oct 19, 2023
f1b1da5
Update BoardConfig.h
jack2game Oct 19, 2023
b783c8f
Update add-ons.md, remove Tilt
jack2game Oct 19, 2023
ae19c25
update _sidebar.md + config_utils.cpp
jack2game Oct 19, 2023
c26889f
Merge branch 'OpenStickCommunity:main' into Rotation (#7)
jack2game Oct 20, 2023
0ba1326
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 20, 2023
3dbb341
update proto/config.proto + doc
jack2game Oct 20, 2023
d6f31b4
Indentation
jack2game Oct 20, 2023
95c5a4a
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 23, 2023
cde4a9a
Merge branch 'OpenStickCommunity:main' into Rotation
jack2game Oct 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ src/addons/input_macro.cpp
src/addons/snes_input.cpp
src/gamepad/GamepadDebouncer.cpp
src/gamepad/GamepadDescriptors.cpp
src/addons/tilt.cpp
src/addons/analogmod.cpp
${PROTO_OUTPUT_DIR}/enums.pb.c
${PROTO_OUTPUT_DIR}/config.pb.c
)
Expand Down
40 changes: 27 additions & 13 deletions configs/Pico/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,27 +238,41 @@
#define DUAL_DIRECTIONAL_STICK_MODE DPAD_MODE_DIGITAL
#define DUAL_DIRECTIONAL_COMBINE_MODE DUAL_COMBINE_MODE_MIXED

// TILTAdd-on Options
// ANALOGMOD Add-on Options
#define PIN_TILT_1 -1
#define TILT1_FACTOR_LEFT_X 35 //Default value for the TILT button to function.
#define TILT1_FACTOR_LEFT_Y 35 //Default value for the TILT button to function.
#define TILT1_FACTOR_LEFT_Y 35 //Default value for the TILT button to function.
#define TILT1_FACTOR_RIGHT_X 35 //Default value for the TILT button to function.
#define TILT1_FACTOR_RIGHT_Y 35 //Default value for the TILT button to function.
#define TILT1_FACTOR_RIGHT_Y 35 //Default value for the TILT button to function.
#define PIN_TILT_2 -1
#define TILT2_FACTOR_LEFT_X 65 //Default value for the TILT button to function.
#define TILT2_FACTOR_LEFT_Y 65 //Default value for the TILT button to function.
#define TILT2_FACTOR_RIGHT_X 65 //Default value for the TILT button to function.
#define TILT2_FACTOR_RIGHT_Y 65 //Default value for the TILT button to function.
#define PIN_TILT_FUNCTION -1
#define PIN_TILT_LEFT_ANALOG_UP -1
#define PIN_TILT_LEFT_ANALOG_DOWN -1
#define PIN_TILT_LEFT_ANALOG_LEFT -1
#define PIN_TILT_LEFT_ANALOG_RIGHT -1
#define PIN_TILT_RIGHT_ANALOG_UP -1
#define PIN_TILT_RIGHT_ANALOG_DOWN -1
#define PIN_TILT_RIGHT_ANALOG_LEFT -1
#define PIN_TILT_RIGHT_ANALOG_RIGHT -1
#define TILT_SOCD_MODE SOCD_MODE_NEUTRAL
#define PIN_ANALOGMOD_LEFT_ANALOG_UP -1
#define PIN_ANALOGMOD_LEFT_ANALOG_DOWN -1
#define PIN_ANALOGMOD_LEFT_ANALOG_LEFT -1
#define PIN_ANALOGMOD_LEFT_ANALOG_RIGHT -1
#define PIN_ANALOGMOD_RIGHT_ANALOG_UP -1
#define PIN_ANALOGMOD_RIGHT_ANALOG_DOWN -1
#define PIN_ANALOGMOD_RIGHT_ANALOG_LEFT -1
#define PIN_ANALOGMOD_RIGHT_ANALOG_RIGHT -1
#define PIN_ROTATE_1 -1
#define PIN_ROTATE_2 -1
#define ROTATE1_FACTOR_LEFT 15 //Default value for the ROTATE button to function.
#define ROTATE2_FACTOR_LEFT 345 //Default value for the ROTATE button to function.
#define ROTATE3_FACTOR_LEFT 0 //Default value for the ROTATE button to function.
#define ROTATE4_FACTOR_LEFT 0 //Default value for the ROTATE button to function.
#define ROTATE5_FACTOR_LEFT 0 //Default value for the ROTATE button to function.
#define ROTATE6_FACTOR_LEFT 0 //Default value for the ROTATE button to function.
#define ROTATE1_FACTOR_RIGHT 15 //Default value for the ROTATE button to function.
#define ROTATE2_FACTOR_RIGHT 345 //Default value for the ROTATE button to function.
#define ROTATE3_FACTOR_RIGHT 0 //Default value for the ROTATE button to function.
#define ROTATE4_FACTOR_RIGHT 0 //Default value for the ROTATE button to function.
#define ROTATE5_FACTOR_RIGHT 0 //Default value for the ROTATE button to function.
#define ROTATE6_FACTOR_RIGHT 0 //Default value for the ROTATE button to function.
#define ANALOGMOD_LEFT_SOCD_MODE SOCD_MODE_NEUTRAL
#define ANALOGMOD_RIGHT_SOCD_MODE SOCD_MODE_NEUTRAL

// BOOTSEL Button Add-on setting
#define BOOTSEL_BUTTON_MASK 0 // 0 means none, get other mask from GamepadState.h
Expand Down
2 changes: 1 addition & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
- [PS4 Mode](add-ons/ps4-mode.md)
- [SNES Input](add-ons/snes-input.md)
- [SOCD Selection Slider](add-ons/socd-selection-slider.md)
- [Tilt Input](add-ons/tilt-input.md)
- [Analog Modification Input](add-ons/analogmod.md)
- [Turbo](add-ons/turbo.md)
- [USB Host Based Add-ons](add-ons/usb-host-based-add-ons.md)
- [PS Passthrough](add-ons/ps-passthrough.md)
Expand Down
4 changes: 2 additions & 2 deletions docs/add-ons.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This section is for custom add-ons that can be enabled to expand the functionali
## Available Add-ons

- [Analog](add-ons/analog.md)
- [Analog Modification Input](add-ons/analogmod.md)
- [BOOTSEL Button Configuration](add-ons/bootsel-button.md)
- [Buzzer Speaker](add-ons/buzzer-speaker.md)
- [Dual Directional Input](add-ons/dual-direction-input.md)
Expand All @@ -18,9 +19,8 @@ This section is for custom add-ons that can be enabled to expand the functionali
- [PS4 Mode](add-ons/ps4-mode.md)
- [SNES Input](add-ons/snes-input.md)
- [SOCD Selection Slider](add-ons/socd-selection-slider.md)
- [Tilt Input](add-ons/tilt-input.md)
- [Turbo](add-ons/turbo.md)
- [USB Host Based Add-ons](add-ons/usb-host-based-add-ons.md)
- [PS Passthrough](add-ons/ps-passthrough.md)
- [Keyboard Host Configuration](add-ons/keyboard-host.md)
- [Wii Extensions](add-ons/wii-extensions.md)
- [Wii Extensions](add-ons/wii-extensions.md)
78 changes: 78 additions & 0 deletions docs/add-ons/analogmod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Analog Modification Input

![GP2040-CE Configuration - Add-Ons Tilt Input](../assets/images/gpc-add-ons-analogmod.png)

## Dedicated Analog Stick Pins
User can set dedicated analog stick pins to work with Tilt and Rotate features.
If no dedicated analog stick pins are set, Tilt and Rotate features will function when DPad is used as Left or Right Analog.
Otherwise, dedicated analog stick pins will have priority over DPad used as left or right analog sticks
* `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.

## Tilt
Tilt 1 and Tilt 2 buttons, when pressed with directional buttons, adjust the analog values.
Pressing Tilt 1 or 2 with a value of N results in an input that is N% of the maximum direction. (Min. 0, Max. 100)
Pressing Tilt 1 and Tilt 2 simultaneously with LS or RS directional buttons will make them function as the D-Pad.

* `Tilt 1 Pin` - The GPIO pin used for the Tilt 1.
* `Tilt 2 Pin` - The GPIO pin used for the Tilt 2.
* `Tilt 1 Factor Left X` - The percentage of the X-axis input for the Left Stick when pressing Tilt 1.
* `Tilt 1 Factor Left Y` - The percentage of the Y-axis input for the Left Stick when pressing Tilt 1.
* `Tilt 2 Factor Left X` - The percentage of the X-axis input for the Left Stick when pressing Tilt 2.
* `Tilt 2 Factor Left Y` - The percentage of the Y-axis input for the Left Stick when pressing Tilt 2.
* `Tilt 1 Factor Right X` - The percentage of the X-axis input for the Right Stick when pressing Tilt 1.
* `Tilt 1 Factor Right Y` - The percentage of the Y-axis input for the Right Stick when pressing Tilt 1.
* `Tilt 2 Factor Right X` - The percentage of the X-axis input for the Right Stick when pressing Tilt 2.
* `Tilt 2 Factor Right Y` - The percentage of the Y-axis input for the Right Stick when pressing Tilt 2.

## Rotate
Rotate 1 and Rotate 2 buttons, when pressed with directional buttons, adjust the analog values.
All Rotate functions will make analog sticks rotate clockwise by the set degree. (Min. 0, Max. 360)
Pressing Rotate 1 and Rotate 2 simultaneously with LS or RS directional buttons will make them function as the D-Pad.
* `Rotate 1 Pin` - The GPIO pin used for the Rotate 1.
* `Rotate 2 Pin` - The GPIO pin used for the Rotate 2.
* `Rotate 1 Degree Left` - Clockwise rotate degree for Left Stick when pressing Rotate 1
* `Rotate 2 Degree Left` - Clockwise rotate degree for Left Stick when pressing Rotate 2
* `Rotate 3 Degree Left` - Clockwise rotate degree for Left Stick when pressing Rotate 1 + Tilt 1
* `Rotate 4 Degree Left` - Clockwise rotate degree for Left Stick when pressing Rotate 1 + Tilt 2
* `Rotate 5 Degree Left` - Clockwise rotate degree for Left Stick when pressing Rotate 2 + Tilt 1
* `Rotate 6 Degree Left` - Clockwise rotate degree for Left Stick when pressing Rotate 2 + Tilt 2
* `Rotate 1 Degree Right` - Clockwise rotate degree for Right Stick when pressing Rotate 1
* `Rotate 2 Degree Right` - Clockwise rotate degree for Right Stick when pressing Rotate 2
* `Rotate 3 Degree Right` - Clockwise rotate degree for Right Stick when pressing Rotate 1 + Tilt 1
* `Rotate 4 Degree Right` - Clockwise rotate degree for Right Stick when pressing Rotate 1 + Tilt 2
* `Rotate 5 Degree Right` - Clockwise rotate degree for Right Stick when pressing Rotate 2 + Tilt 1
* `Rotate 6 Degree Right` - Clockwise rotate degree for Right Stick when pressing Rotate 2 + Tilt 2

## SOCD
SOCD Cleaning Mode can be separately set for LS and RS. (Up Priority, Neutral, Last Win, First Win)
* `Analog Mod Left Stick SOCD Mode` - Choose the SOCD Cleaning Mode for Left Stick.
* `Analog Mod Right Stick SOCD Mode` - Choose the SOCD Cleaning Mode for Right Stick.

## Summary of Analog Mod Add-On
The table below provides a summary of all functions offered by Analog Mod.
`X` = button is pressed; `-` = button is not pressed
| Tilt1 | Tilt2 | Rotate1 | Rotate2 | | LS Behavior | RS Behavior |
|:-----:|:-----:|:-------:|:-------:|:-:|:-----------:|:-----------:|
| X | - | - | - | ⇨ | Tilt1 | Tilt1 |
| - | X | - | - | ⇨ | Tilt2 | Tilt2 |
| - | - | X | - | ⇨ | Rotate1 | Rotate1 |
| - | - | - | X | ⇨ | Rotate2 | Rotate2 |
| X | X | - | - | ⇨ | D-Pad | D-Pad |
| - | - | X | X | ⇨ | D-Pad | D-Pad |
| X | - | X | - | ⇨ | Rotate3 | Rotate3 |
| - | X | X | - | ⇨ | Rotate4 | Rotate4 |
| X | - | - | X | ⇨ | Rotate5 | Rotate5 |
| - | X | - | X | ⇨ | Rotate6 | Rotate6 |
| X | X | X | - | ⇨ | LS | RS |
| X | X | - | X | ⇨ | LS | RS |
| X | - | X | X | ⇨ | LS | RS |
| - | X | X | X | ⇨ | LS | RS |
| X | X | X | X | ⇨ | LS | RS |
| - | - | - | - | ⇨ | LS | RS |
36 changes: 0 additions & 36 deletions docs/add-ons/tilt-input.md

This file was deleted.

Binary file added docs/assets/images/gpc-add-ons-analogmod.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/assets/images/gpc-add-ons-tilt.png
Binary file not shown.
Loading