Accessing the Flight Plan - falcon71/kln90b GitHub Wiki
The real KLN 90B transmits basic flight plan data via RS-232 or ARINC 429. This data can be used to display the flight plan on external moving maps. To access the flight plan of this KLN, your code needs to be written in Javascript and you will need to use the MSFS Avionics Framework.
Use this code to retrieve the flight plan:
const flightplanner = FlightPlanner.getPlanner("kln90b", bus, { calculator: calculator });
const plan = this.getFlightPlan(0);
//Iterate over the legs
for (const leg of plan.legs()) {
}
//Get the active leg index
const activeIdx = plan.activeLateralLeg;
For further details, see the API documentation.
This flight plan must only be read. Any changes made by you may get overwritten again with the actual internal flight plan of the KLN 90B.
Please note, that just like the real KLN, only the name and the coordinates will be available for waypoints, most other fields will be empty.
Just like the real KLN, the missed approach path will not be transmitted, before reaching the MAP. Also, waypoints before or after an arc will not be available.
Direct To
The flight plan with index 0 will always match the FPL 0 of the KLN. Direct to information will be written on the flight plan with index 1. If the KLN performs a direct to, then the activeIdx will be set to 1 and the from and to waypoint can be read from this flight plan. This behavior is the same as other avionics that use the Avionic Framework flight plan system.