This commit is contained in:
mika-n 2019-12-28 21:51:05 +02:00
commit 1d637005cb
2 changed files with 7 additions and 4 deletions

View File

@ -529,7 +529,8 @@ namespace DS4Windows
sixAxis.setCalibrationData(ref calibration, conType == ConnectionType.USB);
if ((hDevice.Attributes.ProductId == 0x5C4 && hDevice.Attributes.VendorId == 0x054C) && sixAxis.fixupInvertedGyroAxis())
if (hDevice.Attributes.ProductId == 0x5C4 && hDevice.Attributes.VendorId == 0x054C &&
sixAxis.fixupInvertedGyroAxis())
AppLogger.LogToGui($"Automatically fixed inverted YAW gyro axis in DS4 v.1 BT gamepad ({Mac.ToString()})", false);
}
else

View File

@ -258,14 +258,16 @@ namespace DS4Windows
public bool fixupInvertedGyroAxis()
{
bool result = false;
// Some, not all, DS4 rev1 gamepads have an inverted YAW gyro axis calibration value (sensNumber>0 but at the same time sensDenom value is <0 while other two axies have both attributes >0).
// If this gamepad has YAW calibration with weird mixed values then fix it automatically to workaround inverted YAW axis problem.
if ((calibrationData[1].sensNumer > 0 && calibrationData[1].sensDenom < 0) && calibrationData[0].sensDenom > 0 && calibrationData[2].sensDenom > 0)
if (calibrationData[1].sensNumer > 0 && calibrationData[1].sensDenom < 0 &&
calibrationData[0].sensDenom > 0 && calibrationData[2].sensDenom > 0)
{
calibrationData[1].sensDenom *= -1;
return true; // Fixed inverted axis
result = true; // Fixed inverted axis
}
return false; // No need to fix anything
return result;
}
}