Skip to content

Commit

Permalink
Fix accelerometer axis to have correct data for orientation (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
german77 authored Oct 6, 2020
1 parent 36346c1 commit f9f1ea4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions BetterJoyForCemu/Joycon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,13 +1005,19 @@ private void ExtractIMUValues(byte[] report_buf, int n = 0) {
if (other == null && !isPro) { // single joycon mode; Z do not swap, rest do
if (isLeft) {
acc_g.X = -acc_g.X;
acc_g.Y = -acc_g.Y;
gyr_g.X = -gyr_g.X;
} else {
gyr_g.Y = -gyr_g.Y;
}

float temp = acc_g.X; acc_g.X = acc_g.Y; acc_g.Y = temp;
temp = gyr_g.X; gyr_g.X = gyr_g.Y; gyr_g.Y = temp;
float temp = acc_g.X;
acc_g.X = acc_g.Y;
acc_g.Y = -temp;

temp = gyr_g.X;
gyr_g.X = gyr_g.Y;
gyr_g.Y = temp;
}
}
}
Expand Down

0 comments on commit f9f1ea4

Please sign in to comment.