1
0
Fork 0

Fix closest airports magVar; fix the database adding to first wp

This commit is contained in:
legoboyvdlp R 2020-05-17 21:36:42 +01:00
parent eb37ea57fc
commit 82631ed689
4 changed files with 10 additions and 6 deletions

View file

@ -33,6 +33,7 @@ var WaypointDatabase = {
} elsif (me.waypointsVec[wpObj.index] == nil) {
# add at passed index
me.waypointsVec[wpObj.index] = wpObj;
return 2;
} else {
# fall back to end
logprint(4, "pilotWaypoint constructor claims index " ~ wpObj.index ~ " is nil, but it isn't!");

View file

@ -575,7 +575,7 @@ var flightPlanController = {
}
var localMagvar = magvar(wpGhost.lat, wpGhost.lon);
return me.insertPlaceBearingDistance(wpGhost, textSplit[1] + localMagvar, textSplit[2], index, plan);
return me.insertPlaceBearingDistance(wpGhost, textSplit[1] + localMagvar, textSplit[2], index, plan); # magnetic to true? I don't know. But this works!
},
@ -592,6 +592,7 @@ var flightPlanController = {
if (addDb != 2) {
return addDb;
}
me.flightplans[plan].insertWP(waypoint.wpGhost, index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);

View file

@ -87,12 +87,13 @@ var closestAirportPage = {
me.cdVector[1] = courseAndDistance(me.airports[1]);
me.cdVector[2] = courseAndDistance(me.airports[2]);
me.cdVector[3] = courseAndDistance(me.airports[3]);
me.C1 = [math.round(me.cdVector[0][0]) ~ " " ~ math.round(me.cdVector[0][1]), " BRG DIST", "grn"];
me.C2 = [math.round(me.cdVector[1][0]) ~ " " ~ math.round(me.cdVector[1][1]), nil, "grn"];
me.C3 = [math.round(me.cdVector[2][0]) ~ " " ~ math.round(me.cdVector[2][1]), nil, "grn"];
me.C4 = [math.round(me.cdVector[3][0]) ~ " " ~ math.round(me.cdVector[3][1]), nil, "grn"];
var magvarLocal = magvar();
me.C1 = [math.round(me.cdVector[0][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[0][1]), " BRG DIST", "grn"];
me.C2 = [math.round(me.cdVector[1][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[1][1]) , nil, "grn"];
me.C3 = [math.round(me.cdVector[2][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[2][1]), nil, "grn"];
me.C4 = [math.round(me.cdVector[3][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[3][1]), nil, "grn"];
if (me.manAirport != nil) {
me.C5 = [math.round(courseAndDistance(me.manAirport)[0]) ~ " " ~ math.round(courseAndDistance(me.manAirport)[1]), nil, "grn"];
me.C5 = [math.round(courseAndDistance(me.manAirport)[0] - magvarLocal) ~ " " ~ math.round(courseAndDistance(me.manAirport)[1]), nil, "grn"];
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},

View file

@ -390,6 +390,7 @@ var lskbutton = func(btn, i) {
canvas_mcdu.myDuplicate[i].pushButtonLeft(5);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "CLOSESTAIRPORT") {
canvas_mcdu.myClosestAirport[i].manAirportCall(getprop("/MCDU[" ~ i ~ "]/scratchpad"));
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}