Merge branch 'jay' of https://github.com/mika-n/DS4Windows into mika-n-jay

This commit is contained in:
Travis Nickles 2019-12-28 13:26:09 -06:00
commit 3167c3917f
3 changed files with 17 additions and 1 deletions

View File

@ -66,7 +66,7 @@ namespace DS4Windows
// Custom definition set by DS4Windows options screens. This string is not validated (ie. the value is as user entered it and could be an invalid curve definition). This value is saved in a profile XML file.
public string CustomDefinition { get; set; }
public string ToString() { return this.CustomDefinition; }
public override string ToString() { return this.CustomDefinition; }
public AxisType axisType; // Axis type of curve object (LS/RS/R2/L2/SA)
private double axisMaxDouble; // Max range of axis (range of positive values)

View File

@ -528,6 +528,9 @@ namespace DS4Windows
}
sixAxis.setCalibrationData(ref calibration, conType == ConnectionType.USB);
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

@ -255,5 +255,18 @@ namespace DS4Windows
}
}
}
public bool fixupInvertedGyroAxis()
{
// 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)
{
calibrationData[1].sensDenom *= -1;
return true; // Fixed inverted axis
}
return false; // No need to fix anything
}
}
}