Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
Collapse
Just Flight Community Forum
  1. Home
  2. Just Flight
  3. MSFS Products
  4. Black Square Add-Ons
  5. Starship
  6. Vars for the DH and MDA values?

Vars for the DH and MDA values?

Scheduled Pinned Locked Moved Starship
5 Posts 2 Posters 61 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JibletJ Offline
    JibletJ Offline
    Jiblet
    wrote last edited by Jiblet
    #1

    Hi,

    Does anyone happen to know which vars store the DH and MDA values for the Starship?

    I don't think it's using the defaults like (A:DECISION HEIGHT, Feet), which would make sense as Starship has both Pilot and Copilot AAPs allowing each person to set separate values for DH and MDA.

    I'm working on a Streamdeck+ profile that's going really well. I think the only thing I'm missing (until I invent another page of "definitely-useful-things-I'll-need-all-the-time") is these two values.
    I'm successfully using the relevant HVARs to manipulate the DH and MDA knob (H:PFD_DecisionHeightKnob_Dec_1 and the like), but I just can't seem to get the Behaviours window or AAO to spill the beans on the values.

    Thanks!

    1 Reply Last reply
    0
    • JibletJ Offline
      JibletJ Offline
      Jiblet
      wrote last edited by
      #2

      One for @Black-Square directly then perhaps - sorry Nick!

      1 Reply Last reply
      0
      • Black SquareB Offline
        Black SquareB Offline
        Black Square
        Black Square Developer
        wrote last edited by
        #3

        Unfortunately, those variables are only stored internally, but I can offer you a custom code solution if you would like to get it working immediately for yourself.

        If you search for PFD.js in the Starship community folder, then search for the following line...

        SimVar.SetSimVarValue("L:var_MdaAlertSound"...
        

        Directly after this line, you can add these two, which will create L:Vars for you to monitor:

        SimVar.SetSimVarValue("L:var_StarshipDh_L", "feet", this.decisionHeight_L);
        SimVar.SetSimVarValue("L:var_StarshipMda_L", "feet", this.alertAltitude_L);
        

        If you want to also monitor the DH and MDA on the copilot's side, then you can just replace the _L's in those lines with _R's.

        I hope that is what you're looking for! Sorry that it requires a little work. I always like to offer immediate solutions for anything I can solve, because there is no sense waiting months for an update in the age of the internet 🙂

        1 Reply Last reply
        0
        • JibletJ Offline
          JibletJ Offline
          Jiblet
          wrote last edited by Jiblet
          #4

          @Black-Square Thanks Nick, that was super helpful!

          Doing what you said set up the LVars and gave me reading of 500 DH and 1000 MDA which was a great start, but the LVar values didn't change when using the in game knobs to alter the values on the PFD. I think because that part of the code is only run once maybe?

          Anyway, in the end I've added 4 setters to the real-time part of the update() function (currently around line 800).
          In context here if anyone (including future me!) is interested in implementing the same change:

            Update() {
              super.Update();
          
              // Slow SimVar Updates
          
              this.simVarUpdateTimer += this.deltaTime;
              if (this.simVarUpdateTimer >= this.simVarUpdateInterval) {
                this.simVarUpdateTimer = 0;
                this.simVarUpdate();
              }
          
              // Real Time Updates
          
              // Attempting to add LVars for DH and MDA:
              SimVar.SetSimVarValue("L:var_StarshipDh_L", "feet", this.decisionHeight_L);
              SimVar.SetSimVarValue("L:var_StarshipMda_L", "feet", this.alertAltitude_L);
              SimVar.SetSimVarValue("L:var_StarshipDh_R", "feet", this.decisionHeight_R);
              SimVar.SetSimVarValue("L:var_StarshipMda_R", "feet", this.alertAltitude_R);
              // ----------------------------
          
              this.heading = SimVar.GetSimVarValue(
                "PLANE HEADING DEGREES MAGNETIC",
                "degree",
              );
          

          All seems to be working when powered up on the ground. I haven't taken it out for a flight to see if I've some how caused it to do cartwheels when twisting those knobs, but fingers crossed!

          Thanks again!
          I think the SD+ profile is... complete! 😲


          EDIT:
          Actually, now I'm looking at it again I see there are realtimeUpdate_L() and realtimeUpdate_R() functions that might be a more appropriate place to put these setters.

          Eg:

            realtimeUpdate_L() {
              //update the left side DH and MDA LVars
              SimVar.SetSimVarValue("L:var_StarshipDh_L", "feet", this.decisionHeight_L);
              SimVar.SetSimVarValue("L:var_StarshipMda_L", "feet", this.alertAltitude_L);
          

          This seems to work too in my very brief testing. Yay!

          1 Reply Last reply
          0
          • Black SquareB Offline
            Black SquareB Offline
            Black Square
            Black Square Developer
            wrote last edited by
            #5

            Hm. I'm glad it's working for you now. You will have the fastest updating L:Vars of any cockpit builder, haha. From a second look, the position I sent you should be correct, since that's where the altitude alerter sounds are being driven from too. I always try to send the most performant solutions too, but if it isn't broken, then don't fix it 🙂

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users