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. Steam Gauge Overhaul
  6. Problem with KNS81 mapping

Problem with KNS81 mapping

Scheduled Pinned Locked Moved Steam Gauge Overhaul
15 Posts 3 Posters 896 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.
  • GunStraussG Offline
    GunStraussG Offline
    GunStrauss
    wrote on last edited by
    #6

    Both the KNS-81 and -80 still requires some manual edits to get proper output for the LVARS when the navigation aids are not in range. I'm coming back to you when I know more! Best, GS

    1 Reply Last reply
    0
    • GunStraussG Offline
      GunStraussG Offline
      GunStrauss
      wrote on last edited by GunStrauss
      #7

      From the developer:

      KNS80:
      Move the three lines containing, "var_RNAV_WAYPOINT_NUMBER", "var_RNAV_RADIAL_NUMBER", and "var_RNAV_DISTANCE_NUMBER" up a couple of lines in KNS80.js so that they are right after the function declaration "sendRnavVariables(){"

      KNS81:
      Replacing all the code between the line: "sendRnavVariables(){", and the line: "sendAutopilotVariables(){"...

      SimVar.SetSimVarValue("L:var_RNAV_WAYPOINT_NUMBER", "number", this.displayChannel);

      if(SimVar.GetSimVarValue("NAV HAS DME:"+this.navSourceIndex, "Bool") && SimVar.GetSimVarValue("NAV SIGNAL:"+this.navSourceIndex, "number")){
      
          if(!SimVar.GetSimVarValue("L:var_RNAV_CHECKMODE", "bool")){
              SimVar.SetSimVarValue("L:var_RNAV_RADIAL_NUMBER", "number", this.memoryRadials[this.displayChannel - 1]);
              SimVar.SetSimVarValue("L:var_RNAV_DISTANCE_NUMBER", "number", this.memoryOffsets[this.displayChannel - 1]);
          }
          else{
              SimVar.SetSimVarValue("L:var_RNAV_RADIAL_NUMBER", "number", (this.actualVorRadialDegrees + 180) % 360);
              SimVar.SetSimVarValue("L:var_RNAV_DISTANCE_NUMBER", "number", this.interpolatedDmeRange);
          }   
      
          SimVar.SetSimVarValue("L:var_RNAV_BEARING", "number", this.rnavBearing);
      
          //console.log("Sending CDI Value: " + this.rnavAngularDeviation + " --> " + (Math.max(Math.min(this.rnavAngularDeviation, 12.0), -12.0) * 10.583333) );
      
          //0=VOR, 1=VOR/PAR, 2=RNAV-ENR, 3=RNAV-APR
          switch(this.navigationMode){
              case 0:
                  SimVar.SetSimVarValue("L:var_RNAV_CDI", "number", (Math.max(Math.min(this.rnavAngularDeviation, 12.0), -12.0) * 10.583333) );
              break;
              case 1:
                  SimVar.SetSimVarValue("L:var_RNAV_CDI", "number", (Math.max(Math.min(this.rnavLinearDeviation, 5.0), -5.0) * 25.4) );
              break;
              case 2:
                  SimVar.SetSimVarValue("L:var_RNAV_CDI", "number", (Math.max(Math.min(this.rnavLinearDeviation, 5.0), -5.0) * 25.4) );
              break;
              case 3:
                  SimVar.SetSimVarValue("L:var_RNAV_CDI", "number", (Math.max(Math.min(this.rnavLinearDeviation, 1.25), -1.25) * 101.6) );
              break;
          }
      
          SimVar.SetSimVarValue("L:var_RNAV_TOFROM", "number", this.toFromFlag);
      
      }
      else{
          SimVar.SetSimVarValue("L:var_RNAV_RADIAL_NUMBER", "number", this.memoryRadials[this.displayChannel - 1]);
          SimVar.SetSimVarValue("L:var_RNAV_DISTANCE_NUMBER", "number", this.memoryOffsets[this.displayChannel - 1]);
          SimVar.SetSimVarValue("L:var_RNAV_CDI", "number", 0);
          SimVar.SetSimVarValue("L:var_RNAV_TOFROM", "number", 0);
          SimVar.SetSimVarValue("L:var_RNAV_BEARING", "number", 0);
      }
      
      if(!SimVar.GetSimVarValue("L:var_RNAV_DMEHOLD", "Bool")){
          if(SimVar.GetSimVarValue("NAV HAS DME:"+this.navSourceIndex, "Bool") && SimVar.GetSimVarValue("NAV SIGNAL:"+this.navSourceIndex, "number")){
              SimVar.SetSimVarValue("L:var_RNAV_DME", "number", this.rnavDmeDistance);
              SimVar.SetSimVarValue("L:var_RNAV_DMESPEED", "number", this.rnavDmeSpeed);
          }
          else{
              SimVar.SetSimVarValue("L:var_RNAV_DME", "number", 0);
              SimVar.SetSimVarValue("L:var_RNAV_DMESPEED", "number", 0);
          }
      }
      else{
          if(this.calculatedDmeDistanceHOLD < 145.7){
              SimVar.SetSimVarValue("L:var_RNAV_DME", "number", this.calculatedDmeDistanceHOLD);
              SimVar.SetSimVarValue("L:var_RNAV_DMESPEED", "number", this.calculatedDmeSpeedHOLD);
          }
          else{
              SimVar.SetSimVarValue("L:var_RNAV_DME", "number", 0);
              SimVar.SetSimVarValue("L:var_RNAV_DMESPEED", "number", 0);
          }
      }
      

      }

      1 Reply Last reply
      0
      • GunStraussG Offline
        GunStraussG Offline
        GunStrauss
        wrote on last edited by
        #8
        This post is deleted!
        1 Reply Last reply
        0
        • GunStraussG Offline
          GunStraussG Offline
          GunStrauss
          wrote on last edited by
          #9

          @felixfer *NOTICE THAT THE FORUM SYSTEM REFORMATS THE CODE. The first line and the last } is outside of the "code-box".

          1 Reply Last reply
          0
          • F Offline
            F Offline
            felixfer
            wrote on last edited by felixfer
            #10

            Hi, @GunStrauss , first at all a big THANK YOU for your kind and generous help. I am really touched.

            I have put the code you sen to me in my KNS81.js file. I hope I have done well the replacement you suggest. This is the result:

            send__ThisLineIsOnlyForAvoidingTheBoxCodeProblem__(){
            sendRnavVariables(){
            	
                SimVar.SetSimVarValue("L:var_RNAV_WAYPOINT_NUMBER", "number", this.displayChannel);
            	
                    if(SimVar.GetSimVarValue("NAV HAS DME:"+this.navSourceIndex, "Bool") && SimVar.GetSimVarValue("NAV SIGNAL:"+this.navSourceIndex, "number")){
            
                    if(!SimVar.GetSimVarValue("L:var_RNAV_CHECKMODE", "bool")){
                        SimVar.SetSimVarValue("L:var_RNAV_RADIAL_NUMBER", "number", this.memoryRadials[this.displayChannel - 1]);
                        SimVar.SetSimVarValue("L:var_RNAV_DISTANCE_NUMBER", "number", this.memoryOffsets[this.displayChannel - 1]);
                    }
                    else{
                        SimVar.SetSimVarValue("L:var_RNAV_RADIAL_NUMBER", "number", (this.actualVorRadialDegrees + 180) % 360);
                        SimVar.SetSimVarValue("L:var_RNAV_DISTANCE_NUMBER", "number", this.interpolatedDmeRange);
                    }   
            
                    SimVar.SetSimVarValue("L:var_RNAV_BEARING", "number", this.rnavBearing);
            
                    //console.log("Sending CDI Value: " + this.rnavAngularDeviation + " --> " + (Math.max(Math.min(this.rnavAngularDeviation, 12.0), -12.0) * 10.583333) );
            
                    //0=VOR, 1=VOR/PAR, 2=RNAV-ENR, 3=RNAV-APR
                    switch(this.navigationMode){
                        case 0:
                            SimVar.SetSimVarValue("L:var_RNAV_CDI", "number", (Math.max(Math.min(this.rnavAngularDeviation, 12.0), -12.0) * 10.583333) );
                        break;
                        case 1:
                            SimVar.SetSimVarValue("L:var_RNAV_CDI", "number", (Math.max(Math.min(this.rnavLinearDeviation, 5.0), -5.0) * 25.4) );
                        break;
                        case 2:
                            SimVar.SetSimVarValue("L:var_RNAV_CDI", "number", (Math.max(Math.min(this.rnavLinearDeviation, 5.0), -5.0) * 25.4) );
                        break;
                        case 3:
                            SimVar.SetSimVarValue("L:var_RNAV_CDI", "number", (Math.max(Math.min(this.rnavLinearDeviation, 1.25), -1.25) * 101.6) );
                        break;
                    }
            
                    SimVar.SetSimVarValue("L:var_RNAV_TOFROM", "number", this.toFromFlag);
            
                }
                else{
                    SimVar.SetSimVarValue("L:var_RNAV_RADIAL_NUMBER", "number", this.memoryRadials[this.displayChannel - 1]);
                    SimVar.SetSimVarValue("L:var_RNAV_DISTANCE_NUMBER", "number", this.memoryOffsets[this.displayChannel - 1]);
                    SimVar.SetSimVarValue("L:var_RNAV_CDI", "number", 0);
                    SimVar.SetSimVarValue("L:var_RNAV_TOFROM", "number", 0);
                    SimVar.SetSimVarValue("L:var_RNAV_BEARING", "number", 0);
                }
            
                if(!SimVar.GetSimVarValue("L:var_RNAV_DMEHOLD", "Bool")){
                    if(SimVar.GetSimVarValue("NAV HAS DME:"+this.navSourceIndex, "Bool") && SimVar.GetSimVarValue("NAV SIGNAL:"+this.navSourceIndex, "number")){
                        SimVar.SetSimVarValue("L:var_RNAV_DME", "number", this.rnavDmeDistance);
                        SimVar.SetSimVarValue("L:var_RNAV_DMESPEED", "number", this.rnavDmeSpeed);
                    }
                    else{
                        SimVar.SetSimVarValue("L:var_RNAV_DME", "number", 0);
                        SimVar.SetSimVarValue("L:var_RNAV_DMESPEED", "number", 0);
                    }
                }
                else{
                    if(this.calculatedDmeDistanceHOLD < 145.7){
                        SimVar.SetSimVarValue("L:var_RNAV_DME", "number", this.calculatedDmeDistanceHOLD);
                        SimVar.SetSimVarValue("L:var_RNAV_DMESPEED", "number", this.calculatedDmeSpeedHOLD);
                    }
                    else{
                        SimVar.SetSimVarValue("L:var_RNAV_DME", "number", 0);
                        SimVar.SetSimVarValue("L:var_RNAV_DMESPEED", "number", 0);
                    }
                }        
            }
            
                sendAutopilotVariables(){
                send__ThisLineIsOnlyForAvoidingTheBoxCodeProblem__(){
            
            1 Reply Last reply
            0
            • F Offline
              F Offline
              felixfer
              wrote on last edited by felixfer
              #11

              And I must say that it has worked for the RADIAL and DISTANCE vars, now I can access to them and show their values.

              The only remaining problem is the WAYPOINT_NUMBER var, I have not been able to find it. I feel that I am abusing your trust, but I would like to ask you if you find any possible cause for this absence.

              Thanks again for your unvaluable help and best regards,

              Félix FdC

              GunStraussG 1 Reply Last reply
              0
              • F felixfer

                And I must say that it has worked for the RADIAL and DISTANCE vars, now I can access to them and show their values.

                The only remaining problem is the WAYPOINT_NUMBER var, I have not been able to find it. I feel that I am abusing your trust, but I would like to ask you if you find any possible cause for this absence.

                Thanks again for your unvaluable help and best regards,

                Félix FdC

                GunStraussG Offline
                GunStraussG Offline
                GunStrauss
                wrote on last edited by
                #12

                @felixfer No problem, but not sure if I understand why you don't get the waypoint number. I belive this is the piece of code that makes the waypoint number display:

                SimVar.SetSimVarValue("L:var_RNAV_WAYPOINT_NUMBER", "number", this.displayChannel);

                My post (where the code is weirdly formatted) is taken directly from the .js file running on my system. Are you using the latest build? What aircraft?

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  felixfer
                  wrote on last edited by felixfer
                  #13

                  Hi again, @GunStrauss . Sorry for my mistake before. I just reloaded the sim and the Waypoint_Number Var was there, indeed. Now I can have almost all the KNS81 values in my Loupedeck. Thanks again for all your support.

                  P.S. My aircraft is the Analog Baron, by the way

                  1 Reply Last reply
                  0
                  • GunStraussG Offline
                    GunStraussG Offline
                    GunStrauss
                    wrote on last edited by
                    #14

                    I'm happy you got it to work!

                    1 Reply Last reply
                    1
                    • F Offline
                      F Offline
                      felixfer
                      wrote on last edited by
                      #15

                      Hi @GunStrauss , I have installed the Analog Baron 1.2 update. Do you think that the manual editing in the file "KNS80.js" is still necessary? Thanks in advance

                      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