Skip to content

Commit

Permalink
switch midpoint fix
Browse files Browse the repository at this point in the history
Fix the bad midpoint, from 16 to 8 bit conversion, on analogs for Switch mode. Tested on Switch to be it's true center.
  • Loading branch information
NickGuyver committed Sep 13, 2024
1 parent 6b7552c commit 972b130
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/drivers/switch/SwitchDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ void SwitchDriver::process(Gamepad * gamepad, uint8_t * outBuffer) {
| (gamepad->pressedA2() ? SWITCH_MASK_CAPTURE : 0)
;

switchReport.lx = static_cast<uint8_t>(gamepad->state.lx >> 8);
switchReport.ly = static_cast<uint8_t>(gamepad->state.ly >> 8);
switchReport.rx = static_cast<uint8_t>(gamepad->state.rx >> 8);
switchReport.ry = static_cast<uint8_t>(gamepad->state.ry >> 8);
switchReport.lx = static_cast<uint8_t>((gamepad->state.ry + 128) >> 8);
switchReport.ly = static_cast<uint8_t>((gamepad->state.ry + 128) >> 8);
switchReport.rx = static_cast<uint8_t>((gamepad->state.ry + 128) >> 8);
switchReport.ry = static_cast<uint8_t>((gamepad->state.ry + 128) >> 8);

// Wake up TinyUSB device
if (tud_suspended())
Expand Down

0 comments on commit 972b130

Please sign in to comment.