mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-11 15:59:08 +01:00
Add new accel fields
This commit is contained in:
parent
2ffc51c8e3
commit
bd379e5c7e
@ -15,23 +15,35 @@ namespace DS4Windows
|
|||||||
|
|
||||||
public class SixAxis
|
public class SixAxis
|
||||||
{
|
{
|
||||||
|
public const int ACC_RES_PER_G = 8192;
|
||||||
|
private const float F_ACC_RES_PER_G = ACC_RES_PER_G;
|
||||||
|
|
||||||
public int gyroYaw, gyroPitch, gyroRoll, accelX, accelY, accelZ;
|
public int gyroYaw, gyroPitch, gyroRoll, accelX, accelY, accelZ;
|
||||||
public int outputAccelX, outputAccelY, outputAccelZ;
|
public int outputAccelX, outputAccelY, outputAccelZ;
|
||||||
|
public double accelXG, accelYG, accelZG;
|
||||||
public readonly int gyroYawFull, gyroPitchFull, gyroRollFull;
|
public readonly int gyroYawFull, gyroPitchFull, gyroRollFull;
|
||||||
public readonly int accelXFull, accelYFull, accelZFull;
|
public readonly int accelXFull, accelYFull, accelZFull;
|
||||||
public readonly byte touchID;
|
public readonly byte touchID;
|
||||||
public readonly double elapsed;
|
public readonly double elapsed;
|
||||||
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 recip = 1d / 8192d;
|
||||||
|
double tempDouble = 0d;
|
||||||
|
|
||||||
|
public SixAxis(int X, int Y, int Z,
|
||||||
|
int aX, int aY, int aZ,
|
||||||
double elapsedDelta, SixAxis prevAxis = null)
|
double elapsedDelta, SixAxis prevAxis = null)
|
||||||
{
|
{
|
||||||
gyroYaw = -X / 256;
|
gyroYaw = -X / 256;
|
||||||
gyroPitch = Y / 256;
|
gyroPitch = Y / 256;
|
||||||
gyroRoll = -Z / 256;
|
gyroRoll = -Z / 256;
|
||||||
gyroYawFull = -X;
|
|
||||||
gyroPitchFull = Y;
|
gyroYawFull = -X; gyroPitchFull = Y; gyroRollFull = -Z;
|
||||||
gyroRollFull = -Z;
|
accelXFull = -aX; accelYFull = -aY; accelZFull = aZ;
|
||||||
|
|
||||||
|
accelXG = tempDouble = accelXFull / F_ACC_RES_PER_G;
|
||||||
|
accelYG = tempDouble = accelYFull / F_ACC_RES_PER_G;
|
||||||
|
accelZG = tempDouble = accelZFull / F_ACC_RES_PER_G;
|
||||||
|
|
||||||
// Put accel ranges between 0 - 128 abs
|
// Put accel ranges between 0 - 128 abs
|
||||||
accelX = -aX / 64;
|
accelX = -aX / 64;
|
||||||
@ -41,10 +53,6 @@ namespace DS4Windows
|
|||||||
outputAccelY = accelY;
|
outputAccelY = accelY;
|
||||||
outputAccelZ = accelZ;
|
outputAccelZ = accelZ;
|
||||||
|
|
||||||
accelXFull = -aX;
|
|
||||||
accelYFull = -aY;
|
|
||||||
accelZFull = aZ;
|
|
||||||
|
|
||||||
elapsed = elapsedDelta;
|
elapsed = elapsedDelta;
|
||||||
previousAxis = prevAxis;
|
previousAxis = prevAxis;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user