mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-30 04:54:20 +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];
|
byte[] calibration = new byte[41];
|
||||||
calibration[0] = conType == ConnectionType.BT ? (byte)0x05 : (byte)0x02;
|
calibration[0] = conType == ConnectionType.BT ? (byte)0x05 : (byte)0x02;
|
||||||
hDevice.readFeatureData(calibration);
|
hDevice.readFeatureData(calibration);
|
||||||
sixAxis.setCalibrationData(ref calibration);
|
sixAxis.setCalibrationData(ref calibration, conType == ConnectionType.USB);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void timeoutTestThread()
|
private void timeoutTestThread()
|
||||||
|
@ -123,7 +123,7 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
int temInt = 0;
|
int temInt = 0;
|
||||||
public void setCalibrationData(ref byte[] calibData)
|
public void setCalibrationData(ref byte[] calibData, bool fromUSB)
|
||||||
{
|
{
|
||||||
int pitchPlus, pitchMinus, yawPlus, yawMinus, rollPlus, rollMinus,
|
int pitchPlus, pitchMinus, yawPlus, yawMinus, rollPlus, rollMinus,
|
||||||
accelXPlus, accelXMinus, accelYPlus, accelYMinus, accelZPlus, accelZMinus,
|
accelXPlus, accelXMinus, accelYPlus, accelYMinus, accelZPlus, accelZMinus,
|
||||||
@ -133,7 +133,7 @@ namespace DS4Windows
|
|||||||
calibrationData[1].bias = (short)((ushort)(calibData[4] << 8) | calibData[3]);
|
calibrationData[1].bias = (short)((ushort)(calibData[4] << 8) | calibData[3]);
|
||||||
calibrationData[2].bias = (short)((ushort)(calibData[6] << 8) | calibData[5]);
|
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]);
|
pitchPlus = temInt = (short)((ushort)(calibData[8] << 8) | calibData[7]);
|
||||||
yawPlus = temInt = (short)((ushort)(calibData[10] << 8) | calibData[9]);
|
yawPlus = temInt = (short)((ushort)(calibData[10] << 8) | calibData[9]);
|
||||||
@ -145,10 +145,10 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
pitchPlus = temInt = (short)((ushort)(calibData[8] << 8) | calibData[7]);
|
pitchPlus = temInt = (short)((ushort)(calibData[8] << 8) | calibData[7]);
|
||||||
yawPlus = temInt = (short)((ushort)(calibData[10] << 8) | calibData[9]);
|
pitchMinus = temInt = (short)((ushort)(calibData[10] << 8) | calibData[9]);
|
||||||
rollPlus = temInt = (short)((ushort)(calibData[12] << 8) | calibData[11]);
|
yawPlus = temInt = (short)((ushort)(calibData[12] << 8) | calibData[11]);
|
||||||
pitchMinus = temInt = (short)((ushort)(calibData[14] << 8) | calibData[13]);
|
yawMinus = temInt = (short)((ushort)(calibData[14] << 8) | calibData[13]);
|
||||||
yawMinus = temInt = (short)((ushort)(calibData[16] << 8) | calibData[15]);
|
rollPlus = temInt = (short)((ushort)(calibData[16] << 8) | calibData[15]);
|
||||||
rollMinus = temInt = (short)((ushort)(calibData[18] << 8) | calibData[17]);
|
rollMinus = temInt = (short)((ushort)(calibData[18] << 8) | calibData[17]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user