Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Main: Add ability to invert right stick Y-axis
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryzee119 committed Jan 9, 2021
1 parent 73a1a9b commit 82ac785
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Firmware/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,24 @@ int main(void)
XboxOGDuke[i].leftStickX = getAnalogHat(LeftHatX, i);
XboxOGDuke[i].leftStickY = getAnalogHat(LeftHatY, i);
XboxOGDuke[i].rightStickX = getAnalogHat(RightHatX, i);
XboxOGDuke[i].rightStickY = getAnalogHat(RightHatY, i);

//Press the right stick in and BACK to toggle right stick Y-axis inverstion.
static int astick_invert_tgle[4] = {0};
static int astick_invert_old[4] = {0};
if (astick_invert_tgle[i])
XboxOGDuke[i].rightStickY = -getAnalogHat(RightHatY, i) - 1;
else
XboxOGDuke[i].rightStickY = getAnalogHat(RightHatY, i);

if (getButtonPress(BACK, i) && getButtonPress(R3, i))
{
XboxOGDuke[i].dButtons &= ~BACK_BTN;
(astick_invert_tgle[i] == astick_invert_old[i]) ? (astick_invert_tgle[i] ^= 1) : 1;
}
else
{
astick_invert_old[i] = astick_invert_tgle[i];
}
}
#ifdef SUPPORTBATTALION
//Button Mapping for Steel Battalion Controller - only applicable for player 1 and Xbox 360 Wireless Controllers
Expand Down

0 comments on commit 82ac785

Please sign in to comment.