mirror of https://github.com/encounter/SDL.git
Fixed bug 5359 - Incorrect sensor data from DualShock4
multiply gyro values by sensitivity When the hardware calibration fails, values read from sensors need to be multiplied by default sensitivity (16 for gyro, 1 for accelerometer).
This commit is contained in:
parent
c8c818d7a4
commit
e44bf8a080
|
@ -360,6 +360,8 @@ HIDAPI_DriverPS4_ApplyCalibrationData(SDL_DriverPS4_Context *ctx, int index, Sin
|
||||||
IMUCalibrationData *calibration = &ctx->calibration[index];
|
IMUCalibrationData *calibration = &ctx->calibration[index];
|
||||||
|
|
||||||
result = (value - calibration->bias) * calibration->sensitivity;
|
result = (value - calibration->bias) * calibration->sensitivity;
|
||||||
|
} else if (index < 3) {
|
||||||
|
result = value * 64.f;
|
||||||
} else {
|
} else {
|
||||||
result = value;
|
result = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,6 +331,8 @@ HIDAPI_DriverPS5_ApplyCalibrationData(SDL_DriverPS5_Context *ctx, int index, Sin
|
||||||
IMUCalibrationData *calibration = &ctx->calibration[index];
|
IMUCalibrationData *calibration = &ctx->calibration[index];
|
||||||
|
|
||||||
result = (value - calibration->bias) * calibration->sensitivity;
|
result = (value - calibration->bias) * calibration->sensitivity;
|
||||||
|
} else if (index < 3) {
|
||||||
|
result = value * 64.f;
|
||||||
} else {
|
} else {
|
||||||
result = value;
|
result = value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue