mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 11:04:21 +01:00
Fix reading calibration report values. Take connection type into account
This commit is contained in:
parent
d1e0be33de
commit
3a09132805
@ -452,7 +452,7 @@ namespace DS4Windows
|
||||
byte[] calibration = new byte[41];
|
||||
calibration[0] = conType == ConnectionType.BT ? (byte)0x05 : (byte)0x02;
|
||||
hDevice.readFeatureData(calibration);
|
||||
sixAxis.setCalibrationData(ref calibration);
|
||||
sixAxis.setCalibrationData(ref calibration, conType == ConnectionType.USB);
|
||||
}
|
||||
|
||||
private void timeoutTestThread()
|
||||
|
@ -123,7 +123,7 @@ namespace DS4Windows
|
||||
}
|
||||
|
||||
int temInt = 0;
|
||||
public void setCalibrationData(ref byte[] calibData)
|
||||
public void setCalibrationData(ref byte[] calibData, bool fromUSB)
|
||||
{
|
||||
int pitchPlus, pitchMinus, yawPlus, yawMinus, rollPlus, rollMinus,
|
||||
accelXPlus, accelXMinus, accelYPlus, accelYMinus, accelZPlus, accelZMinus,
|
||||
@ -133,7 +133,7 @@ namespace DS4Windows
|
||||
calibrationData[1].bias = (short)((ushort)(calibData[4] << 8) | calibData[3]);
|
||||
calibrationData[2].bias = (short)((ushort)(calibData[6] << 8) | calibData[5]);
|
||||
|
||||
if (calibData[0] == 5)
|
||||
if (!fromUSB)
|
||||
{
|
||||
pitchPlus = temInt = (short)((ushort)(calibData[8] << 8) | calibData[7]);
|
||||
yawPlus = temInt = (short)((ushort)(calibData[10] << 8) | calibData[9]);
|
||||
@ -145,10 +145,10 @@ namespace DS4Windows
|
||||
else
|
||||
{
|
||||
pitchPlus = temInt = (short)((ushort)(calibData[8] << 8) | calibData[7]);
|
||||
yawPlus = temInt = (short)((ushort)(calibData[10] << 8) | calibData[9]);
|
||||
rollPlus = temInt = (short)((ushort)(calibData[12] << 8) | calibData[11]);
|
||||
pitchMinus = temInt = (short)((ushort)(calibData[14] << 8) | calibData[13]);
|
||||
yawMinus = temInt = (short)((ushort)(calibData[16] << 8) | calibData[15]);
|
||||
pitchMinus = temInt = (short)((ushort)(calibData[10] << 8) | calibData[9]);
|
||||
yawPlus = temInt = (short)((ushort)(calibData[12] << 8) | calibData[11]);
|
||||
yawMinus = temInt = (short)((ushort)(calibData[14] << 8) | calibData[13]);
|
||||
rollPlus = temInt = (short)((ushort)(calibData[16] << 8) | calibData[15]);
|
||||
rollMinus = temInt = (short)((ushort)(calibData[18] << 8) | calibData[17]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user