1
0
Fork 0

Flightplan: show PPOS --> discont if before INITA

This commit is contained in:
legoboyvdlp R 2020-05-21 21:02:28 +01:00
parent 6e741c5e09
commit 15c700430f
3 changed files with 35 additions and 28 deletions

View file

@ -56,6 +56,14 @@ var flightPlanController = {
_timeTemp: nil,
_altTemp: nil,
init: func() {
me.resetFlightplan(2);
me.insertPPOS(2);
me.addDiscontinuity(1, 2, 1);
me.currentToWptIndex.setValue(0);
me.flightPlanChanged(2);
},
reset: func() {
me.temporaryFlag[0] = 0;
me.temporaryFlag[1] = 0;
@ -208,8 +216,11 @@ var flightPlanController = {
# Check if a discontinuity already exists either immediately before or at that index
# If it does, don't add another one
# Optional flag DEBUG_DISCONT to disable discontinuities totally
addDiscontinuity: func(index, plan) {
addDiscontinuity: func(index, plan, force = 0) {
if (DEBUG_DISCONT) { return; }
if (force) {
me.flightplans[plan].insertWP(createDiscontinuity(), index);
}
if (index > 0) {
if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index - 1).wp_name != "DISCONTINUITY") {
me.flightplans[plan].insertWP(createDiscontinuity(), index);
@ -231,6 +242,10 @@ var flightPlanController = {
me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "T-P"), index);
},
insertPPOS: func(n, index = 0) {
me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "PPOS"), index);
},
# childWPBearingDistance - return waypoint at bearing and distance from specified waypoint ghost
# args: wpt, bearing, dist, name, typeStr
# wpt: waypoint ghost

View file

@ -222,6 +222,7 @@ var systemsInit = func {
atc.init();
fcu.FCUController.init();
dmc.DMController.init();
fmgc.flightPlanController.init();
}
setlistener("/sim/signals/fdm-initialized", func {

View file

@ -759,42 +759,33 @@ var pagebutton = func(btn, i) {
setprop("/MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM");
setprop("/MCDU[" ~ i ~ "]/page", "MCDU");
} else if (btn == "f-pln" or btn == "airport") {
if (fmgc.flightPlanController.active.getBoolValue()) {
if (canvas_mcdu.myFpln[i] == nil) {
canvas_mcdu.myFpln[i] = fplnPage.new(2, i);
}
if (btn == "airport") {
if (getprop("FMGC/status/phase") == 0 or getprop("FMGC/status/phase") == 1) {
canvas_mcdu.myFpln[i].scroll = 0;
if (canvas_mcdu.myFpln[i] == nil) {
canvas_mcdu.myFpln[i] = fplnPage.new(2, i);
}
if (btn == "airport") {
if (getprop("FMGC/status/phase") == 0 or getprop("FMGC/status/phase") == 1) {
canvas_mcdu.myFpln[i].scroll = 0;
} else {
if (fmgc.flightPlanController.temporaryFlag[i]) {
canvas_mcdu.myFpln[i].scroll = fmgc.flightPlanController.arrivalIndex[i];
} else {
if (fmgc.flightPlanController.temporaryFlag[i]) {
canvas_mcdu.myFpln[i].scroll = fmgc.flightPlanController.arrivalIndex[i];
} else {
canvas_mcdu.myFpln[i].scroll = fmgc.flightPlanController.arrivalIndex[2];
}
canvas_mcdu.myFpln[i].scroll = fmgc.flightPlanController.arrivalIndex[2];
}
}
setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA");
} else {
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "ERROR. INITIALIZE ROUTE"); # Should be ERROR:, but the : character doesn't show in our MCDU font right now...
}
setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA");
} else if (btn == "fuel-pred") {
setprop("/MCDU[" ~ i ~ "]/page", "FUELPRED");
} else if (btn == "dirto") {
if (fmgc.flightPlanController.active.getBoolValue()) {
if (fmgc.flightPlanController.temporaryFlag[i] and !dirToFlag) {
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "INSRT / ERASE TMPY FIRST");
return;
} elsif (canvas_mcdu.myDirTo[i] == nil) {
canvas_mcdu.myDirTo[i] = dirTo.new(i);
}
setprop("/MCDU[" ~ i ~ "]/page", "DIRTO");
} else {
if (fmgc.flightPlanController.temporaryFlag[i] and !dirToFlag) {
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "ERROR. INITIALIZE ROUTE"); # Should be ERROR:, but the : character doesn't show in our MCDU font right now...
setprop("/MCDU[" ~ i ~ "]/scratchpad", "INSRT / ERASE TMPY FIRST");
return;
} elsif (canvas_mcdu.myDirTo[i] == nil) {
canvas_mcdu.myDirTo[i] = dirTo.new(i);
}
setprop("/MCDU[" ~ i ~ "]/page", "DIRTO");
}
}
}