mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-27 03:24:20 +01:00
Tweaks to how imu data is used
This commit is contained in:
parent
887a4fbdbd
commit
dba2b1bbb3
@ -90,13 +90,13 @@ namespace DS4Windows
|
|||||||
buttons[(int)DS4Controls.TouchUpper] = tp != null ? (!priorMouse ? tp.upperDown : tp.priorUpperDown) : false;
|
buttons[(int)DS4Controls.TouchUpper] = tp != null ? (!priorMouse ? tp.upperDown : tp.priorUpperDown) : false;
|
||||||
buttons[(int)DS4Controls.TouchMulti] = tp != null ? (!priorMouse ? tp.multiDown : tp.priorMultiDown) : false;
|
buttons[(int)DS4Controls.TouchMulti] = tp != null ? (!priorMouse ? tp.multiDown : tp.priorMultiDown) : false;
|
||||||
|
|
||||||
int gyroX = exposeState.getAccelX();
|
int sixAxisX = -exposeState.getAccelX();
|
||||||
gryodirs[(int)DS4Controls.GyroXPos] = gyroX > 0 ? gyroX : 0;
|
gryodirs[(int)DS4Controls.GyroXPos] = sixAxisX > 0 ? sixAxisX : 0;
|
||||||
gryodirs[(int)DS4Controls.GyroXNeg] = gyroX < 0 ? gyroX : 0;
|
gryodirs[(int)DS4Controls.GyroXNeg] = sixAxisX < 0 ? sixAxisX : 0;
|
||||||
|
|
||||||
int gyroZ = exposeState.getAccelZ();
|
int sixAxisZ = exposeState.getAccelZ();
|
||||||
gryodirs[(int)DS4Controls.GyroZPos] = gyroZ > 0 ? gyroZ : 0;
|
gryodirs[(int)DS4Controls.GyroZPos] = sixAxisZ > 0 ? sixAxisZ : 0;
|
||||||
gryodirs[(int)DS4Controls.GyroZNeg] = gyroZ < 0 ? gyroZ : 0;
|
gryodirs[(int)DS4Controls.GyroZNeg] = sixAxisZ < 0 ? sixAxisZ : 0;
|
||||||
|
|
||||||
swipedirs[(int)DS4Controls.SwipeLeft] = tp != null ? (!priorMouse ? tp.swipeLeftB : tp.priorSwipeLeftB): (byte)0;
|
swipedirs[(int)DS4Controls.SwipeLeft] = tp != null ? (!priorMouse ? tp.swipeLeftB : tp.priorSwipeLeftB): (byte)0;
|
||||||
swipedirs[(int)DS4Controls.SwipeRight] = tp != null ? (!priorMouse ? tp.swipeRightB : tp.priorSwipeRightB) : (byte)0;
|
swipedirs[(int)DS4Controls.SwipeRight] = tp != null ? (!priorMouse ? tp.swipeRightB : tp.priorSwipeRightB) : (byte)0;
|
||||||
|
@ -2760,13 +2760,13 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
case DS4Controls.GyroXPos:
|
case DS4Controls.GyroXPos:
|
||||||
{
|
{
|
||||||
int gyroX = eState.AccelX;
|
int gyroX = -eState.AccelX;
|
||||||
result = (byte)(!sOff && sxsens * gyroX > SXD * 10 ? Math.Min(255, sxsens * gyroX * 2) : 0);
|
result = (byte)(!sOff && sxsens * gyroX > SXD * 10 ? Math.Min(255, sxsens * gyroX * 2) : 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DS4Controls.GyroXNeg:
|
case DS4Controls.GyroXNeg:
|
||||||
{
|
{
|
||||||
int gyroX = eState.AccelX;
|
int gyroX = -eState.AccelX;
|
||||||
result = (byte)(!sOff && sxsens * gyroX < -SXD * 10 ? Math.Min(255, sxsens * -gyroX * 2) : 0);
|
result = (byte)(!sOff && sxsens * gyroX < -SXD * 10 ? Math.Min(255, sxsens * -gyroX * 2) : 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2882,8 +2882,8 @@ namespace DS4Windows
|
|||||||
|
|
||||||
switch (control)
|
switch (control)
|
||||||
{
|
{
|
||||||
case DS4Controls.GyroXPos: result = !sOff ? SXSens[device] * eState.AccelX > 67 : false; break;
|
case DS4Controls.GyroXPos: result = !sOff ? SXSens[device] * -eState.AccelX > 67 : false; break;
|
||||||
case DS4Controls.GyroXNeg: result = !sOff ? SXSens[device] * eState.AccelX < -67 : false; break;
|
case DS4Controls.GyroXNeg: result = !sOff ? SXSens[device] * -eState.AccelX < -67 : false; break;
|
||||||
case DS4Controls.GyroZPos: result = !sOff ? SZSens[device] * eState.AccelZ > 67 : false; break;
|
case DS4Controls.GyroZPos: result = !sOff ? SZSens[device] * eState.AccelZ > 67 : false; break;
|
||||||
case DS4Controls.GyroZNeg: result = !sOff ? SZSens[device] * eState.AccelZ < -67 : false; break;
|
case DS4Controls.GyroZNeg: result = !sOff ? SZSens[device] * eState.AccelZ < -67 : false; break;
|
||||||
default: break;
|
default: break;
|
||||||
@ -3548,18 +3548,18 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
case DS4Controls.GyroXPos:
|
case DS4Controls.GyroXPos:
|
||||||
{
|
{
|
||||||
if (!sOff && eState.AccelX > SXD * 10)
|
if (!sOff && -eState.AccelX > SXD * 10)
|
||||||
{
|
{
|
||||||
if (alt) result = (byte)Math.Min(255, 127 + SXSens[device] * eState.AccelX); else result = (byte)Math.Max(0, 127 - SXSens[device] * eState.AccelX);
|
if (alt) result = (byte)Math.Min(255, 127 + SXSens[device] * -eState.AccelX); else result = (byte)Math.Max(0, 127 - SXSens[device] * -eState.AccelX);
|
||||||
}
|
}
|
||||||
else result = falseVal;
|
else result = falseVal;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DS4Controls.GyroXNeg:
|
case DS4Controls.GyroXNeg:
|
||||||
{
|
{
|
||||||
if (!sOff && eState.AccelX < -SXD * 10)
|
if (!sOff && -eState.AccelX < -SXD * 10)
|
||||||
{
|
{
|
||||||
if (alt) result = (byte)Math.Min(255, 127 + SXSens[device] * -eState.AccelX); else result = (byte)Math.Max(0, 127 - SXSens[device] * -eState.AccelX);
|
if (alt) result = (byte)Math.Min(255, 127 + SXSens[device] * eState.AccelX); else result = (byte)Math.Max(0, 127 - SXSens[device] * eState.AccelX);
|
||||||
}
|
}
|
||||||
else result = falseVal;
|
else result = falseVal;
|
||||||
break;
|
break;
|
||||||
|
@ -21,7 +21,7 @@ namespace DS4Windows
|
|||||||
private double GYRO_MOUSE_COEFFICIENT = 0.0095;
|
private double GYRO_MOUSE_COEFFICIENT = 0.0095;
|
||||||
private int GYRO_MOUSE_DEADZONE = 12;
|
private int GYRO_MOUSE_DEADZONE = 12;
|
||||||
private double GYRO_MOUSE_OFFSET = 0.1463;
|
private double GYRO_MOUSE_OFFSET = 0.1463;
|
||||||
private double GYRO_SMOOTH_MOUSE_OFFSET = 0.14698;
|
private double GYRO_SMOOTH_MOUSE_OFFSET = 0.14695;
|
||||||
|
|
||||||
private const int SMOOTH_BUFFER_LEN = 3;
|
private const int SMOOTH_BUFFER_LEN = 3;
|
||||||
private double[] xSmoothBuffer = new double[SMOOTH_BUFFER_LEN];
|
private double[] xSmoothBuffer = new double[SMOOTH_BUFFER_LEN];
|
||||||
@ -41,7 +41,7 @@ namespace DS4Windows
|
|||||||
deltaX = Global.getGyroMouseHorizontalAxis(deviceNumber) == 0 ? arg.sixAxis.gyroYawFull :
|
deltaX = Global.getGyroMouseHorizontalAxis(deviceNumber) == 0 ? arg.sixAxis.gyroYawFull :
|
||||||
arg.sixAxis.gyroRollFull;
|
arg.sixAxis.gyroRollFull;
|
||||||
deltaY = -arg.sixAxis.gyroPitchFull;
|
deltaY = -arg.sixAxis.gyroPitchFull;
|
||||||
tempDouble = arg.sixAxis.elapsed * 0.001 * 250.0;
|
tempDouble = arg.sixAxis.elapsed * 0.001 * 250.0; // Base default speed on 4 ms
|
||||||
|
|
||||||
gyroSmooth = Global.getGyroSmoothing(deviceNumber);
|
gyroSmooth = Global.getGyroSmoothing(deviceNumber);
|
||||||
double gyroSmoothWeight = 0.0;
|
double gyroSmoothWeight = 0.0;
|
||||||
|
@ -805,8 +805,8 @@ namespace DS4Windows
|
|||||||
SetDynamicTrackBarValue(tBsixaxisGyroX, (exposeState.GyroYaw + tBsixaxisGyroX.Value * 2) / 3);
|
SetDynamicTrackBarValue(tBsixaxisGyroX, (exposeState.GyroYaw + tBsixaxisGyroX.Value * 2) / 3);
|
||||||
SetDynamicTrackBarValue(tBsixaxisGyroY, (exposeState.GyroPitch + tBsixaxisGyroY.Value * 2) / 3);
|
SetDynamicTrackBarValue(tBsixaxisGyroY, (exposeState.GyroPitch + tBsixaxisGyroY.Value * 2) / 3);
|
||||||
SetDynamicTrackBarValue(tBsixaxisGyroZ, (exposeState.GyroRoll + tBsixaxisGyroZ.Value * 2) / 3);
|
SetDynamicTrackBarValue(tBsixaxisGyroZ, (exposeState.GyroRoll + tBsixaxisGyroZ.Value * 2) / 3);
|
||||||
SetDynamicTrackBarValue(tBsixaxisAccelX, (-exposeState.AccelX + tBsixaxisAccelX.Value * 2) / 3);
|
SetDynamicTrackBarValue(tBsixaxisAccelX, (exposeState.AccelX + tBsixaxisAccelX.Value * 2) / 3);
|
||||||
SetDynamicTrackBarValue(tBsixaxisAccelY, (-exposeState.AccelY + tBsixaxisAccelY.Value * 2) / 3);
|
SetDynamicTrackBarValue(tBsixaxisAccelY, (exposeState.AccelY + tBsixaxisAccelY.Value * 2) / 3);
|
||||||
SetDynamicTrackBarValue(tBsixaxisAccelZ, (exposeState.AccelZ + tBsixaxisAccelZ.Value * 2) / 3);
|
SetDynamicTrackBarValue(tBsixaxisAccelZ, (exposeState.AccelZ + tBsixaxisAccelZ.Value * 2) / 3);
|
||||||
|
|
||||||
int x = baseState.LX;
|
int x = baseState.LX;
|
||||||
@ -899,7 +899,7 @@ namespace DS4Windows
|
|||||||
(int)(tempRSS * (btnRSTrack.Location.Y - pnlRSTrack.Size.Height / 2f) + pnlRSTrack.Size.Height / 2f));
|
(int)(tempRSS * (btnRSTrack.Location.Y - pnlRSTrack.Size.Height / 2f) + pnlRSTrack.Size.Height / 2f));
|
||||||
}
|
}
|
||||||
|
|
||||||
x = -exposeState.AccelX + 127;
|
x = exposeState.AccelX + 127;
|
||||||
y = exposeState.AccelZ + 127;
|
y = exposeState.AccelZ + 127;
|
||||||
btnSATrack.Location = new Point((int)(dpix * Global.Clamp(0, x / 2.09, pnlSATrack.Size.Width)), (int)(dpiy * Global.Clamp(0, y / 2.09, pnlSATrack.Size.Height)));
|
btnSATrack.Location = new Point((int)(dpix * Global.Clamp(0, x / 2.09, pnlSATrack.Size.Width)), (int)(dpiy * Global.Clamp(0, y / 2.09, pnlSATrack.Size.Height)));
|
||||||
|
|
||||||
|
@ -23,18 +23,18 @@ namespace DS4Windows
|
|||||||
public readonly SixAxis previousAxis = null;
|
public readonly SixAxis previousAxis = null;
|
||||||
public SixAxis(int X, int Y, int Z, int aX, int aY, int aZ, double milliseconds, SixAxis prevAxis = null)
|
public SixAxis(int X, int Y, int Z, int aX, int aY, int aZ, double milliseconds, SixAxis prevAxis = null)
|
||||||
{
|
{
|
||||||
gyroX = X / 256;
|
gyroX = -X / 256;
|
||||||
gyroY = Y / 256;
|
gyroY = Y / 256;
|
||||||
gyroZ = Z / 256;
|
gyroZ = -Z / 256;
|
||||||
gyroYawFull = -X;
|
gyroYawFull = -X;
|
||||||
gyroPitchFull = Y;
|
gyroPitchFull = Y;
|
||||||
gyroRollFull = -Z;
|
gyroRollFull = -Z;
|
||||||
|
|
||||||
accelX = aX / 64;
|
accelX = -aX / 64;
|
||||||
accelY = aY / 64;
|
accelY = -aY / 64;
|
||||||
accelZ = aZ / 64;
|
accelZ = aZ / 64;
|
||||||
accelXFull = aX;
|
accelXFull = -aX;
|
||||||
accelYFull = aY;
|
accelYFull = -aY;
|
||||||
accelZFull = aZ;
|
accelZFull = aZ;
|
||||||
elapsed = milliseconds;
|
elapsed = milliseconds;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ namespace DS4Windows
|
|||||||
LYUnit = 0.0;
|
LYUnit = 0.0;
|
||||||
RXUnit = 0.0;
|
RXUnit = 0.0;
|
||||||
RYUnit = 0.0;
|
RYUnit = 0.0;
|
||||||
Motion = null;
|
Motion = new SixAxis(0, 0, 0, 0, 0, 0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DS4State(DS4State state)
|
public DS4State(DS4State state)
|
||||||
|
@ -43,9 +43,9 @@ namespace DS4Windows
|
|||||||
byte R2 { get { return _state.R2; } }
|
byte R2 { get { return _state.R2; } }
|
||||||
int Battery { get { return _state.Battery; } }
|
int Battery { get { return _state.Battery; } }
|
||||||
|
|
||||||
public int GyroYaw { get { return -_state.Motion.gyroX; } }
|
public int GyroYaw { get { return _state.Motion.gyroX; } }
|
||||||
public int GyroPitch { get { return _state.Motion.gyroY; } }
|
public int GyroPitch { get { return _state.Motion.gyroY; } }
|
||||||
public int GyroRoll { get { return -_state.Motion.gyroZ; } }
|
public int GyroRoll { get { return _state.Motion.gyroZ; } }
|
||||||
|
|
||||||
public int AccelX { get { return _state.Motion.accelX; } }
|
public int AccelX { get { return _state.Motion.accelX; } }
|
||||||
public int getAccelX()
|
public int getAccelX()
|
||||||
|
Loading…
Reference in New Issue
Block a user