fs2ff icon indicating copy to clipboard operation
fs2ff copied to clipboard

Add Slip value for Garmin Pilot

Open jeffdamp-wave opened this issue 2 years ago • 0 comments

Request, add the following to enable some minor features for Garmin Pilot:

DataSender.cs:

  public async Task Send(Attitude a)
  {
      // Using a slip value between -127 and +127. .005 converts GP to be similar to the ingame G1000 slip indicator
      var slipDeg = a.SkidSlip * -0.005;
      var data = string.Format(CultureInfo.InvariantCulture,
          $"XATT{SimId},{a.TrueHeading:0.##},{-a.Pitch:0.##},{-a.Bank:0.##},,,{a.TurnRate:0.##},,,,{slipDeg:0.###},,");

      await Send(data).ConfigureAwait(false);
  }

Attitude.cs:

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
public struct Attitude
{
    public double Pitch;
    public double Bank;
    public double TrueHeading;
    public double SkidSlip;
    public double TurnRate;
}

SimConnectAdapter.cs:

    private void RegisterAttitudeStruct()
    {
        AddToDataDefinition(DEFINITION.Attitude, "PLANE PITCH DEGREES", "Degrees");
        AddToDataDefinition(DEFINITION.Attitude, "PLANE BANK DEGREES", "Degrees");
        AddToDataDefinition(DEFINITION.Attitude, "PLANE HEADING DEGREES TRUE", "Degrees");
        AddToDataDefinition(DEFINITION.Attitude, "TURN COORDINATOR BALL", "Degrees");
        AddToDataDefinition(DEFINITION.Attitude, "DELTA HEADING RATE", "Degrees");

        _simConnect?.RegisterDataDefineStruct<Attitude>(DEFINITION.Attitude);
    }

jeffdamp-wave avatar Nov 20 '21 21:11 jeffdamp-wave