From 12b2466111f7e8ccfe20d6a88f9d2c2e30067a08 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Sat, 28 Dec 2019 13:38:16 -0600 Subject: [PATCH] Minor tweak for VS --- DS4Windows/DS4Library/DS4Device.cs | 3 ++- DS4Windows/DS4Library/DS4Sixaxis.cs | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/DS4Windows/DS4Library/DS4Device.cs b/DS4Windows/DS4Library/DS4Device.cs index a9d33ed..f5b7b77 100644 --- a/DS4Windows/DS4Library/DS4Device.cs +++ b/DS4Windows/DS4Library/DS4Device.cs @@ -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 diff --git a/DS4Windows/DS4Library/DS4Sixaxis.cs b/DS4Windows/DS4Library/DS4Sixaxis.cs index 17a284b..f1c4f0b 100644 --- a/DS4Windows/DS4Library/DS4Sixaxis.cs +++ b/DS4Windows/DS4Library/DS4Sixaxis.cs @@ -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; } }