Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkirie committed Dec 14, 2021
1 parent b5f30bb commit 924ebea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions ControllerService/XInputAccelerometer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace ControllerService
public class XInputAccelerometer
{
public Accelerometer sensor;
private Vector3 reading = new();

public event XInputAccelerometerReadingChangedEventHandler ReadingChanged;
public delegate void XInputAccelerometerReadingChangedEventHandler(Object sender, Vector3 e);
Expand All @@ -31,19 +32,18 @@ public XInputAccelerometer(XInputController controller, ILogger logger)
}
}

private Vector3 v_reading = new();
void AcceleroReadingChanged(Accelerometer sender, AccelerometerReadingChangedEventArgs args)
{
AccelerometerReading reading = args.Reading;

v_reading.X = (float)-reading.AccelerationX;
v_reading.Y = (float)reading.AccelerationZ;
v_reading.Z = (float)reading.AccelerationY;
this.reading.X = (float)-reading.AccelerationX;
this.reading.Y = (float)reading.AccelerationZ;
this.reading.Z = (float)reading.AccelerationY;

v_reading *= controller.profile.accelerometer;
this.reading *= controller.profile.accelerometer;

// raise event
ReadingChanged?.Invoke(this, v_reading);
ReadingChanged?.Invoke(this, this.reading);
}
}
}
12 changes: 6 additions & 6 deletions ControllerService/XInputGirometer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace ControllerService
public class XInputGirometer
{
public Gyrometer sensor;
private Vector3 reading = new();

public event XInputGirometerReadingChangedEventHandler ReadingChanged;
public delegate void XInputGirometerReadingChangedEventHandler(Object sender, Vector3 e);
Expand All @@ -31,19 +32,18 @@ public XInputGirometer(XInputController controller, ILogger logger)
}
}

private Vector3 v_reading = new();
void GyroReadingChanged(Gyrometer sender, GyrometerReadingChangedEventArgs args)
{
GyrometerReading reading = args.Reading;

v_reading.X = (float)-reading.AngularVelocityX;
v_reading.Y = (float)reading.AngularVelocityZ;
v_reading.Z = (float)reading.AngularVelocityY;
this.reading.X = (float)-reading.AngularVelocityX;
this.reading.Y = (float)reading.AngularVelocityZ;
this.reading.Z = (float)reading.AngularVelocityY;

v_reading *= controller.profile.gyrometer;
this.reading *= controller.profile.gyrometer;

// raise event
ReadingChanged?.Invoke(this, v_reading);
ReadingChanged?.Invoke(this, this.reading);
}
}
}

0 comments on commit 924ebea

Please sign in to comment.