diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 66965495..416cd00f 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -819,7 +819,9 @@ var flightPlanController = { if (me.currentToWptIndex.getValue() < 1) { var errs = []; call(func { - me.currentToWptIndex.setValue(1); + if (me.flightplans[2].getWP(1).id != "DISCONTINUITY") { + me.currentToWptIndex.setValue(1); + } }, nil, nil, nil, errs); if (size(errs) != 0) { debug.printerror(errs); } } diff --git a/Nasal/MCDU/HOLD.nas b/Nasal/MCDU/HOLD.nas index 1bb16b33..34894f07 100644 --- a/Nasal/MCDU/HOLD.nas +++ b/Nasal/MCDU/HOLD.nas @@ -39,38 +39,50 @@ var holdPage = { _setupPageWithData: func() { me.title = ["HOLD", " AT ", me.waypoint.wp_name]; me.titleColour = "wht"; - me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0]]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]; me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["blu", "blu", "ack", "ack", "ack", "ack"]]; + if (me.waypoint.fly_type == "Hold") { - me.makeTmpy(); - me.L1 = [sprintf("%03.0f°", me.waypoint.hold_inbound_radial), "INB CRS", "blu"]; - - if (me.waypoint.hold_is_left_handed) { - me.L2 = ["L", " TURN", "blu"]; - } else { - me.L2 = ["R", " TURN", "blu"]; - } - - if (me.waypoint.hold_is_distance) { - me.L3 = [" -.-/" ~ me.waypoint.hold_time_or_distance, "TIME/DIST", "blu"]; - } else { - me.L3 = [sprintf("%3.1f", (me.waypoint.hold_time_or_distance / 60)) ~ "/----", "TIME/DIST", "blu"]; - } - me.R1 = ["COMPUTED ", nil, "blu"]; - me.R2 = ["DATABASE ", nil, "yel"]; + me.R1 = ["COMPUTED ", nil, "wht"]; + me.R2 = ["DATABASE ", nil, "blu"]; + me.arrowsColour[1][0] = "wht"; + me.arrowsColour[1][1] = "blu"; + me.arrowsMatrix[1][0] = 1; me.arrowsMatrix[1][1] = 0; } else { - me.L1 = ["100°", "INB CRS", "blu"]; - me.L2 = ["R", " TURN", "blu"]; + # waypoint is a leg, figure out how to handle it + return; + me.waypoint.hold_count = 999; + me.waypoint.hold_is_left_handed = 0; + me.waypoint.hold_is_distance = 0; + me.waypoint.hold_inbound_radial = me.waypoint.leg_bearing; + if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) { - me.L3 = ["1.5/----", "TIME/DIST", "blu"]; + me.waypoint.hold_time_or_distance = 90; } else { - me.L3 = ["1.0/----", "TIME/DIST", "blu"]; + me.waypoint.hold_time_or_distance = 60; } - me.R1 = ["COMPUTED ", nil, "blu"]; - me.R2 = ["DATABASE ", nil, "blu"]; + + me.R1 = ["COMPUTED ", nil, "yel"]; + me.R2 = ["DATABASE ", nil, "wht"]; + me.arrowsColour[1][0] = "yel"; + me.arrowsColour[1][1] = "wht"; + me.arrowsMatrix[1][0] = 0; + me.arrowsMatrix[1][1] = 1; } - me.L6 = [" RETURN", nil, "wht"]; + + me.L1 = [sprintf("%03.0f°", me.waypoint.hold_inbound_radial), "INB CRS", "yel"]; + if (me.waypoint.hold_is_left_handed) { + me.L2 = ["L", " TURN", "blu"]; + } else { + me.L2 = ["R", " TURN", "blu"]; + } + if (me.waypoint.hold_is_distance) { + me.L3 = [" -.-/" ~ me.waypoint.hold_time_or_distance, "TIME/DIST", "blu"]; + } else { + me.L3 = [sprintf("%3.1f", (me.waypoint.hold_time_or_distance / 60)) ~ "/----", "TIME/DIST", "blu"]; + } + me.C4 = ["LAST EXIT", nil, "wht"]; me.C5 = ["---- ---.-", "UTC FUEL", "wht"]; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); @@ -82,23 +94,61 @@ var holdPage = { }, updateTmpy: func() { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { - me.L1[2] = "yel"; - me.L2[2] = "yel"; - me.L3[2] = "yel"; me.L6 = [" F-PLN", " TMPY", "yel"]; me.R6 = ["INSERT ", " TMPY", "yel"]; me.arrowsColour[0][5] = "yel"; me.titleColour = "yel"; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } else { - me.L1[2] = "blu"; - me.L2[2] = "blu"; - me.L3[2] = "blu"; me.L6 = [" RETURN", nil, "wht"]; me.R6 = [nil, nil, "ack"]; me.arrowsColour[0][5] = "wht"; me.titleColour = "wht"; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } - } + }, + pushbuttonLeft: func(index) { + me.scratchpad = mcdu_scratchpad.scratchpads[me.computer].scratchpad; + if (index == 1) { + if (size(me.scratchpad) <= 3 and num(me.scratchpad) != nil) { + me.waypoint.hold_inbound_radial = me.scratchpad; + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + } else if (index == 2) { + if (me.scratchpad == "L") { + me.waypoint.hold_is_left_handed = 1; + } elsif (me.scratchpad == "R") { + me.waypoint.hold_is_left_handed = 0; + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + } elsif (index == 3) { + if (num(me.scratchpad) != nil) { + me.waypoint.hold_time_or_distance = me.scratchpad; + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + } elsif (index == 6) { + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); + } else { + setprop("/MCDU[" ~ me.computer ~ "]/page", "LATREV"); + } + } + }, + pushbuttonRight: func(index) { + me.scratchpad = mcdu_scratchpad.scratchpads[me.computer].scratchpad; + if (size(me.scratchpad) != 0) { + mcdu_message(me.computer, "NOT ALLOWED"); + } else { + if (index == 6) { + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + } + } + }, }; \ No newline at end of file