Problem with KNS81 mapping
-
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
-
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); } }
}
-
This post is deleted!
-
@felixfer *NOTICE THAT THE FORUM SYSTEM REFORMATS THE CODE. The first line and the last } is outside of the "code-box".
-
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__(){
-
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
-
@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?
-
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
-
I'm happy you got it to work!
-
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