Skip to content

Commit 4d0e7b2

Browse files
committed
fixed accelerometer issue
1 parent b84955b commit 4d0e7b2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Accelerometer.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,17 @@ void Accelerometer::accelerometerRead()
181181
}
182182

183183

184-
if (priorXValue != xValue) {
185-
Gamepad1.xAxis(static_cast<int16_t>(xValue / localMax * 32767));
184+
if (priorXValue != xValue) {
185+
Gamepad1.xAxis(static_cast<int16_t>(static_cast<float>(xValue) / localMax * 32767));
186186
priorXValue = xValue;
187187
config.updateUSB = true;
188-
}
188+
}
189189

190-
if (priorYValue != yValue) {
191-
Gamepad1.yAxis(static_cast<int16_t>(yValue / localMaxY * 32767));
190+
if (priorYValue != yValue) {
191+
Gamepad1.yAxis(static_cast<int16_t>(static_cast<float>(yValue) / localMaxY * 32767));
192192
priorYValue = yValue;
193193
config.updateUSB = true;
194-
}
194+
}
195195

196196
// Serial.print(F("DEBUG,AccelX:"));
197197
// Serial.print(xValue);

0 commit comments

Comments
 (0)