Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Slip value for Garmin Pilot #65

Open
jeffdamp-wave opened this issue Nov 20, 2021 · 0 comments
Open

Add Slip value for Garmin Pilot #65

jeffdamp-wave opened this issue Nov 20, 2021 · 0 comments

Comments

@jeffdamp-wave
Copy link

jeffdamp-wave commented Nov 20, 2021

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);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant