1
0
Fork 0

Will check distance before deleting waypoint. This seems more reliable, in DIRTO

This commit is contained in:
legoboyvdlp R 2020-05-25 23:33:06 +01:00
parent 52bc91ca8e
commit 6f698bf473
2 changed files with 6 additions and 3 deletions

View file

@ -320,7 +320,6 @@ var flightPlanController = {
# we want to delete the intermediate waypoints up to but not including the waypoint. Leave index 0, we delete it later.
# example - waypoint dirto is index 5, we want to delete indexes 1 -> 4. 5 - 1 = 4.
# so four individual deletions. Delete index 1 four times.
# Add one extra for the TP, so while > 2
var timesToDelete = me.flightplans[plan].indexOfWP(waypointGhost);
while (timesToDelete > 1) {
@ -330,9 +329,9 @@ var flightPlanController = {
# Add TP afterwards, this is essential
me.insertTP(plan, 1);
}
me.deleteWP(0, plan);
var curAircraftPosDirTo = geo.aircraft_position();
canvas_mcdu.myDirTo[plan].updateDist(me.flightplans[plan].getWP(1).courseAndDistanceFrom(curAircraftPosDirTo)[1]);
canvas_mcdu.myDirTo[plan].updateDist(me.flightplans[plan].getWP(2).courseAndDistanceFrom(curAircraftPosDirTo)[1]);
me.deleteWP(0, plan);
me.flightPlanChanged(plan);
},

View file

@ -148,6 +148,7 @@ var dirTo = {
fieldL1: func(text, override = 0, overrideIndex = -1) {
me.makeTmpy();
me.L1[0] = text;
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]];
if (size(text) == 16) {
# lat lon
var lat = split("/", text)[0];
@ -237,6 +238,7 @@ var dirTo = {
leftFieldBtn: func(index) {
me.makeTmpy();
me.L1[0] = me.vector[index - 2].wp_name;
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]];
fmgc.flightPlanController.directTo(me.vector[index - 2], me.computer);
me.arrowsMatrix[0][1] = 0;
# FIGURE OUT HOW TO MAKE IT SO IT DOESN'T DELETE THE WAYPOINTS ON DIR TO BUT DOES IN FLIGHTPLAN
@ -256,6 +258,7 @@ var dirTo = {
notAllowed(me.computer);
}
me.L1 = [" [ ]", " WAYPOINT", "blu"];
me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]];
me.R1 = ["---- --- ", "UTC DIST ", "wht"];
},
fieldR6: func() {
@ -266,6 +269,7 @@ var dirTo = {
notAllowed(me.computer);
}
me.L1 = [" [ ]", " WAYPOINT", "blu"];
me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]];
me.R1 = ["---- --- ", "UTC DIST ", "wht"];
setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); # todo - remember horizontal srcoll of f-plna?
},