diff --git a/A320-main.xml b/A320-main.xml index d96c4740..58bae6e1 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -1956,20 +1956,37 @@ Del CLR + true /FMGC/keyboard-left nasal - + /FMGC/keyboard-right nasal - + + + + + /FMGC/keyboard-left + + nasal + + + + + /FMGC/keyboard-right + + nasal + + + Disable MCDU keyboard mode diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 1439b8e6..f20d49d6 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -197,10 +197,10 @@ var renderingSettings = { check: func() { var rembrandt = getprop("/sim/rendering/rembrandt/enabled"); var ALS = getprop("/sim/rendering/shaders/skydome"); - var customSettings = getprop("/sim/rendering/shaders/custom-settings") == 1; + var landmass = getprop("/sim/rendering/shaders/landmass") >= 4; var model = getprop("/sim/rendering/shaders/model") >= 2; - if (!rembrandt and (!ALS or !customSettings or !landmass or !model)) { + if (!rembrandt and (!ALS or !landmass or !model)) { rendering_dlg.open(); } }, @@ -256,6 +256,15 @@ var writeSettings = func { # Panel States # ################ +# Abort auto-config and close dialog +var abortPanelStates = func { + if (getprop("/systems/acconfig/autoconfig-running") == 1) { + setprop("/systems/acconfig/autoconfig-running", 0); + } + ps_load_dlg.close(); + spinning.stop(); +} + # Cold and Dark var colddark = func { if (getprop("/systems/acconfig/mismatch-code") == "0x000") { @@ -352,6 +361,10 @@ var beforestart = func { } } var beforestart_b = func { + if (getprop("/systems/acconfig/autoconfig-running") == 0) { + colddark(); + return 0; # auto-config aborted + } # Continue with engine start prep. systems.FUEL.Switches.pumpLeft1.setValue(1); systems.FUEL.Switches.pumpLeft2.setValue(1); @@ -439,6 +452,10 @@ var taxi = func { } } var taxi_b = func { + if (getprop("/systems/acconfig/autoconfig-running") == 0) { + colddark(); + return 0; # auto-config aborted + } # Continue with engine start prep, and start engines. systems.FUEL.Switches.pumpLeft1.setValue(1); systems.FUEL.Switches.pumpLeft2.setValue(1); @@ -492,6 +509,10 @@ var taxi_b = func { settimer(taxi_c, 2); } var taxi_c = func { + if (getprop("/systems/acconfig/autoconfig-running") == 0) { + colddark(); + return 0; # auto-config aborted + } setprop("/controls/engines/engine-start-switch", 2); setprop("/controls/engines/engine[0]/cutoff-switch", 0); setprop("/controls/engines/engine[1]/cutoff-switch", 0); @@ -500,6 +521,10 @@ var taxi_c = func { }, 10); } var taxi_d = func { + if (getprop("/systems/acconfig/autoconfig-running") == 0) { + colddark(); + return 0; # auto-config aborted + } # After Start items. setprop("/controls/engines/engine-start-switch", 1); setprop("/controls/apu/master", 0); diff --git a/AircraftConfig/psload.xml b/AircraftConfig/psload.xml index 8245b84e..64cb9823 100644 --- a/AircraftConfig/psload.xml +++ b/AircraftConfig/psload.xml @@ -15,6 +15,16 @@ left + @@ -36,7 +46,7 @@ center /systems/acconfig/spin 1 - + diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 37877a24..7aff331d 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -200,23 +200,23 @@ var canvas_MCDU_base = { me["PERFTO_FE"].setFont(symbol); me["PERFTO_SE"].setFont(symbol); me["PERFTO_OE"].setFont(symbol); - me["PERFTO_FE"].setColor(0.8078,0.8039,0.8078); - me["PERFTO_SE"].setColor(0.8078,0.8039,0.8078); - me["PERFTO_OE"].setColor(0.8078,0.8039,0.8078); + me["PERFTO_FE"].setColor(BLUE); + me["PERFTO_SE"].setColor(BLUE); + me["PERFTO_OE"].setColor(BLUE); me["PERFAPPR_FE"].setFont(symbol); me["PERFAPPR_SE"].setFont(symbol); me["PERFAPPR_OE"].setFont(symbol); - me["PERFAPPR_FE"].setColor(0.8078,0.8039,0.8078); - me["PERFAPPR_SE"].setColor(0.8078,0.8039,0.8078); - me["PERFAPPR_OE"].setColor(0.8078,0.8039,0.8078); + me["PERFAPPR_FE"].setColor(BLUE); + me["PERFAPPR_SE"].setColor(BLUE); + me["PERFAPPR_OE"].setColor(BLUE); me["PERFGA_FE"].setFont(symbol); me["PERFGA_SE"].setFont(symbol); me["PERFGA_OE"].setFont(symbol); - me["PERFGA_FE"].setColor(0.8078,0.8039,0.8078); - me["PERFGA_SE"].setColor(0.8078,0.8039,0.8078); - me["PERFGA_OE"].setColor(0.8078,0.8039,0.8078); + me["PERFGA_FE"].setColor(BLUE); + me["PERFGA_SE"].setColor(BLUE); + me["PERFGA_OE"].setColor(BLUE); me.page = canvas_group; @@ -282,7 +282,7 @@ var canvas_MCDU_base = { me["PERFTO"].hide(); }, defaultPageNumbers: func() { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].hide(); @@ -499,29 +499,36 @@ var canvas_MCDU_base = { me.standardFontColour(); me["Simple_L3"].setText(" AIDS"); me["Simple_L4"].setText(" CFDS"); + pageSwitch[i].setBoolValue(1); } if (active[i].getValue() == 0) { me["Simple_L1"].setText(" FMGC"); - me["Simple_L1"].setColor(1,1,1); + me["Simple_L1"].setColor(WHITE); + me["Simple_L1_Arrow"].setColor(WHITE); } else if (active[i].getValue() == 1) { - me["Simple_L1"].setText(" FMGC(SEL)"); - me["Simple_L1"].setColor(0.0901,0.6039,0.7176); + me["Simple_L1"].setText(" FMGC (SEL)"); + me["Simple_L1"].setColor(BLUE); + me["Simple_L1_Arrow"].setColor(BLUE); } else if (active[i].getValue() == 2) { me["Simple_L1"].setText(" FMGC"); - me["Simple_L1"].setColor(0.0509,0.7529,0.2941); + me["Simple_L1"].setColor(GREEN); + me["Simple_L1_Arrow"].setColor(GREEN); } if (activeAtsu[i].getValue() == 0) { me["Simple_L2"].setText(" ATSU"); - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); + me["Simple_L2_Arrow"].setColor(WHITE); } else if (activeAtsu[i].getValue() == 1) { - me["Simple_L2"].setText(" ATSU(SEL)"); - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setText(" ATSU (SEL)"); + me["Simple_L2"].setColor(BLUE); + me["Simple_L2_Arrow"].setColor(BLUE); } else if (activeAtsu[i].getValue() == 2) { me["Simple_L2"].setText(" ATSU"); - me["Simple_L2"].setColor(0.0509,0.7529,0.2941); + me["Simple_L2"].setColor(GREEN); + me["Simple_L2_Arrow"].setColor(GREEN); } } else if (page == "ATSUDLINK") { if (!pageSwitch[i].getBoolValue()) { @@ -914,7 +921,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("ATC MENU"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("1/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -960,7 +967,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); me["Simple_Title"].setText("TEXT"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("1/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -1051,7 +1058,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); me["Simple_Title"].setText("ATC MENU"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("2/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -1148,7 +1155,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); me["Simple_Title"].setText("ATS623 ATIS MENU"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].hide(); me["ArrowLeft"].hide(); me["ArrowRight"].hide(); @@ -1909,7 +1916,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("DATA INDEX"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("1/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -1949,7 +1956,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("DATA INDEX"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("2/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -2230,7 +2237,7 @@ var canvas_MCDU_base = { me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("INIT"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].show(); @@ -2274,12 +2281,12 @@ var canvas_MCDU_base = { if (!fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.costIndexSet) { me["INITA_CostIndex"].hide(); - me["Simple_L5"].setColor(1,1,1); + me["Simple_L5"].setColor(WHITE); me["Simple_L5"].show(); me["Simple_L5"].setText("---"); } else if (fmgc.FMGCInternal.costIndexSet) { me["INITA_CostIndex"].hide(); - me["Simple_L5"].setColor(0.0901,0.6039,0.7176); + me["Simple_L5"].setColor(BLUE); me["Simple_L5"].show(); me["Simple_L5"].setText(sprintf("%s", fmgc.FMGCInternal.costIndex)); } else { @@ -2288,28 +2295,40 @@ var canvas_MCDU_base = { } if (!fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.crzSet) { me["INITA_CruiseFLTemp"].hide(); - me["Simple_L6"].setColor(1,1,1); + me["Simple_L6"].setColor(WHITE); me["Simple_L6"].setText("-----/---g"); } else if (fmgc.FMGCInternal.crzSet and fmgc.FMGCInternal.crzTempSet) { me["INITA_CruiseFLTemp"].hide(); - me["Simple_L6"].setColor(0.0901,0.6039,0.7176); + me["Simple_L6"].setColor(BLUE); me["Simple_L6"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzFl) ~ sprintf("/%sg", fmgc.FMGCInternal.crzTemp)); } else if (fmgc.FMGCInternal.crzSet) { me["INITA_CruiseFLTemp"].hide(); - me["Simple_L6"].setColor(0.0901,0.6039,0.7176); + me["Simple_L6"].setColor(BLUE); fmgc.FMGCInternal.crzTemp = 15 - (2 * fmgc.FMGCInternal.crzFl / 10); fmgc.FMGCInternal.crzTempSet = 1; me["Simple_L6"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzFl) ~ sprintf("/%sg", fmgc.FMGCInternal.crzTemp)); } else { me["INITA_CruiseFLTemp"].show(); - me["Simple_L6"].setColor(0.7333,0.3803,0); + me["Simple_L6"].setColor(AMBER); me["Simple_L6"].setText(" g"); } + + if (fmgc.FMGCInternal.coRouteSet) { # show coRoute when valid + me["INITA_CoRoute"].hide(); + me["Simple_L1"].setText(fmgc.FMGCInternal.coRoute); + me["Simple_L1"].setColor(BLUE); + me["Simple_L1"].show(); + } else { + me["Simple_L1"].hide(); + me["INITA_CoRoute"].show(); + me["Simple_L1"].setText("NONE"); + } + if (fmgc.FMGCInternal.toFromSet) { me["INITA_CoRoute"].hide(); me["INITA_FromTo"].hide(); me["Simple_L1"].show(); - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setColor(BLUE); if (fmgc.FMGCInternal.altAirportSet) { me["Simple_L2"].setText(fmgc.FMGCInternal.altAirport); } else { @@ -2322,7 +2341,7 @@ var canvas_MCDU_base = { me["INITA_CoRoute"].show(); me["INITA_FromTo"].show(); me["Simple_L1"].hide(); - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); me["Simple_L2"].setText("----/----------"); me.showRight(-1, 1, 0, 0, 0, 0); me["Simple_R2S"].show(); @@ -2366,7 +2385,7 @@ var canvas_MCDU_base = { me["Simple_L3S"].setText("FLT NBR"); me["Simple_L5S"].setText("COST INDEX"); me["Simple_L6S"].setText("CRZ FL/TEMP"); - me["Simple_L1"].setText("NONE"); + #me["Simple_L1"].setText("NONE"); # manage before (coRoute) me["Simple_L3"].setText(sprintf("%s", fmgc.FMGCInternal.flightNum)); me["Simple_R1S"].setText("FROM/TO "); me["Simple_R2S"].setText("INIT "); @@ -2668,7 +2687,7 @@ var canvas_MCDU_base = { me["Simple_R5"].setText(fmgc.FMGCInternal.tripWind); me["Simple_R6S"].setText("EXTRA/TIME"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); if (!fmgc.FMGCInternal.fuelRequest) { me["Simple_L2"].setText("---.-/----"); @@ -2708,7 +2727,7 @@ var canvas_MCDU_base = { me["Simple_R6"].setText("---.-/----"); me["Simple_Title"].setText("INIT"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me.colorLeft("ack", "wht", "wht", "wht", "wht", "wht"); me.colorRight("ack", "blu", "amb", "wht", "ack", "wht"); @@ -3061,7 +3080,7 @@ var canvas_MCDU_base = { me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("FUEL PRED"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].show(); @@ -3389,7 +3408,7 @@ var canvas_MCDU_base = { } me["Simple_Title"].show(); - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].hide(); @@ -3572,9 +3591,9 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 1) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); } if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) { @@ -3703,7 +3722,7 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 2) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); me.showLeft(0, 0, 0, 0, 1, 0); me.showLeftS(0, 0, 0, 0, 1, 0); me.showLeftArrow(0, 0, 0, 0, 1, 1); @@ -3744,7 +3763,7 @@ var canvas_MCDU_base = { setprop("/FMGC/internal/activate-twice", 0); } } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me.showLeft(0, 0, 0, 0, -1, 0); me.showLeftS(0, 0, 0, 0, -1, 0); me.showLeftArrow(0, 0, 0, 0, -1, 0); @@ -3778,10 +3797,10 @@ var canvas_MCDU_base = { me["Simple_L2S"].setText(" CI"); if (fmgc.FMGCInternal.costIndexSet) { - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setColor(BLUE); me["Simple_L2"].setText(sprintf(" %s", fmgc.FMGCInternal.costIndex)); } else { - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); me["Simple_L2"].setText(" ---"); } @@ -3856,7 +3875,7 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 3) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); if (managedSpeed.getValue() == 1) { me.showLeft(0, 0, 0, -1, 0, 0); @@ -3891,7 +3910,7 @@ var canvas_MCDU_base = { setprop("/FMGC/internal/activate-twice", 0); } } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me.colorLeft("ack", "ack", "ack", "ack", "ack", "wht"); me.colorLeftS("ack", "ack", "ack", "ack", "ack", "wht"); @@ -3918,10 +3937,10 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.costIndexSet) { - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setColor(BLUE); me["Simple_L2"].setText(sprintf(" %s", fmgc.FMGCInternal.costIndex)); } else { - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); me["Simple_L2"].setText(" ---"); } @@ -3994,7 +4013,7 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 4) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); me.showLeft(0, 0, 0, 0, 1, 0); me.showRight(0, 1, 0, 1, 0, 0); me.showRightS(0, 0, 1, 0, 0, 0); @@ -4034,7 +4053,7 @@ var canvas_MCDU_base = { setprop("/FMGC/internal/activate-twice", 0); } } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me.showLeft(0, 0, 0, 0, -1, 0); me.showRight(0, -1, 0, -1, 0, 0); me.showRightS(0, 0, -1, 0, 0, 0); @@ -4066,10 +4085,10 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.costIndexSet) { - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setColor(BLUE); me["Simple_L2"].setText(sprintf(" %2.0f", fmgc.FMGCInternal.costIndex)); } else { - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); me["Simple_L2"].setText(" ---"); } @@ -4150,9 +4169,9 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 5) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); } me["Simple_L0S"].setText("DEST"); @@ -4333,9 +4352,9 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 6) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); } if (thrAccSet.getValue() == 1) { diff --git a/Models/Instruments/MCDU/MCDU1.xml b/Models/Instruments/MCDU/MCDU1.xml index 51439c6d..1b7c9182 100644 --- a/Models/Instruments/MCDU/MCDU1.xml +++ b/Models/Instruments/MCDU/MCDU1.xml @@ -1705,7 +1705,7 @@ true nasal - + @@ -1719,6 +1719,24 @@ + + + nasal + + + + + systems/electrical/bus/ac-1 + 110 + + + controls/lighting/DU/mcdu1 + 0.01 + + + + + diff --git a/Models/Instruments/MCDU/MCDU2.xml b/Models/Instruments/MCDU/MCDU2.xml index 38324cf0..78516b3e 100644 --- a/Models/Instruments/MCDU/MCDU2.xml +++ b/Models/Instruments/MCDU/MCDU2.xml @@ -1705,7 +1705,7 @@ true nasal - + @@ -1719,6 +1719,24 @@ + + + nasal + + + + + systems/electrical/bus/ac-2 + 110 + + + controls/lighting/DU/mcdu2 + 0.01 + + + + + diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 5dfef46a..c5fa6567 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -167,6 +167,8 @@ var FMGCInternal = { altAirportSet: 0, altSelected: 0, arrApt: "", + coRoute: "", + coRouteSet: 0, costIndex: 0, costIndexSet: 0, crzFt: 10000, @@ -307,6 +309,7 @@ var updateArptLatLon = func { updateRouteManagerAlt = func() { setprop("autopilot/route-manager/cruise/altitude-ft", FMGCInternal.crzFt); + # TODO - update FMGCInternal.phase when DES to re-enter in CLIMB/CRUIZE }; ######## diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index c563d9aa..1dc01602 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -1,5 +1,6 @@ # A3XX Simbrief Parser # Copyright (c) 2020 Jonathan Redpath (legoboyvdlp) +# enhanceded 12/2020 - parse TOD & TOC psedo waypoints, set computer speeds on fix wps, fake coRoute name var LBS2KGS = 0.4535924; @@ -157,12 +158,16 @@ var SimbriefParser = { if (ident == "TOC") { _foundTOC = 1; - continue; + #setprop("/autopilot/route-manager/vnav/tc/latitude-deg",ofpFix.getNode("pos_lat").getValue()); + #setprop("/autopilot/route-manager/vnav/tc/longitude-deg",ofpFix.getNode("pos_long").getValue()); + #ident = "(T/C)"; } if (ident == "TOD") { _foundTOD = 1; - continue; + #setprop("/autopilot/route-manager/vnav/td/latitude-deg",ofpFix.getNode("pos_lat").getValue()); + #setprop("/autopilot/route-manager/vnav/td/longitude-deg",ofpFix.getNode("pos_long").getValue()); + #ident = "(T/D)"; } coords = geo.Coord.new(); @@ -189,6 +194,34 @@ var SimbriefParser = { fmgc.flightPlanController.flightplans[3].star = _star; } fmgc.flightPlanController.destroyTemporaryFlightPlan(3, 1); + + #var idx = 1; + #var plan = fmgc.flightPlanController.flightplans[2]; + #var altitude = ""; + #var speed = ""; + #var wpname = ""; + + #foreach (var ofpFix; ofpFixes) { + # ident = ofpFix.getNode("ident").getValue(); + + # if (ident == "TOC") wpname = "(T/C)"; + # else if (ident == "TOD") wpname = "(T/D)"; + # else wpname = ident; + + # wp = plan.getWP(idx); # get leg + # if (wp != nil) { + # if (wp.wp_name == wpname) { + # altitude = ofpFix.getNode("altitude_feet").getValue(); + # speed = ofpFix.getNode("ind_airspeed").getValue(); + + # if (speed>0) wp.setSpeed(speed, "computed"); + # if (altitude>0) wp.setAltitude(math.round(altitude, 10), "computed"); +# +# idx = idx + 1; +# } +# } +# } + fmgc.windController.updatePlans(); fmgc.updateRouteManagerAlt(); @@ -199,6 +232,8 @@ var SimbriefParser = { if (me.buildFlightplan() == nil) { return nil; } + #fmgc.FMGCInternal.coRoute = "SB" ~ me.OFP.getNode("origin/iata_code").getValue() ~ me.OFP.getNode("destination/iata_code").getValue() ~ "00"; + #fmgc.FMGCInternal.coRouteSet = 1; fmgc.FMGCInternal.flightNum = (me.OFP.getNode("general/icao_airline").getValue() or "") ~ (me.OFP.getNode("general/flight_number").getValue() or ""); fmgc.FMGCInternal.flightNumSet = 1; fmgc.FMGCInternal.costIndex = me.OFP.getNode("general/costindex").getValue(); diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index 8ac87b43..f741725c 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -69,6 +69,7 @@ var scratchpadController = { sp.scratchpadColour = "wht"; sp.showTypeIMsg = 0; sp.showTypeIIMsg = 0; + sp.clrmode = 0; # 1 = CLR mode sp.mcdu = mcdu; return sp; }, @@ -88,6 +89,11 @@ var scratchpadController = { me.clearTypeI(); } + if (me.clrmode == 1) { # prevent add chars in CLR mode + me.clear(); + } + else if (character == "CLR") me.clrmode = 1; + me.scratchpad = me.scratchpad ~ character; me.scratchpadColour = "wht"; me.update(); @@ -140,6 +146,7 @@ var scratchpadController = { }, empty: func() { me.scratchpad = ""; + me.clrmode = 0; me.update(); }, clear: func() { diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index f086d6fd..f3cab9a5 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -68,9 +68,21 @@ var fplnItem = { me.spd = me.getSpd(); me.alt = me.getAlt(); me.dist = me.getDist(); - me._colour = "wht"; - if (me.spd[1] != "wht" or me.alt[1] != "wht") { - me._colour = "mag"; + if (me.colour != "yel") { # not temporary flightplan + me._colour = "wht"; + #if (me.spd[1] != "wht" or me.alt[1] != "wht") { + if (me.spd[1] == me.alt[1]) { + me._colour = me.spd[1]; + } + else if (me.spd[1] == "mag" or me.alt[1] == "mag") { + me._colour = "mag"; + } + else if (me.spd[1] == "grn" or me.alt[1] == "grn") { + me._colour = "grn"; + } + + } else { # temporary flightplan + me._colour = "yel"; } return [me.spd[0] ~ "/" ~ me.alt[0], " " ~ me.dist ~ "NM ", me._colour]; } else { @@ -95,23 +107,25 @@ var fplnItem = { }, getSpd: func() { if (me.index == 0 and left(me.wp.wp_name, 4) == fmgc.FMGCInternal.depApt and fmgc.FMGCInternal.v1set) { - return [sprintf("%3.0f", math.round(fmgc.FMGCInternal.v1)), "mag"]; - } elsif (me.wp.speed_cstr != nil and me.wp.speed_cstr != 0) { - return [sprintf("%3.0f", me.wp.speed_cstr), "mag"]; + return [sprintf("%3.0f", math.round(fmgc.FMGCInternal.v1)), "grn"]; # why "mag"? I think "grn" + } elsif (me.wp.speed_cstr != nil and me.wp.speed_cstr > 0) { + var tcol = (me.wp.speed_cstr_type == "computed" or me.wp.speed_cstr_type == "computed_mach") ? "grn" : "mag"; # TODO - check if only computed + return [sprintf("%3.0f", me.wp.speed_cstr), tcol]; } else { return ["---", "wht"]; } }, getAlt: func() { if (me.index == 0 and left(me.wp.wp_name, 4) == fmgc.FMGCInternal.depApt and fmgc.flightPlanController.flightplans[me.plan].departure != nil) { - return [" " ~ sprintf("%-5.0f", math.round(fmgc.flightPlanController.flightplans[me.plan].departure.elevation * M2FT)), "mag"]; + return [" " ~ sprintf("%5.0f", math.round(fmgc.flightPlanController.flightplans[me.plan].departure.elevation * M2FT)), "grn"]; #fixed - aligned to right } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1) and fmgc.flightPlanController.fromWptAlt != nil) { return [" " ~ fmgc.flightPlanController.fromWptAlt, "mag"]; - } elsif (me.wp.alt_cstr != nil and me.wp.alt_cstr != 0) { + } elsif (me.wp.alt_cstr != nil and me.wp.alt_cstr > 0) { + var tcol = (me.wp.alt_cstr_type == "computed" or me.wp.alt_cstr_type == "computed_mach") ? "grn" : "mag"; # TODO - check if only computed if (me.wp.alt_cstr > fmgc.FMGCInternal.transAlt) { - return [" " ~ sprintf("%-5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)), "mag"]; + return [" " ~ sprintf("%5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)), tcol]; #fixed - aligned to right } else { - return [" " ~ sprintf("%-5.0f", me.wp.alt_cstr), "mag"]; + return [" " ~ sprintf("%5.0f", me.wp.alt_cstr), tcol]; #fixed - aligned to right } } else { return ["------", "wht"]; @@ -337,7 +351,7 @@ var fplnPage = { # this one is only created once, and then updated - remember th if (size(me.outputList) >= 1) { me.L1 = me.outputList[0].updateLeftText(); me.C1 = me.outputList[0].updateCenterText(); - me.C1[1] = "TIME "; + me.C1[1] = (fmgc.flightPlanController.fromWptTime != nil) ? "UTC " : "TIME "; # since TO change to UTC time (1 space left to center) me.R1 = me.outputList[0].updateRightText(); me.R1[1] = "SPD/ALT "; } else { diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index e734af23..00e02637 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -5,7 +5,40 @@ var initInputA = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (key == "L2") { + if (key == "L1") { #clear coRoute if set + if (scratchpad == "CLR") { + if (fmgc.FMGCInternal.coRouteSet == 1) { + fmgc.FMGCInternal.coRouteSet = 0; + fmgc.FMGCInternal.coRoute = ""; + fmgc.FMGCInternal.depApt = ""; + fmgc.FMGCInternal.arrApt = ""; + fmgc.FMGCInternal.toFromSet = 0; + fmgc.FMGCNodes.toFromSet.setValue(0); + fmgc.windController.resetDesWinds(); + setprop("/FMGC/internal/align-ref-lat", 0); + setprop("/FMGC/internal/align-ref-long", 0); + setprop("/FMGC/internal/align-ref-lat-edit", 0); + setprop("/FMGC/internal/align-ref-long-edit", 0); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.fuelCalculating.setValue(0); + fmgc.FMGCInternal.fuelCalculating = 1; + fmgc.fuelCalculating.setValue(1); + } + fmgc.flightPlanController.reset(2); + fmgc.flightPlanController.init(); + Simbrief.SimbriefParser.inhibit = 0; + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + var len = size(scratchpad); + if (fmgc.FMGCInternal.coRouteSet == 1 or len != 10) { + mcdu_message(i, "NOT ALLOWED"); + } else { + mcdu_message(i, "NOT IN DATA BASE"); # fake message - TODO flightplan loader + } + } + } else if (key == "L2") { if (scratchpad == "CLR") { fmgc.FMGCInternal.altAirport = ""; fmgc.FMGCInternal.altAirportSet = 0; @@ -183,7 +216,10 @@ var initInputA = func(key, i) { } } } else if (key == "R1") { - if (scratchpad == "CLR") { + if (fmgc.FMGCInternal.coRouteSet == 1) { + mcdu_message(i, "NOT ALLOWED"); + } + else if (scratchpad == "CLR") { fmgc.FMGCInternal.depApt = ""; fmgc.FMGCInternal.arrApt = ""; fmgc.FMGCInternal.toFromSet = 0; diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index f4bfac92..7650653f 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -75,6 +75,8 @@ var MCDU_reset = func(i) { fmgc.FMGCInternal.gndTempSet = 0; fmgc.FMGCInternal.toFromSet = 0; fmgc.FMGCNodes.toFromSet.setValue(0); + fmgc.FMGCInternal.coRoute = ""; + fmgc.FMGCInternal.coRouteSet = 0; fmgc.FMGCInternal.tropo = 36090; fmgc.FMGCInternal.tropoSet = 0; @@ -1484,7 +1486,9 @@ var pagebutton = func(btn, i) { } } -var button = func(btn, i) { +var buttonCLRDown = [0,0]; # counter for down event + +var button = func(btn, i, event = "") { page = pageNode[i].getValue(); if (page != "MCDU") { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; @@ -1493,11 +1497,24 @@ var button = func(btn, i) { } else if (btn == "SP") { mcdu_scratchpad.scratchpads[i].addChar(" "); } else if (btn == "CLR") { - var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (size(scratchpad) == 0) { - mcdu_scratchpad.scratchpads[i].addChar("CLR"); - } else { - mcdu_scratchpad.scratchpads[i].clear(); + if (event == "down") { + if (size(scratchpad) > 0) { + if (buttonCLRDown[i] > 4) { + mcdu_scratchpad.scratchpads[i].empty(); + } + buttonCLRDown[i] = buttonCLRDown[i] + 1; + } + } + else if (event == "" or buttonCLRDown[i]<=4) { + buttonCLRDown[i] = 0; + #var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; <- useless?? + if (size(scratchpad) == 0) { + mcdu_scratchpad.scratchpads[i].addChar("CLR"); + } else { + mcdu_scratchpad.scratchpads[i].clear(); + } + } else { # up with buttonCLRDown[i]>4 + buttonCLRDown[i] = 0; } } else if (btn == "DOT") { mcdu_scratchpad.scratchpads[i].addChar("."); @@ -1514,6 +1531,12 @@ var mcdu_message = func(i, string, overrideStr = "") { mcdu_scratchpad.scratchpads[i].override(overrideStr); } +# Messagge Type II - TODO 5 messages queue - remove only on resolve +var mcdu_messageTypeII = func(i, string, overrideStr = "") { + mcdu_scratchpad.scratchpads[i].showTypeII(mcdu_scratchpad.MessageController.getTypeIIMsgByText(string)); + mcdu_scratchpad.scratchpads[i].override(overrideStr); +} + var screenFlash = func(time, i) { page = pageNode[i].getValue(); pageNode[i].setValue("NONE"); diff --git a/Nasal/MCDU/PERFTO.nas b/Nasal/MCDU/PERFTO.nas index fc0d92dc..d4cdcd29 100644 --- a/Nasal/MCDU/PERFTO.nas +++ b/Nasal/MCDU/PERFTO.nas @@ -3,6 +3,22 @@ # Copyright (c) 2020 Josh Davidson (Octal450) # Copyright (c) 2020 Matthew Maring (mattmaring) +# VMCA 109.5 at 0ft +# VMCG 106.5 at 0ft all conf + +var standard_VMCA = 109.5; # TODO calculate VMCA/VMCG on altitude (ft) of departure airport (read below) +var standard_VMCG = 106.5; + +# TODO - DepArp elevation or current elevation (on ground only!!) -> math.round(fmgc.flightPlanController.flightplans[2].departure.elevation * M2FT)) + +var perfTOCheckVSpeeds = func(i) { + if (fmgc.FMGCInternal.v1set == 1 and fmgc.FMGCInternal.vrset == 1 and fmgc.FMGCInternal.v2set == 1) { # only when v1/vr/v2 all sets + if (fmgc.FMGCInternal.v1>fmgc.FMGCInternal.vr or fmgc.FMGCInternal.vr > fmgc.FMGCInternal.v2) mcdu_messageTypeII(i,"V1/VR/V2 DISAGREE"); + else if (fmgc.FMGCInternal.v1= 3 and thrreds <= 5) and thrred >= 400 and thrred <= 39000 and int(acc) != nil and (accs == 3 or accs == 4 or accs == 5) and acc >= 400 and acc <= 39000) { - setprop("/systems/thrust/clbreduc-ft", int(thrred / 10) * 10); - setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); - setprop("MCDUC/thracc-set", 1); - mcdu_scratchpad.scratchpads[i].empty(); + + if (thrred<=acc) { # validation + setprop("/systems/thrust/clbreduc-ft", int(thrred / 10) * 10); + setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); + setprop("MCDUC/thracc-set", 1); + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else if (thrreds == 0 and int(acc) != nil and (accs >= 3 and accs <= 5) and acc >= 400 and acc <= 39000) { setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); mcdu_scratchpad.scratchpads[i].empty();