diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 481fff12..8090bdb3 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -111,6 +111,7 @@ rotate ddrmi_hdg instrumentation/ddrmi/heading + -1 ddrmi_hdg.axis @@ -121,6 +122,7 @@ ddrmi_pointer_1 rotate instrumentation/ddrmi/needle-1 + -1 ddrmi_hdg.axis @@ -131,6 +133,7 @@ ddrmi_pointer_2 rotate instrumentation/ddrmi/needle-2 + -1 ddrmi_hdg.axis @@ -148,7 +151,7 @@ property-adjust instrumentation/ddrmi/vor-adf-1 - -1 + 0 1 @@ -160,8 +163,7 @@ ddrmi_vor_adf_select_1 instrumentation/ddrmi/vor-adf-1 - -190 - 045 + 090 1 0 @@ -180,7 +182,7 @@ property-adjust instrumentation/ddrmi/vor-adf-2 - -1 + 0 1 @@ -192,8 +194,7 @@ ddrmi_vor_adf_select_2 instrumentation/ddrmi/vor-adf-2 - -1-90 - 0-45 + 0-90 1 0 @@ -9037,8 +9038,6 @@ default - - dme1_0 @@ -9101,14 +9100,74 @@ default + + dme_flag + + -0.529 + -0.149 + 0.1305 + 90 + 72.81 + + right-center + xy-plane + literal + ---- + false + left-to-right + true + false + false + led.txf + 0.007 + 1.0 + 0.012 + 0.040 + + 32 + 32 + + default + + + + dme1_flag + + -0.529 + -0.116 + 0.1305 + 90 + 72.81 + + right-center + xy-plane + literal + ---- + false + left-to-right + true + false + false + led.txf + 0.007 + 1.0 + 0.012 + 0.040 + + 32 + 32 + + default + + material dme_0 dme - + dme_flag dme1_0 dme1 - + dme1_flag 1.00 0.355 @@ -9149,8 +9208,8 @@ - systems/electrical/bus/dc-ess - 25 + systems/electrical/bus/ac-ess + 110 instrumentation/ddrmi/vor-adf-1 @@ -9176,8 +9235,8 @@ 20 - systems/electrical/bus/dc-ess - 25 + systems/electrical/bus/ac-ess + 110 instrumentation/ddrmi/vor-adf-1 @@ -9205,8 +9264,8 @@ - systems/electrical/bus/dc-ess - 25 + systems/electrical/bus/ac-ess + 110 instrumentation/ddrmi/vor-adf-2 @@ -9232,8 +9291,46 @@ 20.0 - systems/electrical/bus/dc-ess - 25.0 + systems/electrical/bus/ac-ess + 110.0 + + + instrumentation/ddrmi/vor-adf-2 + 1 + + + + + + + select + dme_flag + + + instrumentation/dme[2]/operable + instrumentation/dme[2]/in-range + + systems/electrical/bus/ac-ess + 110.0 + + + instrumentation/ddrmi/vor-adf-1 + 1 + + + + + + + select + dme1_flag + + + instrumentation/dme[3]/operable + instrumentation/dme[3]/in-range + + systems/electrical/bus/ac-ess + 110.0 instrumentation/ddrmi/vor-adf-2 diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 71fce2af..1274ff65 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -84,24 +84,6 @@ var database1 = props.globals.getNode("/FMGC/internal/navdatabase", 1); var database2 = props.globals.getNode("/FMGC/internal/navdatabase2", 1); var databaseCode = props.globals.getNode("/FMGC/internal/navdatabasecode", 1); -# RADNAV -var vor1 = props.globals.getNode("/FMGC/internal/vor1-mcdu", 1); -var vor2 = props.globals.getNode("/FMGC/internal/vor2-mcdu", 1); -var ils1 = props.globals.getNode("/FMGC/internal/ils1-mcdu", 1); -var adf1 = props.globals.getNode("/FMGC/internal/adf1-mcdu", 1); -var adf2 = props.globals.getNode("/FMGC/internal/adf2-mcdu", 1); -var vor1FreqSet = props.globals.getNode("/FMGC/internal/vor1freq-set", 1); -var vor1CRSSet = props.globals.getNode("/FMGC/internal/vor1crs-set", 1); -var vor2FreqSet = props.globals.getNode("/FMGC/internal/vor2freq-set", 1); -var vor2CRSSet = props.globals.getNode("/FMGC/internal/vor2crs-set", 1); -var ils1FreqSet = props.globals.getNode("/FMGC/internal/ils1freq-set", 1); -var ils1CRSSet = props.globals.getNode("/FMGC/internal/ils1crs-set", 1); -var adf1FreqSet = props.globals.getNode("/FMGC/internal/adf1freq-set", 1); -var adf2FreqSet = props.globals.getNode("/FMGC/internal/adf2freq-set", 1); -var ils1CRS = props.globals.getNode("/instrumentation/nav[0]/radials/selected-deg", 1); -var vor1CRS = props.globals.getNode("/instrumentation/nav[2]/radials/selected-deg", 1); -var vor2CRS = props.globals.getNode("/instrumentation/nav[3]/radials/selected-deg", 1); - # INT-A var ADIRSMCDUBTN = props.globals.getNode("/controls/adirs/mcducbtn", 1); @@ -2578,8 +2560,8 @@ var canvas_MCDU_base = { me["Simple_L0S"].hide(); showLeftS(me,1, 1, 1, 1, 1, -1); showLeftArrow(me,-1, -1, -1, -1, -1, -1); - showRight(me,1, 1, 1, 1, 1, -1); - showRightS(me,1, 1, 1, 1, 1, -1); + showRight(me,1, 1, -1, -1, 1, -1); + showRightS(me,1, 1, -1, -1, 1, -1); showRightArrow(me,-1, -1, -1, -1, -1, -1); me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); @@ -2594,86 +2576,107 @@ var canvas_MCDU_base = { me.colorLeft("blu", "blu", "blu", "blu", "blu", "blu"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "blu"); me.colorCenter("wht", "wht", "wht", "wht", "wht", "grn"); me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRight("blu", "blu", "blu", "blu", "blu", "blu"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "blu"); pageSwitch[i].setBoolValue(1); } - if (vor1FreqSet.getValue() == 1) { + if (fmgc.FMGCInternal.VOR1.freqSet) { me["Simple_L1"].setFontSize(normal); } else { me["Simple_L1"].setFontSize(small); } - if (vor1CRSSet.getValue() == 1) { + if (fmgc.FMGCInternal.VOR1.crsSet) { me["Simple_L2"].setFontSize(normal); } else { me["Simple_L2"].setFontSize(small); } - if (ils1FreqSet.getValue() == 1) { + if (fmgc.FMGCInternal.ILS.freqSet) { me["Simple_L3"].setFontSize(normal); } else { me["Simple_L3"].setFontSize(small); } - if (ils1CRSSet.getValue() == 1) { + if (fmgc.FMGCInternal.ILS.crsSet) { me["Simple_L4"].setFontSize(normal); } else { me["Simple_L4"].setFontSize(small); } - if (adf1FreqSet.getValue() == 1) { + + me["Simple_L6"].setText(" ADF1 BFO"); + me["Simple_R6"].setText("ADF2 BFO "); + + if (fmgc.FMGCInternal.ADF1.freqSet) { me["Simple_L5"].setFont(default); me["Simple_L5"].setFontSize(normal); - me["Simple_L5"].setText(sprintf("%s", adf1.getValue())); + me["Simple_L5"].setText(sprintf(" %s", fmgc.FMGCInternal.ADF1.mcdu)); + me["Simple_L6"].show(); + + if (rmp.BFOActive[0].getValue()) { + # TODO - wrong arrow + me["Simple_L6_Arrow"].hide(); + } else { + me["Simple_L6_Arrow"].show(); + } } else { me["Simple_L5"].setFont(symbol); me["Simple_L5"].setFontSize(small); - me["Simple_L5"].setText("[ ]/[ ]"); + me["Simple_L5"].setText("[ ]/[ .]"); + me["Simple_L6"].hide(); + me["Simple_L6_Arrow"].hide(); } - if (vor2FreqSet.getValue() == 1) { + if (fmgc.FMGCInternal.VOR2.freqSet) { me["Simple_R1"].setFontSize(normal); } else { me["Simple_R1"].setFontSize(small); } - if (vor2CRSSet.getValue() == 1) { + if (fmgc.FMGCInternal.VOR2.crsSet) { me["Simple_R2"].setFontSize(normal); } else { me["Simple_R2"].setFontSize(small); } - if (adf2FreqSet.getValue() == 1) { + + if (fmgc.FMGCInternal.ADF2.freqSet) { me["Simple_R5"].setFont(default); me["Simple_R5"].setFontSize(normal); - me["Simple_R5"].setText(sprintf("%s", adf2.getValue())); + me["Simple_R5"].setText(sprintf("%s ", fmgc.FMGCInternal.ADF2.mcdu)); + me["Simple_R6"].show(); + + if (rmp.BFOActive[1].getValue()) { + # TODO - wrong arrow + me["Simple_R6_Arrow"].hide(); + } else { + me["Simple_R6_Arrow"].show(); + } } else { me["Simple_R5"].setFont(symbol); me["Simple_R5"].setFontSize(small); - me["Simple_R5"].setText("[ ]/[ ]"); + me["Simple_R5"].setText("[ .]/[ ]"); + me["Simple_R6"].hide(); + me["Simple_R6_Arrow"].hide(); } - me["Simple_L1"].setText(" " ~ vor1.getValue()); - me["Simple_L2"].setText(sprintf("%3.0f", vor1CRS.getValue())); - me["Simple_L3"].setText(" " ~ ils1.getValue()); - me["Simple_L4"].setText(sprintf("%3.0f", ils1CRS.getValue())); + me["Simple_L1"].setText(" " ~ fmgc.FMGCInternal.VOR1.mcdu); + me["Simple_L2"].setText(sprintf("%03.0f", pts.Instrumentation.Nav.Radials.selectedDeg[2].getValue())); + me["Simple_L3"].setText(" " ~ fmgc.FMGCInternal.ILS.mcdu); + me["Simple_L4"].setText(sprintf("%03.0f", pts.Instrumentation.Nav.Radials.selectedDeg[0].getValue())); me["Simple_L1S"].setText("VOR1/FREQ"); me["Simple_L2S"].setText("CRS"); me["Simple_L3S"].setText("ILS /FREQ"); me["Simple_L4S"].setText("CRS"); me["Simple_L5S"].setText("ADF1/FREQ"); - me["Simple_R1"].setText(" " ~ vor2.getValue()); - me["Simple_R2"].setText(sprintf("%3.0f", vor2CRS.getValue())); - me["Simple_R3"].setText("[ ]/[ ]"); - me["Simple_R4"].setText("-.- [ ]"); + me["Simple_R1"].setText(" " ~ fmgc.FMGCInternal.VOR2.mcdu); + me["Simple_R2"].setText(sprintf("%03.0f", pts.Instrumentation.Nav.Radials.selectedDeg[3].getValue())); me["Simple_R1S"].setText("FREQ/VOR2"); me["Simple_R2S"].setText("CRS"); - me["Simple_R3S"].setText("CHAN/ MLS"); - me["Simple_R4S"].setText("SLOPE CRS"); me["Simple_R5S"].setText("FREQ/ADF2"); - if (getprop("systems/radio/rmp[0]/nav") or getprop("systems/radio/rmp[1]/nav")) { + if (rmp.rmpNav[0].getValue() or rmp.rmpNav[1].getValue()) { me["Simple_L1"].hide(); me["Simple_L2"].hide(); me["Simple_L3"].hide(); @@ -2681,8 +2684,6 @@ var canvas_MCDU_base = { me["Simple_L5"].hide(); me["Simple_R1"].hide(); me["Simple_R2"].hide(); - me["Simple_R3"].hide(); - me["Simple_R4"].hide(); me["Simple_R5"].hide(); } else { me["Simple_L1"].show(); @@ -2692,8 +2693,6 @@ var canvas_MCDU_base = { me["Simple_L5"].show(); me["Simple_R1"].show(); me["Simple_R2"].show(); - me["Simple_R3"].show(); - me["Simple_R4"].show(); me["Simple_R5"].show(); } } else if (page == "INITA") { diff --git a/Models/Instruments/ND/canvas/framework/navdisplay.nas b/Models/Instruments/ND/canvas/framework/navdisplay.nas index 2693461b..e144ab0d 100644 --- a/Models/Instruments/ND/canvas/framework/navdisplay.nas +++ b/Models/Instruments/ND/canvas/framework/navdisplay.nas @@ -212,7 +212,8 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update # because things are much better configurable that way # now look up all required SVG elements and initialize member fields using the same name to have a convenient handle foreach(var element; ["dmeL","dmeR","vorL","vorR","vorLId","vorRId", - "status.wxr","status.wpt","status.sta","status.arpt","terrHI","terrLO","TerrLabel","terrAhead","terrAltGroup"]) + "status.wxr","status.wpt","status.sta","status.arpt","terrHI","terrLO","TerrLabel","terrAhead","terrAltGroup", + "vorLIdtuneMode","vorRIdtuneMode"]) me.symbols[element] = me.nd.getElementById(element); foreach(var element; ["dmeLDist","dmeRDist"]) @@ -572,7 +573,31 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec var dme1_path = "/instrumentation/dme[2]"; var dme2_path = "/instrumentation/dme[3]"; + + if(me.get_switch("toggle_lh_vor_adf") == 1) { + if (fmgc.FMGCInternal.VOR1.freqSet) { + me.symbols.vorLIdtuneMode.show(); + } else { + me.symbols.vorLIdtuneMode.hide(); + } + } else if(me.get_switch("toggle_lh_vor_adf") == -1) { + if (fmgc.FMGCInternal.ADF1.freqSet) { + me.symbols.vorLIdtuneMode.show(); + } else { + me.symbols.vorLIdtuneMode.hide(); + } + } else { + me.symbols.vorLIdtuneMode.hide(); + } + if(me.get_switch("toggle_rh_vor_adf") == 1) { + + if (fmgc.FMGCInternal.VOR2.freqSet) { + me.symbols.vorRIdtuneMode.show(); + } else { + me.symbols.vorRIdtuneMode.hide(); + } + me.symbols.vorR.setText("VOR R"); me.symbols.vorR.setColor(0.195,0.96,0.097); me.symbols.dmeR.setText("DME"); @@ -587,17 +612,25 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec else me.symbols.dmeRDist.setText(" ---"); me.symbols.dmeRDist.setColor(0.195,0.96,0.097); } elsif(me.get_switch("toggle_rh_vor_adf") == -1) { + + if (fmgc.FMGCInternal.ADF2.freqSet) { + me.symbols.vorRIdtuneMode.show(); + } else { + me.symbols.vorRIdtuneMode.hide(); + } + me.symbols.vorR.setText("ADF R"); me.symbols.vorR.setColor(0,0.6,0.85); me.symbols.dmeR.setText(""); me.symbols.dmeR.setColor(0,0.6,0.85); if((var navident=getprop("/instrumentation/adf[1]/ident")) != "") me.symbols.vorRId.setText(navident); - else me.symbols.vorRId.setText(sprintf("%3d",getprop("/instrumentation/adf[1]/frequencies/selected-khz"))); + else me.symbols.vorRId.setText(sprintf("%3d",pts.Instrumentation.Adf.Frequencies.selectedKhz[1].getValue())); me.symbols.vorRId.setColor(0,0.6,0.85); me.symbols.dmeRDist.setText(""); me.symbols.dmeRDist.setColor(0,0.6,0.85); } else { + me.symbols.vorRIdtuneMode.hide(); me.symbols.vorR.setText(""); me.symbols.dmeR.setText(""); me.symbols.vorRId.setText(""); diff --git a/Models/Instruments/ND/canvas/res/airbusND.svg b/Models/Instruments/ND/canvas/res/airbusND.svg index 363030ba..281ec49e 100644 --- a/Models/Instruments/ND/canvas/res/airbusND.svg +++ b/Models/Instruments/ND/canvas/res/airbusND.svg @@ -1,19 +1,19 @@ TERRTERRAHEAD -TERR -000 + id="tspan1248">AHEAD 000 + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#179ab7;fill-opacity:1;stroke:none" + x="952.74292" + y="826.34009" + id="TerrLabel" + inkscape:label="#text7243">TERR +000 +000 VOR 1 + x="41.859375" + y="919.5495">VOR1 ABC + x="126.51562" + y="956.56171">ABCMM VOR 2 + style="font-size:32px;line-height:1.25;fill:#0dc04b"> VOR2 ABC + style="font-size:32px;line-height:1.25;fill:#0dc04b"> ABC + sodipodi:nodetypes="cscc" + inkscape:connector-curvature="0" + id="altArc" + d="m 351.124,888.591 c 0,0 72.1,-39.455 161.041,-39.455 88.941,0 161.041,39.455 161.041,39.455 v 0" + style="fill:none;stroke:#00ff00;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0" + inkscape:label="#path3888-1" /> 999 + y="993.85461">999 .9 + id="tspan1329" + sodipodi:role="line" + style="font-size:24px;line-height:1.25;fill:#0dc04b">.9 999 + id="tspan3084" + sodipodi:role="line" + style="font-size:32px;line-height:1.25;text-align:end;text-anchor:end;fill:#0dc04b">999 .9 + y="993.85461">.9 GPS PRIMARY LOST + style="opacity:0.99;fill:none;stroke:#ffffff;stroke-width:3.15591;stroke-miterlimit:4;stroke-dasharray:none" + id="nd_warn_msgbox" + width="563.05048" + height="46.844471" + x="230.3676" + y="919.6969" />GPS PRIMARY LOST TA ONLY + style="opacity:0.99;fill:none;stroke:#ffffff;stroke-width:3.15591;stroke-miterlimit:4;stroke-dasharray:none" + id="taOnlyBox" + width="563.05048" + height="46.844471" + x="230.3676" + y="871.6969" />TA ONLY + inkscape:label="#text7243" + id="text3549-7" + y="-258.81296" + x="-364.83682" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:36px;line-height:125%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(0.34999975)" /> HDG + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:53.3333px;line-height:0%;font-family:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;fill:#ff0000;fill-opacity:1;stroke:none" + x="511.82605" + y="292.91833" + id="nd_warn_hdg" + inkscape:label="#text3239">HDG MAP NOT AVAIL + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:53.3333px;line-height:0%;font-family:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;fill:#ff0000;fill-opacity:1;stroke:none" + x="510.7153" + y="399.58936" + id="nd_warn_map" + inkscape:label="#text3239">MAP NOT AVAIL RANGE CHANGE - \ No newline at end of file + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:53.3333px;line-height:0%;font-family:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + x="510.7153" + y="537.58936" + id="nd_msg_change" + inkscape:label="#text3401">RANGE CHANGE + diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index 650ce7d2..64559918 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -797,7 +797,7 @@ canvas.NDStyles["Airbus"] = { if(nd.get_switch("toggle_display_mode") == "APP") nd.symbols.ilsLbl.setText("ILS"); else - nd.symbols.ilsLbl.setText("VOR 1"); + nd.symbols.ilsLbl.setText("VOR1"); }, is_false: func(nd) nd.symbols.ilsLbl.hide(), }, @@ -1386,9 +1386,9 @@ canvas.NDStyles["Airbus"] = { is_true: func(nd) { nd.symbols.vorCrsPtr.show(); if (is_ils) { - nd.symbols.vorCrsPtr.setRotation((getprop("/instrumentation/nav[0]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); + nd.symbols.vorCrsPtr.setRotation((pts.Instrumentation.Nav.Radials.selectedDeg[0].getValue()-nd.aircraft_source.get_hdg_mag())*D2R); } else { - nd.symbols.vorCrsPtr.setRotation((getprop("/instrumentation/nav[2]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); + nd.symbols.vorCrsPtr.setRotation((pts.Instrumentation.Nav.Radials.selectedDeg[2].getValue()-nd.aircraft_source.get_hdg_mag())*D2R); } }, @@ -1406,9 +1406,10 @@ canvas.NDStyles["Airbus"] = { var type = (is_ils ? "ils" : "vor"); var path = nd.get_nav_path(type, 0); if (is_ils) { - nd.symbols.vorCrsPtr2.setRotation((getprop("/instrumentation/nav[0]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); + nd.symbols.vorCrsPtr2.setRotation((pts.Instrumentation.Nav.Radials.selectedDeg[0].getValue()-nd.aircraft_source.get_hdg_mag())*D2R); } else { - nd.symbols.vorCrsPtr2.setRotation((getprop("/instrumentation/nav[2]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); + # TODO - 3? + nd.symbols.vorCrsPtr2.setRotation((pts.Instrumentation.Nav.Radials.selectedDeg[2].getValue()-nd.aircraft_source.get_hdg_mag())*D2R); } var line = nd.symbols.vorCrsPtr2.getElementById("vorCrsPtr2_line"); if(!is_ils){ @@ -1498,9 +1499,7 @@ canvas.NDStyles["Airbus"] = { }, is_true: func(nd) { nd.symbols.locTrkPointer.show(); - var crs = getprop("/instrumentation/nav/radials/selected-deg"); - var rotation = (crs - nd.aircraft_source.get_hdg_tru())*D2R; - nd.symbols.locTrkPointer.setRotation(rotation); + nd.symbols.locTrkPointer.setRotation( (pts.Instrumentation.Nav.Radials.selectedDeg[0].getValue() - nd.aircraft_source.get_hdg_tru()) * D2R); }, is_false: func(nd) nd.symbols.locTrkPointer.hide(), }, @@ -1660,13 +1659,13 @@ canvas.NDStyles["Airbus"] = { is_true: func(nd) { nd.symbols.dmeL.show(); if(nd.get_switch("toggle_lh_vor_adf") < 0){ - nd.symbols.vorL.setText("ADF 1"); + nd.symbols.vorL.setText("ADF1"); nd.symbols.vorL.setColor(0.195,0.96,0.097); nd.symbols.vorLId.setColor(0.195,0.96,0.097); #nd.symbols.dmeLDist.setColor(0.195,0.96,0.097); nd.symbols.dmeL.setText(""); } else { - nd.symbols.vorL.setText("VOR 1"); + nd.symbols.vorL.setText("VOR1"); nd.symbols.vorL.setColor(1,1,1); nd.symbols.vorLId.setColor(1,1,1); #nd.symbols.dmeLDist.setColor(1,1,1); @@ -1687,12 +1686,12 @@ canvas.NDStyles["Airbus"] = { is_true: func(nd) { nd.symbols.dmeR.show(); if(nd.get_switch("toggle_rh_vor_adf") < 0){ - nd.symbols.vorR.setText("ADF 2"); + nd.symbols.vorR.setText("ADF2"); nd.symbols.vorR.setColor(0.195,0.96,0.097); nd.symbols.vorRId.setColor(0.195,0.96,0.097); nd.symbols.dmeR.setText(""); } else { - nd.symbols.vorR.setText("VOR 2"); + nd.symbols.vorR.setText("VOR2"); nd.symbols.vorR.setColor(1,1,1); nd.symbols.vorRId.setColor(1,1,1); #nd.symbols.dmeRDist.setColor(1,1,1); @@ -1718,10 +1717,11 @@ canvas.NDStyles["Airbus"] = { var adf = "instrumentation/adf/"; var navident = getprop(adf~ "ident"); var frq = getprop(adf~ "frequencies/selected-khz"); - if(navident != "") + if(navident != "") { nd.symbols.vorLId.setText(navident); - else + } else { nd.symbols.vorLId.setText(sprintf("%3d", frq)); + } nd.symbols.dmeLDist.setText(""); } else { var nav = nd.get_nav_path("vor", 0); @@ -1730,10 +1730,11 @@ canvas.NDStyles["Airbus"] = { var dme = nd.get_nav_path("dme", 0); var dst = getprop(dme~ "indicated-distance-nm"); #print(dme~ "indicated-distance-nm"); - if(getprop(nav~ "in-range")) + if(getprop(nav~ "in-range")) { nd.symbols.vorLId.setText(navID); - else + } else { nd.symbols.vorLId.setText(frq); + } if(getprop(dme~ "in-range")) nd.symbols.dmeLDist.setText(sprintf("%3.1f", dst)); @@ -1775,10 +1776,11 @@ canvas.NDStyles["Airbus"] = { var adf = "instrumentation/adf[1]/"; var navident = getprop(adf~ "ident"); var frq = getprop(adf~ "frequencies/selected-khz"); - if(navident != "") + if(navident != "") { nd.symbols.vorRId.setText(navident); - else + } else { nd.symbols.vorRId.setText(sprintf("%3d", frq)); + } nd.symbols.dmeRDist.setText(""); } else { var nav = nd.get_nav_path("vor", 1); @@ -1787,10 +1789,11 @@ canvas.NDStyles["Airbus"] = { var dme = nd.get_nav_path("dme", 1); var dst = getprop(dme~ "indicated-distance-nm"); #print(dme~ "indicated-distance-nm"); - if(getprop(nav~ "in-range")) + if(getprop(nav~ "in-range")) { nd.symbols.vorRId.setText(navID); - else + } else { nd.symbols.vorRId.setText(frq); + } if(getprop(dme~ "in-range")) nd.symbols.dmeRDist.setText(sprintf("%3.1f", dst)); diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 2b501d28..4177ca1c 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -522,42 +522,6 @@ var canvas_pfd = { obj["GS_scale"].hide(); } }), - props.UpdateManager.FromHashList(["pfdILS1","pfdILS2","dmeInRange","dmeDistance","pfdILSMcdu"], nil, func(val) { - if ((obj.number == 0 and val.pfdILS1) or (obj.number == 1 and val.pfdILS2)) { - obj.split_ils = split("/", val.pfdILSMcdu); - if (size(obj.split_ils) < 2) { - obj["ils_freq"].setText(obj.split_ils[0]); - obj["ils_freq"].show(); - obj["ils_code"].hide(); - obj["dme_dist"].hide(); - obj["dme_dist_legend"].hide(); - } else { - obj["ils_code"].setText(obj.split_ils[0]); - obj["ils_freq"].setText(obj.split_ils[1]); - obj["ils_code"].show(); - obj["ils_freq"].show(); - - if (val.dmeInRange) { - obj["dme_dist"].show(); - obj["dme_dist_legend"].show(); - - if (val.dmeDistance < 20.0) { - obj["dme_dist"].setText(sprintf("%1.1f", val.dmeDistance)); - } else { - obj["dme_dist"].setText(sprintf("%2.0f", val.dmeDistance)); - } - } else { - obj["dme_dist"].hide(); - obj["dme_dist_legend"].hide(); - } - } - } else { - obj["ils_code"].hide(); - obj["ils_freq"].hide(); - obj["dme_dist"].hide(); - obj["dme_dist_legend"].hide(); - } - }), props.UpdateManager.FromHashList(["hasLocalizer","hasGlideslope","signalQuality","localizerInRange","glideslopeInRange","pfdILS1","pfdILS2"], nil, func(val) { if (((obj.number == 0 and val.pfdILS1) or (obj.number == 1 and val.pfdILS2)) and val.localizerInRange and val.hasLocalizer and val.signalQuality > 0.99) { obj["LOC_pointer"].show(); @@ -747,50 +711,6 @@ var canvas_pfd = { obj["HDG_target"].hide(); } }), - props.UpdateManager.FromHashList(["pfdILSMcdu","headingPFD","pfdILS1","pfdILS2","ilsCrs"], nil, func(val) { - obj.split_ils = split("/", val.pfdILSMcdu); - - if (((obj.number == 0 and val.pfdILS1) or (obj.number == 1 and val.pfdILS2)) and size(obj.split_ils) == 2) { - obj.magnetic_hdg = val.ilsCrs; - obj.magnetic_hdg_dif = geo.normdeg180(obj.magnetic_hdg - val.headingPFD); - if (obj.magnetic_hdg_dif >= -23.62 and obj.magnetic_hdg_dif <= 23.62) { - obj["CRS_pointer"].setTranslation((obj.magnetic_hdg_dif / 10) * 98.5416, 0); - obj["ILS_HDG_R"].hide(); - obj["ILS_HDG_L"].hide(); - obj["CRS_pointer"].show(); - } else if (obj.magnetic_hdg_dif < -23.62 and obj.magnetic_hdg_dif >= -180) { - if (int(obj.magnetic_hdg) < 10) { - obj["ILS_left"].setText(sprintf("00%1.0f", int(obj.magnetic_hdg))); - } else if (int(obj.magnetic_hdg) < 100) { - obj["ILS_left"].setText(sprintf("0%2.0f", int(obj.magnetic_hdg))); - } else { - obj["ILS_left"].setText(sprintf("%3.0f", int(obj.magnetic_hdg))); - } - obj["ILS_HDG_L"].show(); - obj["ILS_HDG_R"].hide(); - obj["CRS_pointer"].hide(); - } else if (obj.magnetic_hdg_dif > 23.62 and obj.magnetic_hdg_dif <= 180) { - if (int(obj.magnetic_hdg) < 10) { - obj["ILS_right"].setText(sprintf("00%1.0f", int(obj.magnetic_hdg))); - } else if (int(obj.magnetic_hdg) < 100) { - obj["ILS_right"].setText(sprintf("0%2.0f", int(obj.magnetic_hdg))); - } else { - obj["ILS_right"].setText(sprintf("%3.0f", int(obj.magnetic_hdg))); - } - obj["ILS_HDG_R"].show(); - obj["ILS_HDG_L"].hide(); - obj["CRS_pointer"].hide(); - } else { - obj["ILS_HDG_R"].hide(); - obj["ILS_HDG_L"].hide(); - obj["CRS_pointer"].hide(); - } - } else { - obj["ILS_HDG_R"].hide(); - obj["ILS_HDG_L"].hide(); - obj["CRS_pointer"].hide(); - } - }), props.UpdateManager.FromHashList(["altimeterHpa","altimeterInhg","altimeterInhgMode"], nil, func(val) { if (val.altimeterInhgMode == 0) { obj["QNH_setting"].setText(sprintf("%4.0f", val.altimeterHpa)); @@ -1746,6 +1666,82 @@ var canvas_pfd = { } } + me.split_ils = split("/", fmgc.FMGCInternal.ILS.mcdu); + if ((me.number == 0 and notification.pfdILS1) or (me.number == 1 and notification.pfdILS2)) { + if (size(me.split_ils) < 2) { + me["ils_freq"].setText(me.split_ils[0]); + me["ils_freq"].show(); + me["ils_code"].hide(); + me["dme_dist"].hide(); + me["dme_dist_legend"].hide(); + } else { + me["ils_code"].setText(me.split_ils[0]); + me["ils_freq"].setText(me.split_ils[1]); + me["ils_code"].show(); + me["ils_freq"].show(); + + if (notification.dmeInRange) { + me["dme_dist"].show(); + me["dme_dist_legend"].show(); + + if (notification.dmeDistance < 20.0) { + me["dme_dist"].setText(sprintf("%1.1f", notification.dmeDistance)); + } else { + me["dme_dist"].setText(sprintf("%2.0f", notification.dmeDistance)); + } + } else { + me["dme_dist"].hide(); + me["dme_dist_legend"].hide(); + } + } + } else { + me["ils_code"].hide(); + me["ils_freq"].hide(); + me["dme_dist"].hide(); + me["dme_dist_legend"].hide(); + } + + if (((me.number == 0 and notification.pfdILS1) or (me.number == 1 and notification.pfdILS2)) and size(me.split_ils) == 2) { + me.magnetic_hdg = notification.ilsCrs; + me.magnetic_hdg_dif = geo.normdeg180(me.magnetic_hdg - notification.headingPFD); + if (me.magnetic_hdg_dif >= -23.62 and me.magnetic_hdg_dif <= 23.62) { + me["CRS_pointer"].setTranslation((me.magnetic_hdg_dif / 10) * 98.5416, 0); + me["ILS_HDG_R"].hide(); + me["ILS_HDG_L"].hide(); + me["CRS_pointer"].show(); + } else if (me.magnetic_hdg_dif < -23.62 and me.magnetic_hdg_dif >= -180) { + if (int(me.magnetic_hdg) < 10) { + me["ILS_left"].setText(sprintf("00%1.0f", int(me.magnetic_hdg))); + } else if (int(me.magnetic_hdg) < 100) { + me["ILS_left"].setText(sprintf("0%2.0f", int(me.magnetic_hdg))); + } else { + me["ILS_left"].setText(sprintf("%3.0f", int(me.magnetic_hdg))); + } + me["ILS_HDG_L"].show(); + me["ILS_HDG_R"].hide(); + me["CRS_pointer"].hide(); + } else if (me.magnetic_hdg_dif > 23.62 and me.magnetic_hdg_dif <= 180) { + if (int(me.magnetic_hdg) < 10) { + me["ILS_right"].setText(sprintf("00%1.0f", int(me.magnetic_hdg))); + } else if (int(me.magnetic_hdg) < 100) { + me["ILS_right"].setText(sprintf("0%2.0f", int(me.magnetic_hdg))); + } else { + me["ILS_right"].setText(sprintf("%3.0f", int(me.magnetic_hdg))); + } + me["ILS_HDG_R"].show(); + me["ILS_HDG_L"].hide(); + me["CRS_pointer"].hide(); + } else { + me["ILS_HDG_R"].hide(); + me["ILS_HDG_L"].hide(); + me["CRS_pointer"].hide(); + } + } else { + me["ILS_HDG_R"].hide(); + me["ILS_HDG_L"].hide(); + me["CRS_pointer"].hide(); + } + foreach(var update_item; me.update_items) { update_item.update(notification); @@ -2005,7 +2001,6 @@ var input = { pfdILS1: "/modes/pfd/ILS1", pfdILS2: "/modes/pfd/ILS2", - pfdILSMcdu: "/FMGC/internal/ils1-mcdu", markerO: "/instrumentation/marker-beacon/outer", markerM: "/instrumentation/marker-beacon/middle", diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index eba61129..7ca79fe1 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -32,24 +32,6 @@ var alt = 0; var altitude = 0; var flap = 0; var flaps = 0; -var freqnav0uf = 0; -var freqnav0 = 0; -var namenav0 = "XX"; -var freqnav1uf = 0; -var freqnav1 = 0; -var namenav1 = "XX"; -var freqnav2uf = 0; -var freqnav2 = 0; -var namenav2 = "XX"; -var freqnav3uf = 0; -var freqnav3 = 0; -var namenav3 = "XX"; -var freqadf0uf = 0; -var freqadf0 = 0; -var nameadf0 = "XX"; -var freqadf1uf = 0; -var freqadf1 = 0; -var nameadf1 = "XX"; var ias = 0; var mach = 0; var ktsmach = 0; @@ -66,18 +48,12 @@ var windSpeed = 0; var windsDidChange = 0; var tempOverspeed = nil; -setprop("position/gear-agl-ft", 0); +setprop("/position/gear-agl-ft", 0); setprop("/it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway setprop("/it-autoflight/internal/vert-speed-fpm", 0); setprop("/it-autoflight/output/fma-pwr", 0); setprop("/instrumentation/nav[0]/nav-id", "XXX"); setprop("/instrumentation/nav[1]/nav-id", "XXX"); -setprop("/FMGC/internal/ils1-mcdu", "XXX/999.99"); -setprop("/FMGC/internal/ils2-mcdu", "XXX/999.99"); -setprop("/FMGC/internal/vor1-mcdu", "XXX/999.99"); -setprop("/FMGC/internal/vor2-mcdu", "999.99/XXX"); -setprop("/FMGC/internal/adf1-mcdu", "XXX/999.99"); -setprop("/FMGC/internal/adf2-mcdu", "999.99/XXX"); var FMGCAlignDone = [props.globals.initNode("/FMGC/internal/align1-done", 0, "BOOL"), props.globals.initNode("/FMGC/internal/align2-done", 0, "BOOL"), props.globals.initNode("/FMGC/internal/align3-done", 0, "BOOL")]; var FMGCAlignTime = [props.globals.initNode("/FMGC/internal/align1-time", 0, "DOUBLE"), props.globals.initNode("/FMGC/internal/align2-time", 0, "DOUBLE"), props.globals.initNode("/FMGC/internal/align3-time", 0, "DOUBLE")]; @@ -245,6 +221,32 @@ var FMGCInternal = { mngKtsMach: 0, mngSpd: 0, mngSpdCmd: 0, + + # RADNAV + ADF1: { + freqSet: 0, + mcdu: "XXX/999.99" + }, + ADF2: { + freqSet: 0, + mcdu: "999.99/XXX" + }, + ILS: { + crsSet: 0, + freqCalculated: 0, + freqSet: 0, + mcdu: "XXX/999.99" + }, + VOR1: { + crsSet: 0, + freqSet: 0, + mcdu: "XXX/999.99" + }, + VOR2: { + crsSet: 0, + freqSet: 0, + mcdu: "999.99/XXX" + }, }; var postInit = func() { @@ -523,88 +525,54 @@ var updateFuel = func { ############################ # Flight Phase and Various # ############################ - +# TODO - if no ID is found, should trigger a NOT IN DATA BASE message +var freqnav0 = nil; var nav0 = func { - var freqnav0uf = getprop("/instrumentation/nav[0]/frequencies/selected-mhz"); - var freqnav0 = sprintf("%.2f", freqnav0uf); - var namenav0 = getprop("/instrumentation/nav[0]/nav-id") or ""; + freqnav0 = sprintf("%.2f", pts.Instrumentation.Nav.Frequencies.selectedMhz[0].getValue()); if (freqnav0 >= 108.10 and freqnav0 <= 111.95) { - if (namenav0 != "") { - setprop("/FMGC/internal/ils1-mcdu", namenav0 ~ "/" ~ freqnav0); - } else { - setprop("/FMGC/internal/ils1-mcdu", freqnav0); - } - } -} - -var nav1 = func { - var freqnav1uf = getprop("/instrumentation/nav[1]/frequencies/selected-mhz"); - var freqnav1 = sprintf("%.2f", freqnav1uf); - var namenav1 = getprop("/instrumentation/nav[1]/nav-id") or ""; - if (freqnav1 >= 108.10 and freqnav1 <= 111.95) { - if (namenav1 != "") { - setprop("/FMGC/internal/ils2-mcdu", freqnav1 ~ "/" ~ namenav1); - } else { - setprop("/FMGC/internal/ils2-mcdu", freqnav1); - } + var namenav0 = getprop("/instrumentation/nav[0]/nav-id") or " "; + fmgc.FMGCInternal.ILS.mcdu = namenav0 ~ "/" ~ freqnav0; } } +var freqnav2 = nil; var nav2 = func { - var freqnav2uf = getprop("/instrumentation/nav[2]/frequencies/selected-mhz"); - var freqnav2 = sprintf("%.2f", freqnav2uf); - var namenav2 = getprop("/instrumentation/nav[2]/nav-id") or ""; + freqnav2 = sprintf("%.2f", pts.Instrumentation.Nav.Frequencies.selectedMhz[2].getValue()); if (freqnav2 >= 108.00 and freqnav2 <= 117.95) { - if (namenav2 != "") { - setprop("/FMGC/internal/vor1-mcdu", namenav2 ~ "/" ~ freqnav2); - } else { - setprop("/FMGC/internal/vor1-mcdu", freqnav2); - } + var namenav2 = getprop("/instrumentation/nav[2]/nav-id") or " "; + fmgc.FMGCInternal.VOR1.mcdu = namenav2 ~ "/" ~ freqnav2; } } +var freqnav3 = nil; var nav3 = func { - var freqnav3uf = getprop("/instrumentation/nav[3]/frequencies/selected-mhz"); - var freqnav3 = sprintf("%.2f", freqnav3uf); - var namenav3 = getprop("/instrumentation/nav[3]/nav-id") or ""; + freqnav3 = sprintf("%.2f", pts.Instrumentation.Nav.Frequencies.selectedMhz[3].getValue()); if (freqnav3 >= 108.00 and freqnav3 <= 117.95) { - if (namenav3 != "") { - setprop("/FMGC/internal/vor2-mcdu", freqnav3 ~ "/" ~ namenav3); - } else { - setprop("/FMGC/internal/vor2-mcdu", freqnav3); - } + var namenav3 = getprop("/instrumentation/nav[3]/nav-id") or " "; + fmgc.FMGCInternal.VOR2.mcdu = freqnav3 ~ "/" ~ namenav3; } } +var freqadf0 = nil; var adf0 = func { - var freqadf0uf = getprop("/instrumentation/adf[0]/frequencies/selected-khz"); - var freqadf0 = sprintf("%.2f", freqadf0uf); - var nameadf0 = getprop("/instrumentation/adf[0]/ident") or ""; - if (freqadf0 >= 190 and freqadf0 <= 1750) { - if (nameadf0 != "") { - setprop("/FMGC/internal/adf1-mcdu", nameadf0 ~ "/" ~ freqadf0); - } else { - setprop("/FMGC/internal/adf1-mcdu", freqadf0); - } + freqadf0 = sprintf("%.1f", pts.Instrumentation.Adf.Frequencies.selectedKhz[0].getValue()); + if (freqadf0 >= 190 and freqadf0 <= 1799) { + var nameadf0 = pts.Instrumentation.Adf.ident[0].getValue() or " "; + fmgc.FMGCInternal.ADF1.mcdu = nameadf0 ~ "/" ~ freqadf0; } } +var freqadf1 = nil; var adf1 = func { - var freqadf1uf = getprop("/instrumentation/adf[1]/frequencies/selected-khz"); - var freqadf1 = sprintf("%.2f", freqadf1uf); - var nameadf1 = getprop("/instrumentation/adf[1]/ident") or ""; - if (freqadf1 >= 190 and freqadf1 <= 1750) { - if (nameadf1 != "") { - setprop("/FMGC/internal/adf2-mcdu", freqadf1 ~ "/" ~ nameadf1); - } else { - setprop("/FMGC/internal/adf2-mcdu", freqadf1); - } + freqadf1 = sprintf("%.1f", pts.Instrumentation.Adf.Frequencies.selectedKhz[1].getValue()); + if (freqadf1 >= 190 and freqadf1 <= 1799) { + var nameadf1 = pts.Instrumentation.Adf.ident[1].getValue() or " "; + fmgc.FMGCInternal.ADF2.mcdu = freqadf1 ~ "/" ~ nameadf1; } } var radios = maketimer(1, func() { nav0(); - nav1(); nav2(); nav3(); adf0(); @@ -962,28 +930,28 @@ var updateAirportRadios = func { setprop("/FMGC/internal/ldg-elev", airport.elevation * M2FT); # eventually should be runway elevation magnetic_hdg = geo.normdeg(destination_rwy.heading - getprop("/environment/magnetic-variation-deg")); runway_ils = destination_rwy.ils_frequency_mhz; - if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) { - setprop("/FMGC/internal/ils1freq-calculated", runway_ils); - setprop("/instrumentation/nav[0]/frequencies/selected-mhz", runway_ils); - setprop("/instrumentation/nav[0]/radials/selected-deg", magnetic_hdg); - } elsif (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) { - setprop("/FMGC/internal/ils1freq-calculated", runway_ils); - setprop("/instrumentation/nav[0]/frequencies/selected-mhz", runway_ils); - } elsif (!getprop("/FMGC/internal/ils1crs-set")) { - setprop("/instrumentation/nav[0]/radials/selected-deg", magnetic_hdg); + if (runway_ils != nil and !fmgc.FMGCInternal.ILS.freqSet and !fmgc.FMGCInternal.ILS.crsSet) { + fmgc.FMGCInternal.ILS.freqCalculated = runway_ils; + pts.Instrumentation.Nav.Frequencies.selectedMhz[0].setValue(runway_ils); + pts.Instrumentation.Nav.Radials.selectedDeg[0].setValue(magnetic_hdg); + } elsif (runway_ils != nil and !fmgc.FMGCInternal.ILS.freqSet) { + fmgc.FMGCInternal.ILS.freqCalculated = runway_ils; + pts.Instrumentation.Nav.Frequencies.selectedMhz[0].setValue(runway_ils); + } elsif (!fmgc.FMGCInternal.ILS.crsSet) { + pts.Instrumentation.Nav.Radials.selectedDeg[0].setValue(magnetic_hdg); } } elsif (airportRadiosPhase <= 1 and departure_rwy != nil) { magnetic_hdg = geo.normdeg(departure_rwy.heading - getprop("/environment/magnetic-variation-deg")); runway_ils = departure_rwy.ils_frequency_mhz; - if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) { - setprop("/FMGC/internal/ils1freq-calculated", runway_ils); - setprop("/instrumentation/nav[0]/frequencies/selected-mhz", runway_ils); - setprop("/instrumentation/nav[0]/radials/selected-deg", magnetic_hdg); - } elsif (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) { - setprop("/FMGC/internal/ils1freq-calculated", runway_ils); - setprop("/instrumentation/nav[0]/frequencies/selected-mhz", runway_ils); - } elsif (!getprop("/FMGC/internal/ils1crs-set")) { - setprop("/instrumentation/nav[0]/radials/selected-deg", magnetic_hdg); + if (runway_ils != nil and !fmgc.FMGCInternal.ILS.freqSet and !fmgc.FMGCInternal.ILS.crsSet) { + fmgc.FMGCInternal.ILS.freqCalculated = runway_ils; + pts.Instrumentation.Nav.Frequencies.selectedMhz[0].setValue(runway_ils); + pts.Instrumentation.Nav.Radials.selectedDeg[0].setValue(magnetic_hdg); + } elsif (runway_ils != nil and !fmgc.FMGCInternal.ILS.freqSet) { + fmgc.FMGCInternal.ILS.freqCalculated = runway_ils; + pts.Instrumentation.Nav.Frequencies.selectedMhz[0].setValue(runway_ils); + } elsif (!fmgc.FMGCInternal.ILS.crsSet) { + pts.Instrumentation.Nav.Radials.selectedDeg[0].setValue(magnetic_hdg); } } @@ -1248,6 +1216,7 @@ setlistener("/FMGC/internal/fuel-calculating", func() { var timer30secLanding = maketimer(1, func() { if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/landing-time") + 30) { FMGCInternal.phase = 7; + if (FMGCInternal.costIndexSet) { setprop("/FMGC/internal/last-cost-index", FMGCInternal.costIndex); } else { diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 833fb4da..b88890eb 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -154,6 +154,12 @@ var Gear = { }; var Instrumentation = { + Adf: { + ident: [props.globals.getNode("/instrumentation/adf[0]/ident"), props.globals.getNode("/instrumentation/adf[1]/ident")], + Frequencies: { + selectedKhz: [props.globals.getNode("/instrumentation/adf[0]/frequencies/selected-khz"), props.globals.getNode("/instrumentation/adf[1]/frequencies/selected-khz")], + }, + }, AirspeedIndicator: { indicatedSpdKt: props.globals.getNode("/instrumentation/airspeed-indicator/indicated-speed-kt"), indicatedMach: props.globals.getNode("/instrumentation/airspeed-indicator/indicated-mach"), @@ -205,6 +211,12 @@ var Instrumentation = { }, }, Nav: { + Frequencies: { + selectedMhz: [props.globals.getNode("/instrumentation/nav[0]/frequencies/selected-mhz"), props.globals.getNode("/instrumentation/nav[1]/frequencies/selected-mhz"), props.globals.getNode("/instrumentation/nav[2]/frequencies/selected-mhz"), props.globals.getNode("/instrumentation/nav[3]/frequencies/selected-mhz")], + }, + Radials: { + selectedDeg: [props.globals.getNode("/instrumentation/nav[0]/radials/selected-deg"), props.globals.getNode("/instrumentation/nav[1]/radials/selected-deg"), props.globals.getNode("/instrumentation/nav[2]/radials/selected-deg"), props.globals.getNode("/instrumentation/nav[3]/radials/selected-deg")], + }, gsDeflection: props.globals.getNode("/instrumentation/nav[0]/gs-needle-deflection-norm"), locDeflection: props.globals.getNode("/instrumentation/nav[0]/heading-needle-deflection-norm"), }, diff --git a/Nasal/MCDU/DATA.nas b/Nasal/MCDU/DATA.nas index 7afe6763..6ef87d1c 100644 --- a/Nasal/MCDU/DATA.nas +++ b/Nasal/MCDU/DATA.nas @@ -11,13 +11,13 @@ var dataInput = func(key, i) { setprop("MCDU[" ~ i ~ "]/page", "GPSMON"); } elsif (key == "L5") { if (canvas_mcdu.myClosestAirport[i] != nil) { - canvas_mcdu.myClosestAirport[i].del(); + canvas_mcdu.myClosestAirport[i].del(); } canvas_mcdu.myClosestAirport[i] = nil; canvas_mcdu.myClosestAirport[i] = closestAirportPage.new(i); setprop("MCDU[" ~ i ~ "]/page", "CLOSESTAIRPORT"); } elsif (key == "R5") { - setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC"); + mcdu_message(i, "PRINTER NOT AVAILABLE"); } } diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 29e5a1af..8931782a 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -45,15 +45,15 @@ var MCDU_reset = func(i) { setprop("/FMGC/print/mcdu/page2/R4req", 0); #RADNAV - setprop("/FMGC/internal/ils1freq-set", 0); - setprop("/FMGC/internal/ils1crs-set", 0); - setprop("/FMGC/internal/ils1freq-calculated", 0); - setprop("/FMGC/internal/vor1freq-set", 0); - setprop("/FMGC/internal/vor1crs-set", 0); - setprop("/FMGC/internal/vor2freq-set", 0); - setprop("/FMGC/internal/vor2crs-set", 0); - setprop("/FMGC/internal/adf1freq-set", 0); - setprop("/FMGC/internal/adf2freq-set", 0); + fmgc.FMGCInternal.ILS.freqSet = 0; + fmgc.FMGCInternal.ILS.freqCalculated = 0; + fmgc.FMGCInternal.ILS.crsSet = 0; + fmgc.FMGCInternal.VOR1.freqSet = 0; + fmgc.FMGCInternal.VOR1.crsSet = 0; + fmgc.FMGCInternal.VOR2.freqSet = 0; + fmgc.FMGCInternal.VOR2.crsSet = 0; + fmgc.FMGCInternal.ADF1.freqSet = 0; + fmgc.FMGCInternal.ADF2.freqSet = 0; # INT-A fmgc.FMGCInternal.altAirport = ""; @@ -256,10 +256,6 @@ var lskbutton = func(btn, i) { radnavInput("L1",i); } else if (page == "DATA") { dataInput("L1",i); - } else if (page == "PRINTFUNC") { - printInput("L1",i); - } else if (page == "PRINTFUNC2") { - printInput2("L1",i); } else if (page == "LATREV") { if (canvas_mcdu.myLatRev[i].type == 0) { if (canvas_mcdu.myDeparture[i] != nil) { @@ -410,10 +406,6 @@ var lskbutton = func(btn, i) { perfDESInput("L2",i); } else if (page == "DATA") { dataInput("L2",i); - } else if (page == "PRINTFUNC") { - printInput("L2",i); - } else if (page == "PRINTFUNC2") { - printInput2("L2",i); } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(2); } else if (page == "DEPARTURE") { @@ -537,10 +529,6 @@ var lskbutton = func(btn, i) { radnavInput("L3",i); } else if (page == "DATA") { dataInput("L3",i); - } else if (page == "PRINTFUNC") { - printInput("L3",i); - } else if (page == "PRINTFUNC2") { - printInput2("L3",i); } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(3); } else if (page == "DEPARTURE") { @@ -664,8 +652,6 @@ var lskbutton = func(btn, i) { perfAPPRInput("L4",i); } else if (page == "RADNAV") { radnavInput("L4",i); - } else if (page == "PRINTFUNC2") { - printInput2("L4",i); } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(4); } else if (page == "DEPARTURE") { @@ -784,10 +770,6 @@ var lskbutton = func(btn, i) { perfGAInput("L5",i); } else if (page == "RADNAV") { radnavInput("L5",i); - } else if (page == "PRINTFUNC") { - printInput("L5",i); - } else if (page == "PRINTFUNC2") { - printInput2("L5",i); } else if (page == "DATA") { dataInput("L5",i); } else if (page == "DATA2") { @@ -843,6 +825,8 @@ var lskbutton = func(btn, i) { pageNode[i].setValue("WINDCLB"); } else if (page == "ROUTESELECTION") { initInputROUTESEL("L6",i); + } else if (page == "RADNAV") { + radnavInput("L6",i); } else if (page == "PERFCLB") { perfCLBInput("L6",i); } else if (page == "PERFCRZ") { @@ -853,8 +837,6 @@ var lskbutton = func(btn, i) { perfAPPRInput("L6",i); } else if (page == "PERFGA") { perfGAInput("L6",i); - } else if (page == "PRINTFUNC2") { - printInput2("L6",i); } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(6); } else if (page == "LATREV" or page == "VERTREV" or page == "DUPLICATENAMES") { @@ -930,10 +912,6 @@ var rskbutton = func(btn, i) { canvas_mcdu.myDESWIND[i].pushButtonRight(1); } else if (page == "RADNAV") { radnavInput("R1",i); - } else if (page == "PRINTFUNC") { - printInput("R1",i); - } else if (page == "PRINTFUNC2") { - printInput2("R1",i); } else if (page == "LATREV") { if (canvas_mcdu.myLatRev[i].type == 1) { if (canvas_mcdu.myArrival[i] != nil) { @@ -1006,10 +984,6 @@ var rskbutton = func(btn, i) { perfAPPRInput("R2",i); } else if (page == "RADNAV") { radnavInput("R2",i); - } else if (page == "PRINTFUNC") { - printInput("R2",i); - } else if (page == "PRINTFUNC2") { - printInput2("R2",i); } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonRight(2); } else if (page == "ARRIVAL") { @@ -1051,10 +1025,6 @@ var rskbutton = func(btn, i) { perfTOInput("R3",i); } else if (page == "PERFAPPR") { perfAPPRInput("R3",i); - } else if (page == "PRINTFUNC") { - printInput("R3",i); - } else if (page == "PRINTFUNC2") { - printInput2("R3",i); } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonRight(3); } else if (page == "ARRIVAL") { @@ -1144,8 +1114,6 @@ var rskbutton = func(btn, i) { perfAPPRInput("R4",i); } else if (page == "RADNAV") { radnavInput("R4",i); - } else if (page == "PRINTFUNC2") { - printInput2("R4",i); } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonRight(4); } else if (page == "ARRIVAL") { @@ -1282,10 +1250,12 @@ var rskbutton = func(btn, i) { perfDESInput("R6",i); } else if (page == "PERFAPPR") { perfAPPRInput("R6",i); - } else if ((page == "DATA") or (page == "PRINTFUNC") or (page == "PRINTFUNC2")) { + } else if (page == "DATA") { mcdu_message(i, "AOC DISABLED"); } else if (page == "INITA") { initInputA("R6",i); + } else if (page == "RADNAV") { + radnavInput("R6",i); } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonRight(6); } else if (page == "VERTREV") { @@ -1339,10 +1309,6 @@ var arrowbutton = func(btn, i) { } } else if (page == "INITB" or page == "FUELPRED") { pageNode[i].setValue("INITA"); - } else if (page == "PRINTFUNC") { - pageNode[i].setValue("PRINTFUNC2"); - } else if (page == "PRINTFUNC2") { - pageNode[i].setValue("PRINTFUNC"); } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].scrollLeft(); } else if (page == "ARRIVAL") { @@ -1371,10 +1337,6 @@ var arrowbutton = func(btn, i) { } } else if (page == "INITB" or page == "FUELPRED") { pageNode[i].setValue("INITA"); - } else if (page == "PRINTFUNC") { - pageNode[i].setValue("PRINTFUNC2"); - } else if (page == "PRINTFUNC2") { - pageNode[i].setValue("PRINTFUNC"); } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].scrollRight(); } else if (page == "ARRIVAL") { diff --git a/Nasal/MCDU/RADNAV.nas b/Nasal/MCDU/RADNAV.nas index 316fb799..2a5098e8 100644 --- a/Nasal/MCDU/RADNAV.nas +++ b/Nasal/MCDU/RADNAV.nas @@ -1,49 +1,158 @@ # A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring) - # Copyright (c) 2020 Josh Davidson (Octal450) +var radNavScratchpad = nil; +var radNavScratchpadSize = nil; + +var parseFrequencyVOR = func(scratchpad, i, num) { + if (size(scratchpad) == 3 or size(scratchpad) == 5 or size(scratchpad) == 6) { + if (scratchpad >= 108.00 and scratchpad <= 111.95) { + if (scratchpad == 108.10 or scratchpad == 108.15 or scratchpad == 108.30 or scratchpad == 108.35 or scratchpad == 108.50 or scratchpad == 108.55 or scratchpad == 108.70 or scratchpad == 108.75 or scratchpad == 108.90 or scratchpad == 108.95 + or scratchpad == 109.10 or scratchpad == 109.15 or scratchpad == 109.30 or scratchpad == 109.35 or scratchpad == 109.50 or scratchpad == 109.55 or scratchpad == 109.70 or scratchpad == 109.75 or scratchpad == 109.90 or scratchpad == 109.95 + or scratchpad == 110.10 or scratchpad == 110.15 or scratchpad == 110.30 or scratchpad == 110.35 or scratchpad == 110.50 or scratchpad == 110.55 or scratchpad == 110.70 or scratchpad == 110.75 or scratchpad == 110.90 or scratchpad == 110.95 + or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) { + return 3; + } else { + pts.Instrumentation.Nav.Frequencies.selectedMhz[num].setValue(scratchpad); + return 4; + } + } else if (scratchpad >= 112.00 and scratchpad <= 117.95) { + pts.Instrumentation.Nav.Frequencies.selectedMhz[num].setValue(scratchpad); + return 4; + } else { + return 2; + } + } else { + return 1; + } +} + +var searchResultVOR = nil; +var parseIdentVOR = func(scratchpad, i, num) { + # TODO - duplicate names + if (size(scratchpad) == 2 or size(scratchpad) == 3) { + searchResultVOR = findNavaidsByID(scratchpad); + if (size(searchResultVOR) != 0) { + pts.Instrumentation.Nav.Frequencies.selectedMhz[num].setValue(searchResultVOR[0].frequency / 100); + return 3; + } else { + return 2; + } + } else { + return 1; + } +}; + +var splitScratchpadADF = nil; +var parseFrequencyADF = func(scratchpad, i, num) { + if (size(scratchpad) >= 3 and size(scratchpad) <= 6) { + if (scratchpad >= 190 and scratchpad <= 1799) { + if (scratchpad != int(scratchpad)) { + splitScratchpadADF = split(".",scratchpad); + if (size(splitScratchpadADF) != 2 or splitScratchpadADF[1] != "5") { + return 3; + } else { + pts.Instrumentation.Adf.Frequencies.selectedKhz[num].setValue(scratchpad); + return 4; + } + } else { + pts.Instrumentation.Adf.Frequencies.selectedKhz[num].setValue(scratchpad); + return 4; + } + } else { + return 2; + } + } else { + return 1; + } +} + +var searchResultADF = nil; +var parseIdentADF = func(scratchpad, i, num) { + # TODO - duplicate names + if (size(scratchpad) == 2 or size(scratchpad) == 3) { + searchResultADF = findNavaidsByID(scratchpad); + if (size(searchResultADF) != 0) { + pts.Instrumentation.Adf.Frequencies.selectedKhz[num].setValue(searchResultADF[0].frequency / 100); + return 3; + } else { + return 2; + } + } else { + return 1; + } +}; + +var returny = nil; var radnavInput = func(key, i) { - var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (!getprop("/systems/radio/rmp[0]/nav") and !getprop("/systems/radio/rmp[1]/nav")) { + radNavScratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + radNavScratchpadSize = size(radNavScratchpad); + if (!rmp.rmpNav[0].getValue() and !rmp.rmpNav[1].getValue()) { if (key == "L1") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/vor1freq-set", 0); + if (radNavScratchpad == "CLR") { + fmgc.FMGCInternal.VOR1.freqSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { - var tfs = size(scratchpad); - if (tfs == 3 or tfs == 5 or tfs == 6) { - if (scratchpad >= 108.00 and scratchpad <= 111.95) { - if (scratchpad == 108.10 or scratchpad == 108.15 or scratchpad == 108.30 or scratchpad == 108.35 or scratchpad == 108.50 or scratchpad == 108.55 or scratchpad == 108.70 or scratchpad == 108.75 or scratchpad == 108.90 or scratchpad == 108.95 - or scratchpad == 109.10 or scratchpad == 109.15 or scratchpad == 109.30 or scratchpad == 109.35 or scratchpad == 109.50 or scratchpad == 109.55 or scratchpad == 109.70 or scratchpad == 109.75 or scratchpad == 109.90 or scratchpad == 109.95 - or scratchpad == 110.10 or scratchpad == 110.15 or scratchpad == 110.30 or scratchpad == 110.35 or scratchpad == 110.50 or scratchpad == 110.55 or scratchpad == 110.70 or scratchpad == 110.75 or scratchpad == 110.90 or scratchpad == 110.95 - or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) { - mcdu_message(i, "NOT ALLOWED"); + if (size(split("/", radNavScratchpad)) == 2) { + if (size(split("/", radNavScratchpad)[0]) != 0) { + mcdu_message(i, "FORMAT ERROR"); + return; + } else { + radNavScratchpad = split("/", radNavScratchpad)[1]; + if (num(radNavScratchpad) != radNavScratchpad) { + mcdu_message(i, "FORMAT ERROR"); } else { - setprop("instrumentation/nav[2]/frequencies/selected-mhz", scratchpad); - setprop("/FMGC/internal/vor1freq-set", 1); + returny = parseFrequencyVOR(radNavScratchpad, i, 2); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.VOR1.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } + } + } else if (size(split("/", radNavScratchpad)) == 1) { + if (num(radNavScratchpad) == radNavScratchpad) { + returny = parseFrequencyVOR(radNavScratchpad, i, 2); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.VOR1.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } else if (isstr(radNavScratchpad)) { + returny = parseIdentVOR(radNavScratchpad, i, 2); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + # TODO - NEW NAVAID page + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (returny == 3) { + fmgc.FMGCInternal.VOR1.freqSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } - } else if (scratchpad >= 112.00 and scratchpad <= 117.95) { - setprop("instrumentation/nav[2]/frequencies/selected-mhz", scratchpad); - setprop("/FMGC/internal/vor1freq-set", 1); - mcdu_scratchpad.scratchpads[i].empty(); - } else { - mcdu_message(i, "NOT ALLOWED"); } } else { - mcdu_message(i, "NOT ALLOWED"); + mcdu_message(i, "FORMAT ERROR"); } } } else if (key == "L2") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/vor1crs-set", 0); + if (radNavScratchpad == "CLR") { + fmgc.FMGCInternal.VOR1.crsSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { - var tfs = size(scratchpad); - if (tfs >= 1 and tfs <= 3) { - if (scratchpad >= 0 and scratchpad <= 360) { - setprop("instrumentation/nav[2]/radials/selected-deg", scratchpad); - setprop("/FMGC/internal/vor1crs-set", 1); + if (radNavScratchpadSize >= 1 and radNavScratchpadSize <= 3) { + if (radNavScratchpad >= 0 and radNavScratchpad <= 360) { + pts.Instrumentation.Nav.Radials.selectedDeg[2].setValue(radNavScratchpad); + fmgc.FMGCInternal.VOR1.crsSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -53,21 +162,20 @@ var radnavInput = func(key, i) { } } } else if (key == "L3") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/ils1freq-set", 0); + if (radNavScratchpad == "CLR") { + fmgc.FMGCInternal.ILS.freqSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { - var tfs = size(scratchpad); - if (tfs == 3 or tfs == 5 or tfs == 6) { - if (scratchpad >= 108.00 and scratchpad <= 111.95) { - if (scratchpad == 108.10 or scratchpad == 108.15 or scratchpad == 108.30 or scratchpad == 108.35 or scratchpad == 108.50 or scratchpad == 108.55 or scratchpad == 108.70 or scratchpad == 108.75 or scratchpad == 108.90 or scratchpad == 108.95 - or scratchpad == 109.10 or scratchpad == 109.15 or scratchpad == 109.30 or scratchpad == 109.35 or scratchpad == 109.50 or scratchpad == 109.55 or scratchpad == 109.70 or scratchpad == 109.75 or scratchpad == 109.90 or scratchpad == 109.95 - or scratchpad == 110.10 or scratchpad == 110.15 or scratchpad == 110.30 or scratchpad == 110.35 or scratchpad == 110.50 or scratchpad == 110.55 or scratchpad == 110.70 or scratchpad == 110.75 or scratchpad == 110.90 or scratchpad == 110.95 - or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) { - setprop("instrumentation/nav[0]/frequencies/selected-mhz", scratchpad); - setprop("/FMGC/internal/ils1freq-set", 1); + if (radNavScratchpadSize == 3 or radNavScratchpadSize == 5 or radNavScratchpadSize == 6) { + if (radNavScratchpad >= 108.00 and radNavScratchpad <= 111.95) { + if (radNavScratchpad == 108.10 or radNavScratchpad == 108.15 or radNavScratchpad == 108.30 or radNavScratchpad == 108.35 or radNavScratchpad == 108.50 or radNavScratchpad == 108.55 or radNavScratchpad == 108.70 or radNavScratchpad == 108.75 or radNavScratchpad == 108.90 or radNavScratchpad == 108.95 + or radNavScratchpad == 109.10 or radNavScratchpad == 109.15 or radNavScratchpad == 109.30 or radNavScratchpad == 109.35 or radNavScratchpad == 109.50 or radNavScratchpad == 109.55 or radNavScratchpad == 109.70 or radNavScratchpad == 109.75 or radNavScratchpad == 109.90 or radNavScratchpad == 109.95 + or radNavScratchpad == 110.10 or radNavScratchpad == 110.15 or radNavScratchpad == 110.30 or radNavScratchpad == 110.35 or radNavScratchpad == 110.50 or radNavScratchpad == 110.55 or radNavScratchpad == 110.70 or radNavScratchpad == 110.75 or radNavScratchpad == 110.90 or radNavScratchpad == 110.95 + or radNavScratchpad == 111.10 or radNavScratchpad == 111.15 or radNavScratchpad == 111.30 or radNavScratchpad == 111.35 or radNavScratchpad == 111.50 or radNavScratchpad == 111.55 or radNavScratchpad == 111.70 or radNavScratchpad == 111.75 or radNavScratchpad == 111.90 or radNavScratchpad == 111.95) { + pts.Instrumentation.Nav.Frequencies.selectedMhz[0].setValue(radNavScratchpad); + fmgc.FMGCInternal.ILS.freqSet = 1; mcdu_scratchpad.scratchpads[i].empty(); - if (num(getprop("/FMGC/internal/ils1freq-calculated")) != 0 and num(getprop("/FMGC/internal/ils1freq-calculated")) != num(getprop("instrumentation/nav[0]/frequencies/selected-mhz"))) { + if (num(fmgc.FMGCInternal.ILS.freqCalculated) != 0 and num(fmgc.FMGCInternal.ILS.freqCalculated) != num(pts.Instrumentation.Nav.Frequencies.selectedMhz[0].getValue())) { mcdu_message(i, "RWY/LS MISMATCH"); } } else { @@ -81,15 +189,14 @@ var radnavInput = func(key, i) { } } } else if (key == "L4") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/ils1crs-set", 0); + if (radNavScratchpad == "CLR") { + fmgc.FMGCInternal.ILS.crsSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { - var tfs = size(scratchpad); - if (tfs >= 1 and tfs <= 3) { - if (scratchpad >= 0 and scratchpad <= 360) { - setprop("instrumentation/nav[0]/radials/selected-deg", scratchpad); - setprop("/FMGC/internal/ils1crs-set", 1); + if (radNavScratchpadSize >= 1 and radNavScratchpadSize <= 3) { + if (radNavScratchpad >= 0 and radNavScratchpad <= 360) { + pts.Instrumentation.Nav.Radials.selectedDeg[0].setValue(radNavScratchpad); + fmgc.FMGCInternal.ILS.crsSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -99,62 +206,141 @@ var radnavInput = func(key, i) { } } } else if (key == "L5") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/adf1freq-set", 0); + if (radNavScratchpad == "CLR") { + fmgc.FMGCInternal.ADF1.freqSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { - var tfs = size(scratchpad); - if (tfs == 3 or tfs == 4) { - if (scratchpad >= 190 and scratchpad <= 1750) { - setprop("instrumentation/adf[0]/frequencies/selected-khz", scratchpad); - setprop("/FMGC/internal/adf1freq-set", 1); - mcdu_scratchpad.scratchpads[i].empty(); + if (size(split("/", radNavScratchpad)) == 2) { + if (size(split("/", radNavScratchpad)[0]) != 0) { + mcdu_message(i, "FORMAT ERROR"); + return; } else { - mcdu_message(i, "NOT ALLOWED"); - } - } else { - mcdu_message(i, "NOT ALLOWED"); - } - } - } else if (key == "R1") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/vor2freq-set", 0); - mcdu_scratchpad.scratchpads[i].empty(); - } else { - var tfs = size(scratchpad); - if (tfs == 3 or tfs == 5 or tfs == 6) { - if (scratchpad >= 108.10 and scratchpad <= 111.95) { - if (scratchpad == 108.10 or scratchpad == 108.15 or scratchpad == 108.30 or scratchpad == 108.35 or scratchpad == 108.50 or scratchpad == 108.55 or scratchpad == 108.70 or scratchpad == 108.75 or scratchpad == 108.90 or scratchpad == 108.95 - or scratchpad == 109.10 or scratchpad == 109.15 or scratchpad == 109.30 or scratchpad == 109.35 or scratchpad == 109.50 or scratchpad == 109.55 or scratchpad == 109.70 or scratchpad == 109.75 or scratchpad == 109.90 or scratchpad == 109.95 - or scratchpad == 110.10 or scratchpad == 110.15 or scratchpad == 110.30 or scratchpad == 110.35 or scratchpad == 110.50 or scratchpad == 110.55 or scratchpad == 110.70 or scratchpad == 110.75 or scratchpad == 110.90 or scratchpad == 110.95 - or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) { - mcdu_message(i, "NOT ALLOWED"); + radNavScratchpad = split("/", radNavScratchpad)[1]; + if (num(radNavScratchpad) != radNavScratchpad) { + mcdu_message(i, "FORMAT ERROR"); } else { - setprop("instrumentation/nav[3]/frequencies/selected-mhz", scratchpad); - setprop("/FMGC/internal/vor2freq-set", 1); + returny = parseFrequencyADF(radNavScratchpad, i, 0); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.ADF1.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } + } + } else if (size(split("/", radNavScratchpad)) == 1) { + if (num(radNavScratchpad) == radNavScratchpad) { + returny = parseFrequencyADF(radNavScratchpad, i, 0); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.ADF1.freqSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } - } else if (scratchpad >= 112.00 and scratchpad <= 117.95) { - setprop("instrumentation/nav[3]/frequencies/selected-mhz", scratchpad); - setprop("/FMGC/internal/vor2freq-set", 1); - mcdu_scratchpad.scratchpads[i].empty(); + } else if (isstr(radNavScratchpad)) { + returny = parseIdentADF(radNavScratchpad, i, 0); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + # TODO - NEW NAVAID page + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (returny == 3) { + fmgc.FMGCInternal.ADF1.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } + } else { + mcdu_message(i, "FORMAT ERROR"); + } + } + } else if (key == "L6") { + if (fmgc.FMGCInternal.ADF1.freqSet) { + if (radNavScratchpad == "CLR" and rmp.BFOActive[0].getValue()) { + rmp.BFOActive[0].setValue(0); + mcdu_scratchpad.scratchpads[i].empty(); + } else { + if (radNavScratchpadSize == 0 and !rmp.BFOActive[0].getValue()) { + rmp.BFOActive[0].setValue(1); } else { mcdu_message(i, "NOT ALLOWED"); } + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else if (key == "R1") { + if (radNavScratchpad == "CLR") { + fmgc.FMGCInternal.VOR2.freqSet = 0; + mcdu_scratchpad.scratchpads[i].empty(); + } else { + if (size(split("/", radNavScratchpad)) == 2) { + if (size(split("/", radNavScratchpad)[1]) != 0) { + mcdu_message(i, "FORMAT ERROR"); + return; + } else { + radNavScratchpad = split("/", radNavScratchpad)[0]; + if (num(radNavScratchpad) != radNavScratchpad) { + mcdu_message(i, "FORMAT ERROR"); + } else { + returny = parseFrequencyVOR(radNavScratchpad, i, 3); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.VOR2.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } + } + } else if (size(split("/", radNavScratchpad)) == 1) { + if (num(radNavScratchpad) == radNavScratchpad) { + returny = parseFrequencyVOR(radNavScratchpad, i, 3); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.VOR2.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } else if (isstr(radNavScratchpad)) { + returny = parseIdentVOR(radNavScratchpad, i, 3); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + # TODO - NEW NAVAID page + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (returny == 3) { + fmgc.FMGCInternal.VOR2.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } } else { - mcdu_message(i, "NOT ALLOWED"); + mcdu_message(i, "FORMAT ERROR"); } } } else if (key == "R2") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/vor2crs-set", 0); + if (radNavScratchpad == "CLR") { + fmgc.FMGCInternal.VOR2.crsSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { - var tfs = size(scratchpad); - if (tfs >= 1 and tfs <= 3) { - if (scratchpad >= 0 and scratchpad <= 360) { - setprop("instrumentation/nav[3]/radials/selected-deg", scratchpad); - setprop("/FMGC/internal/vor2crs-set", 1); + if (radNavScratchpadSize >= 1 and radNavScratchpadSize <= 3) { + if (radNavScratchpad >= 0 and radNavScratchpad <= 360) { + pts.Instrumentation.Nav.Radials.selectedDeg[3].setValue(radNavScratchpad); + fmgc.FMGCInternal.VOR2.crsSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -164,25 +350,78 @@ var radnavInput = func(key, i) { } } } else if (key == "R5") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/adf2freq-set", 0); + if (radNavScratchpad == "CLR") { + fmgc.FMGCInternal.ADF2.freqSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { - var tfs = size(scratchpad); - if (tfs == 3 or tfs == 4) { - if (scratchpad >= 190 and scratchpad <= 1750) { - setprop("instrumentation/adf[1]/frequencies/selected-khz", scratchpad); - setprop("/FMGC/internal/adf2freq-set", 1); - mcdu_scratchpad.scratchpads[i].empty(); + if (size(split("/", radNavScratchpad)) == 2) { + if (size(split("/", radNavScratchpad)[1]) != 0) { + mcdu_message(i, "FORMAT ERROR"); + return; + } else { + radNavScratchpad = split("/", radNavScratchpad)[0]; + if (num(radNavScratchpad) != radNavScratchpad) { + mcdu_message(i, "FORMAT ERROR"); + } else { + returny = parseFrequencyADF(radNavScratchpad, i, 1); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.ADF2.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } + } + } else if (size(split("/", radNavScratchpad)) == 1) { + if (num(radNavScratchpad) == radNavScratchpad) { + returny = parseFrequencyADF(radNavScratchpad, i, 1); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.ADF2.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } else if (isstr(radNavScratchpad)) { + returny = parseIdentADF(radNavScratchpad, i, 1); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + # TODO - NEW NAVAID page + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (returny == 3) { + fmgc.FMGCInternal.ADF2.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } + } else { + mcdu_message(i, "FORMAT ERROR"); + } + } + } else if (key == "R6") { + if (fmgc.FMGCInternal.ADF2.freqSet) { + if (radNavScratchpad == "CLR" and rmp.BFOActive[1].getValue()) { + rmp.BFOActive[1].setValue(0); + mcdu_scratchpad.scratchpads[i].empty(); + } else { + if (radNavScratchpadSize == 0 and !rmp.BFOActive[1].getValue()) { + rmp.BFOActive[1].setValue(1); } else { mcdu_message(i, "NOT ALLOWED"); } - } else { - mcdu_message(i, "NOT ALLOWED"); } + } else { + mcdu_message(i, "NOT ALLOWED"); } + } else { + mcdu_message(i, "NOT ALLOWED"); } - } else { - mcdu_message(i, "NOT ALLOWED"); } } diff --git a/Nasal/Panels/acp.nas b/Nasal/Panels/acp.nas index bade1ce6..ac336502 100644 --- a/Nasal/Panels/acp.nas +++ b/Nasal/Panels/acp.nas @@ -7,15 +7,40 @@ # NOTE: This is just temporary until FG allows a full implementation of the audio system. +var mkr_capt_recive = props.globals.initNode("/controls/audio/acp[0]/mkr-recive", 0, "BOOL"); +var mkr_capt_volume = props.globals.initNode("/controls/audio/acp[0]/mkr-volume", 1, "DOUBLE"); +var mkr_fo_recive = props.globals.initNode("/controls/audio/acp[1]/mkr-recive", 0, "BOOL"); +var mkr_fo_volume = props.globals.initNode("/controls/audio/acp[1]/mkr-volume", 1, "DOUBLE"); +var ils_capt_recive = props.globals.initNode("/controls/audio/acp[0]/ils-recive", 0, "BOOL"); +var ils_capt_volume = props.globals.initNode("/controls/audio/acp[0]/ils-volume", 1, "DOUBLE"); +var ils_fo_recive = props.globals.initNode("/controls/audio/acp[1]/ils-recive", 0, "BOOL"); +var ils_fo_volume = props.globals.initNode("/controls/audio/acp[1]/ils-volume", 1, "DOUBLE"); + var vhf1_capt_recive = props.globals.initNode("/controls/audio/acp[0]/vhf1-recive", 1, "BOOL"); var vhf2_capt_recive = props.globals.initNode("/controls/audio/acp[0]/vhf2-recive", 1, "BOOL"); var vhf1_capt_volume = props.globals.initNode("/controls/audio/acp[0]/vhf1-volume", 1, "DOUBLE"); var vhf2_capt_volume = props.globals.initNode("/controls/audio/acp[0]/vhf2-volume", 1, "DOUBLE"); +var adf1_capt_receive = props.globals.initNode("/controls/audio/acp[0]/adf1-recive", 0, "BOOL"); +var adf1_capt_volume = props.globals.initNode("/controls/audio/acp[0]/adf1-volume", 1, "DOUBLE"); +var adf2_capt_receive = props.globals.initNode("/controls/audio/acp[0]/adf2-recive", 0, "BOOL"); +var adf2_capt_volume = props.globals.initNode("/controls/audio/acp[0]/adf2-volume", 1, "DOUBLE"); +var vor1_capt_receive = props.globals.initNode("/controls/audio/acp[0]/vor1-recive", 0, "BOOL"); +var vor1_capt_volume = props.globals.initNode("/controls/audio/acp[0]/vor1-volume", 1, "DOUBLE"); +var vor2_capt_receive = props.globals.initNode("/controls/audio/acp[0]/vor2-recive", 0, "BOOL"); +var vor2_capt_volume = props.globals.initNode("/controls/audio/acp[0]/vor2-volume", 1, "DOUBLE"); var vhf1_fo_recive = props.globals.initNode("/controls/audio/acp[1]/vhf1-recive", 1, "BOOL"); var vhf2_fo_recive = props.globals.initNode("/controls/audio/acp[1]/vhf2-recive", 1, "BOOL"); var vhf1_fo_volume = props.globals.initNode("/controls/audio/acp[1]/vhf1-volume", 1, "DOUBLE"); var vhf2_fo_volume = props.globals.initNode("/controls/audio/acp[1]/vhf2-volume", 1, "DOUBLE"); +var adf1_fo_receive = props.globals.initNode("/controls/audio/acp[1]/adf1-recive", 0, "BOOL"); +var adf1_fo_volume = props.globals.initNode("/controls/audio/acp[1]/adf1-volume", 1, "DOUBLE"); +var adf2_fo_receive = props.globals.initNode("/controls/audio/acp[1]/adf2-recive", 0, "BOOL"); +var adf2_fo_volume = props.globals.initNode("/controls/audio/acp[1]/adf2-volume", 1, "DOUBLE"); +var vor1_fo_receive = props.globals.initNode("/controls/audio/acp[1]/vor1-recive", 0, "BOOL"); +var vor1_fo_volume = props.globals.initNode("/controls/audio/acp[1]/vor1-volume", 1, "DOUBLE"); +var vor2_fo_receive = props.globals.initNode("/controls/audio/acp[1]/vor2-recive", 0, "BOOL"); +var vor2_fo_volume = props.globals.initNode("/controls/audio/acp[1]/vor2-volume", 1, "DOUBLE"); var com1_volume = props.globals.getNode("instrumentation/comm[0]/volume"); var com2_volume = props.globals.getNode("instrumentation/comm[1]/volume"); diff --git a/Nasal/Panels/rmp.nas b/Nasal/Panels/rmp.nas index 0615a7b7..b24eb124 100644 --- a/Nasal/Panels/rmp.nas +++ b/Nasal/Panels/rmp.nas @@ -97,6 +97,7 @@ var sel_crs_rmp1 = props.globals.initNode("/systems/radio/rmp[0]/select-crs", 1, var sel_crs_rmp2 = props.globals.initNode("/systems/radio/rmp[1]/select-crs", 1, "BOOL"); var vhf3_data_mode = props.globals.initNode("/systems/radio/vhf3-data-mode", 1, "BOOL"); +var rmpNav = [props.globals.initNode("/systems/radio/rmp[0]/nav", 0, "BOOL"),props.globals.initNode("/systems/radio/rmp[1]/nav", 0, "BOOL")]; var init = func() { chan_rmp1.setValue("vhf1"); @@ -277,11 +278,11 @@ var update_displays_nav = func(nav) { stby_display_rmp2.setValue(sprintf("%3.2f", stby_vor2.getValue())); } } else if (nav == 5 and chan1 == "adf") { - act_display_rmp1.setValue(sprintf("%4.0f", act_adf1.getValue())); - stby_display_rmp1.setValue(sprintf("%4.0f", stby_adf1.getValue())); + act_display_rmp1.setValue(sprintf("%4.2f", act_adf1.getValue())); + stby_display_rmp1.setValue(sprintf("%4.2f", stby_adf1.getValue())); } else if (nav == 6 and chan2 == "adf") { - act_display_rmp2.setValue(sprintf("%4.0f", act_adf2.getValue())); - stby_display_rmp2.setValue(sprintf("%4.0f", stby_adf2.getValue())); + act_display_rmp2.setValue(sprintf("%4.2f", act_adf2.getValue())); + stby_display_rmp2.setValue(sprintf("%4.2f", stby_adf2.getValue())); } } @@ -478,19 +479,19 @@ var change_nav_mode = func(rmp_nr, nav_mode) { if (rmp_nr == 2 and (chan_rmp2.getValue() == "vor" or chan_rmp2.getValue() == "ls" or chan_rmp2.getValue() == "adf")) { chan_rmp2.setValue("vhf2"); } - setprop("/FMGC/internal/ils1freq-set", 1); - setprop("/FMGC/internal/ils1crs-set", 1); - setprop("/FMGC/internal/vor1freq-set", 1); - setprop("/FMGC/internal/vor1crs-set", 1); - setprop("/FMGC/internal/vor2freq-set", 1); - setprop("/FMGC/internal/vor2crs-set", 1); - setprop("/FMGC/internal/adf1freq-set", 1); - setprop("/FMGC/internal/adf2freq-set", 1); + fmgc.FMGCInternal.ILS.freqSet = 1; + fmgc.FMGCInternal.ILS.crsSet = 1; + fmgc.FMGCInternal.VOR1.freqSet = 1; + fmgc.FMGCInternal.VOR1.crsSet = 1; + fmgc.FMGCInternal.VOR2.freqSet = 1; + fmgc.FMGCInternal.VOR2.crsSet = 1; + fmgc.FMGCInternal.ADF1.freqSet = 1; + fmgc.FMGCInternal.ADF2.freqSet = 1; } } # ADF Radio: Implement BFO such that you will hear audio -var BFOActive = [props.globals.getNode("/systems/radio/rmp[0]/bfo-active"),props.globals.getNode("/systems/radio/rmp[1]/bfo-active")]; +var BFOActive = [props.globals.initNode("/systems/radio/rmp[0]/bfo-active", 0, "BOOL"),props.globals.initNode("/systems/radio/rmp[1]/bfo-active", 0, "BOOL")]; var ADFIdent = [props.globals.getNode("/instrumentation/adf[0]/ident-audible"),props.globals.getNode("/instrumentation/adf[1]/ident-audible")]; var ADFMode = [props.globals.getNode("/instrumentation/adf[0]/mode"),props.globals.getNode("/instrumentation/adf[1]/mode")]; diff --git a/Nasal/Systems/electrical.nas b/Nasal/Systems/electrical.nas index 54894e6d..d3bf6556 100644 --- a/Nasal/Systems/electrical.nas +++ b/Nasal/Systems/electrical.nas @@ -49,8 +49,6 @@ var ELEC = { tr2Fault: props.globals.getNode("/systems/failures/electrical/tr-2"), }, Generic: { - adf: props.globals.initNode("/systems/electrical/outputs/adf", 0, "DOUBLE"), - dme: props.globals.initNode("/systems/electrical/outputs/dme", 0, "DOUBLE"), efis: props.globals.initNode("/systems/electrical/outputs/efis", 0, "DOUBLE"), fcpPower: props.globals.initNode("/systems/electrical/outputs/fcp-power", 0, "DOUBLE"), fuelPump0: props.globals.initNode("/systems/electrical/outputs/fuel-pump[0]", 0, "DOUBLE"), @@ -58,10 +56,6 @@ var ELEC = { fuelPump2: props.globals.initNode("/systems/electrical/outputs/fuel-pump[2]", 0, "DOUBLE"), gps: props.globals.initNode("/systems/electrical/outputs/gps", 0, "DOUBLE"), mkViii: props.globals.initNode("/systems/electrical/outputs/mk-viii", 0, "DOUBLE"), - nav0: props.globals.initNode("/systems/electrical/outputs/nav[0]", 0, "DOUBLE"), - nav1: props.globals.initNode("/systems/electrical/outputs/nav[1]", 0, "DOUBLE"), - nav2: props.globals.initNode("/systems/electrical/outputs/nav[2]", 0, "DOUBLE"), - nav3: props.globals.initNode("/systems/electrical/outputs/nav[3]", 0, "DOUBLE"), tacan: props.globals.initNode("/systems/electrical/outputs/tacan", 0, "DOUBLE"), transponder: props.globals.initNode("/systems/electrical/outputs/transponder", 0, "DOUBLE"), turnCoordinator: props.globals.initNode("/systems/electrical/outputs/turn-coordinator", 0, "DOUBLE"), diff --git a/Systems/a320-electrical.xml b/Systems/a320-electrical.xml index 0081e2d7..9b416c21 100644 --- a/Systems/a320-electrical.xml +++ b/Systems/a320-electrical.xml @@ -2242,12 +2242,23 @@ /systems/electrical/outputs/fuel-pump[0] /systems/electrical/outputs/fuel-pump[1] /systems/electrical/outputs/fuel-pump[2] - /systems/electrical/outputs/gps /systems/electrical/outputs/mk-viii /systems/electrical/outputs/tacan /systems/electrical/outputs/turn-coordinator + + This makes the FG stuff work because we killed the generic electrical + + + /systems/electrical/bus/ac-ess ge 25 + + + /systems/electrical/bus/ac-2 ge 25 + + /systems/electrical/outputs/gps + + diff --git a/Systems/a320-misc.xml b/Systems/a320-misc.xml index 0d9f46b5..04800d0a 100644 --- a/Systems/a320-misc.xml +++ b/Systems/a320-misc.xml @@ -39,6 +39,352 @@ + + + + + + /systems/electrical/bus/ac-ess-shed ge 110 + + + + + /instrumentation/adf[0]/power-supply + 100 + 0.5 + + + + /instrumentation/adf[0]/power-supply + 0.5 + 100 + + + + + + /instrumentation/adf[0]/power-supply-bite-timer eq 1 + + + /instrumentation/adf[0]/power-supply-bite-enable eq 0 + + + + + + + /instrumentation/adf[0]/power-supply-was-off eq 0 + /instrumentation/adf[0]/power-supply-bite-timer eq 1 + + + + + + + /systems/electrical/bus/ac-2 ge 110 + + + + + /instrumentation/adf[1]/power-supply + 100 + 0.5 + + + + /instrumentation/adf[1]/power-supply + 0.5 + 100 + + + + + + /instrumentation/adf[1]/power-supply-bite-timer eq 1 + + + /instrumentation/adf[1]/power-supply-bite-enable eq 0 + + + + + + + /instrumentation/adf[1]/power-supply-was-off eq 0 + /instrumentation/adf[1]/power-supply-bite-timer eq 1 + + + + + + + + + + + /systems/electrical/bus/ac-ess ge 110 + + + + + /instrumentation/nav[2]/power-supply + 100 + 0.333 + + + + /instrumentation/nav[2]/power-supply + 0.333 + 100 + + + + + + /instrumentation/nav[2]/power-supply-bite-timer eq 1 + + + /instrumentation/nav[2]/power-supply-bite-enable eq 0 + + + + + + + /instrumentation/nav[2]/power-supply-was-off eq 0 + /instrumentation/nav[2]/power-supply-bite-timer eq 1 + + + + + + + /systems/electrical/bus/ac-2 ge 110 + + + + + /instrumentation/nav[3]/power-supply + 100 + 0.333 + + + + /instrumentation/nav[3]/power-supply + 0.333 + 100 + + + + + + /instrumentation/nav[3]/power-supply-bite-timer eq 1 + + + /instrumentation/nav[3]/power-supply-bite-enable eq 0 + + + + + + + /instrumentation/nav[3]/power-supply-was-off eq 0 + /instrumentation/nav[3]/power-supply-bite-timer eq 1 + + + + + + + + + + + /systems/electrical/bus/ac-ess-shed ge 110 + + + + + /instrumentation/dme[0]/power-supply + 100 + 0.5 + + + + /instrumentation/dme[0]/power-supply + 0.5 + 100 + + + + + + /instrumentation/dme[0]/power-supply-bite-timer eq 1 + + + /instrumentation/dme[0]/power-supply-bite-enable eq 0 + + + + + + + /instrumentation/dme[0]/power-supply-was-off eq 0 + /instrumentation/dme[0]/power-supply-bite-timer eq 1 + + + + + + + /systems/electrical/bus/ac-2 ge 110 + + + + + /instrumentation/dme[1]/power-supply + 100 + 0.5 + + + + /instrumentation/dme[1]/power-supply + 0.5 + 100 + + + + + + /instrumentation/dme[1]/power-supply-bite-timer eq 1 + + + /instrumentation/dme[1]/power-supply-bite-enable eq 0 + + + + + + + /instrumentation/dme[1]/power-supply-was-off eq 0 + /instrumentation/dme[1]/power-supply-bite-timer eq 1 + + + + + + + + + + + /controls/audio/acp[0]/adf1-recive eq 1 + + /controls/audio/acp[1]/adf1-recive eq 0 + /controls/audio/acp[0]/adf1-volume ge /controls/audio/acp[1]/adf1-volume + + + + /controls/audio/acp[1]/adf1-recive eq 1 + + /controls/audio/acp[0]/adf1-recive eq 0 + /controls/audio/acp[0]/adf1-volume lt /controls/audio/acp[1]/adf1-volume + + + + + + + + /controls/audio/acp[0]/adf2-recive eq 1 + + /controls/audio/acp[1]/adf2-recive eq 0 + /controls/audio/acp[0]/adf2-volume ge /controls/audio/acp[1]/adf2-volume + + + + /controls/audio/acp[1]/adf2-recive eq 1 + + /controls/audio/acp[0]/adf2-recive eq 0 + /controls/audio/acp[0]/adf2-volume lt /controls/audio/acp[1]/adf2-volume + + + + + + + + /controls/audio/acp[0]/mkr-recive eq 1 + + /controls/audio/acp[1]/mkr-recive eq 0 + /controls/audio/acp[0]/mkr-volume ge /controls/audio/acp[1]/mkr-volume + + + + /controls/audio/acp[1]/mkr-recive eq 1 + + /controls/audio/acp[0]/mkr-recive eq 0 + /controls/audio/acp[0]/mkr-volume lt /controls/audio/acp[1]/mkr-volume + + + + + + + + /controls/audio/acp[0]/ils-recive eq 1 + + /controls/audio/acp[1]/ils-recive eq 0 + /controls/audio/acp[0]/ils-volume ge /controls/audio/acp[1]/ils-volume + + + + /controls/audio/acp[1]/ils-recive eq 1 + + /controls/audio/acp[0]/ils-recive eq 0 + /controls/audio/acp[0]/ils-volume lt /controls/audio/acp[1]/ils-volume + + + + + + + + /controls/audio/acp[0]/vor1-recive eq 1 + + /controls/audio/acp[1]/vor1-recive eq 0 + /controls/audio/acp[0]/vor1-volume ge /controls/audio/acp[1]/vor1-volume + + + + /controls/audio/acp[1]/vor1-recive eq 1 + + /controls/audio/acp[0]/vor1-recive eq 0 + /controls/audio/acp[0]/vor1-volume lt /controls/audio/acp[1]/vor1-volume + + + + + + + + /controls/audio/acp[0]/vor2-recive eq 1 + + /controls/audio/acp[1]/vor2-recive eq 0 + /controls/audio/acp[0]/vor2-volume ge /controls/audio/acp[1]/vor2-volume + + + + /controls/audio/acp[1]/vor2-recive eq 1 + + /controls/audio/acp[0]/vor2-recive eq 0 + /controls/audio/acp[0]/vor2-volume lt /controls/audio/acp[1]/vor2-volume + + + + + + diff --git a/Systems/instrumentation.xml b/Systems/instrumentation.xml index de7bba1e..1941fa4f 100644 --- a/Systems/instrumentation.xml +++ b/Systems/instrumentation.xml @@ -9,14 +9,14 @@ adf 0 - /systems/electrical/bus/ac-ess-shed + /instrumentation/adf[0]/power-supply-node 109.9 adf 1 - /systems/electrical/bus/ac-2 + /instrumentation/adf[1]/power-supply-node 109.9 @@ -126,10 +126,10 @@ 1 - + dme 0 - /systems/electrical/bus/ac-ess-shed + /systems/electrical/bus/ac-ess 109.9 @@ -140,17 +140,17 @@ 109.9 - + dme 2 - /systems/electrical/bus/ac-ess + /instrumentation/dme[0]/power-supply-node 109.9 dme 3 - /systems/electrical/bus/ac-2 + /instrumentation/dme[1]/power-supply-node 109.9 @@ -181,11 +181,11 @@ marker-beacon 0 - /systems/electrical/bus/ac-ess + /instrumentation/nav[2]/power-supply-node 109.9 - + nav 0 /systems/electrical/bus/ac-ess @@ -199,17 +199,17 @@ 109.9 - + nav 2 - /systems/electrical/bus/ac-ess + /instrumentation/nav[2]/power-supply-node 109.9 nav 3 - /systems/electrical/bus/ac-2 + /instrumentation/nav[3]/power-supply-node 109.9 diff --git a/Systems/libraries.xml b/Systems/libraries.xml index 16092c98..35cbed5a 100644 --- a/Systems/libraries.xml +++ b/Systems/libraries.xml @@ -909,13 +909,27 @@ - /systems/electrical/bus/dc-ess - 25 + /systems/electrical/bus/ac-ess + 110 - - /systems/navigation/aligned-1 - 1 - + + + /systems/navigation/aligned-1 + + + /controls/navigation/switching/att-hdg + -1 + + + + + /systems/navigation/aligned-3 + + /controls/navigation/switching/att-hdg + -1 + + + @@ -950,8 +964,8 @@ - /systems/electrical/bus/dc-ess - 25 + /systems/electrical/bus/ac-ess + 110 /instrumentation/ddrmi/vor-adf-1 @@ -961,10 +975,24 @@ /instrumentation/nav[2]/in-range 1 - - /systems/navigation/aligned-1 - 1 - + + + /systems/navigation/aligned-1 + + + /controls/navigation/switching/att-hdg + -1 + + + + + /systems/navigation/aligned-3 + + /controls/navigation/switching/att-hdg + -1 + + + /instrumentation/ddrmi/vor-1-error @@ -974,27 +1002,43 @@ - /systems/electrical/bus/dc-ess - 25 + /systems/electrical/bus/ac-ess + 110 /instrumentation/ddrmi/vor-adf-1 - -1 + 0 /instrumentation/adf[0]/in-range 1 - - /systems/navigation/aligned-1 - 1 - + + + /systems/navigation/aligned-1 + + + /controls/navigation/switching/att-hdg + -1 + + + + + /systems/navigation/aligned-3 + + /controls/navigation/switching/att-hdg + -1 + + + /instrumentation/adf[0]/indicated-bearing-deg -1.0 - -90 + + /instrumentation/ddrmi/needle-1 + /instrumentation/ddrmi/needle-1 @@ -1025,8 +1069,8 @@ - /systems/electrical/bus/dc-ess - 25 + /systems/electrical/bus/ac-ess + 110 /instrumentation/ddrmi/vor-adf-2 @@ -1036,10 +1080,24 @@ /instrumentation/nav[3]/in-range 1 - - /systems/navigation/aligned-1 - 1 - + + + /systems/navigation/aligned-1 + + + /controls/navigation/switching/att-hdg + -1 + + + + + /systems/navigation/aligned-3 + + /controls/navigation/switching/att-hdg + -1 + + + /instrumentation/ddrmi/vor-2-error @@ -1049,27 +1107,43 @@ - /systems/electrical/bus/dc-ess - 25 + /systems/electrical/bus/ac-ess + 110 /instrumentation/ddrmi/vor-adf-2 - -1 + 0 /instrumentation/adf[1]/in-range 1 - - /systems/navigation/aligned-1 - 1 - + + + /systems/navigation/aligned-1 + + + /controls/navigation/switching/att-hdg + -1 + + + + + /systems/navigation/aligned-3 + + /controls/navigation/switching/att-hdg + -1 + + + /instrumentation/adf[1]/indicated-bearing-deg -1.0 - -90 + + /instrumentation/ddrmi/needle-2 + /instrumentation/ddrmi/needle-2 @@ -1081,13 +1155,27 @@ - /systems/electrical/bus/dc-ess - 25 + /systems/electrical/bus/ac-ess + 110 - - /systems/navigation/aligned-1 - 1 - + + + /systems/navigation/aligned-1 + + + /controls/navigation/switching/att-hdg + -1 + + + + + /systems/navigation/aligned-3 + + /controls/navigation/switching/att-hdg + -1 + + + @@ -1102,7 +1190,7 @@ /instrumentation/ddrmi/vor-adf-1 - -1 + 0 /instrumentation/adf[0]/in-range @@ -1127,13 +1215,27 @@ - /systems/electrical/bus/dc-ess - 25 + /systems/electrical/bus/ac-ess + 110 - - /systems/navigation/aligned-1 - 1 - + + + /systems/navigation/aligned-1 + + + /controls/navigation/switching/att-hdg + -1 + + + + + /systems/navigation/aligned-3 + + /controls/navigation/switching/att-hdg + -1 + + + @@ -1148,7 +1250,7 @@ /instrumentation/ddrmi/vor-adf-2 - -1 + 0 /instrumentation/adf[1]/in-range diff --git a/WebPanel/WebPanel1/index.html b/WebPanel/WebPanel1/index.html new file mode 100644 index 00000000..a6ebb489 --- /dev/null +++ b/WebPanel/WebPanel1/index.html @@ -0,0 +1,342 @@ + + + + + A320 MCDU + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +




+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ABCDE
FGHIJ
KLMNO
PQRST
UVWXY
Z/SPOVFY
CLR
+ + + + + + + + + + + + + +
AIR
PORT
+ + + + + + + + + + + + + + + + + + + + + +
123
456
789
.0 + +/- +
+ + + \ No newline at end of file diff --git a/WebPanel/WebPanel1/screenshot.jpg b/WebPanel/WebPanel1/screenshot.jpg new file mode 100644 index 00000000..a1cce228 Binary files /dev/null and b/WebPanel/WebPanel1/screenshot.jpg differ diff --git a/WebPanel/WebPanel2/css/mcdu.css b/WebPanel/WebPanel2/css/mcdu.css new file mode 100644 index 00000000..cb35fcb4 --- /dev/null +++ b/WebPanel/WebPanel2/css/mcdu.css @@ -0,0 +1,281 @@ +* { + -webkit-touch-callout: none; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + -webkit-text-size-adjust: none; + text-size-adjust: none; + -webkit-user-select: none; + user-select: none; +} + +html, body { + overscroll-behavior-y: none; + position: fixed; + overflow: hidden; +} + +body { + width: calc(100vw - 2px); + height: calc(100vh - 2px); + margin-left: 1px; + overflow: hidden; + background-color: #000; +} + +.mcdu { + width: 100vw; + height: calc(100vw / .6); + max-height: 100vh; + max-width: calc(100vh * .6); + position: absolute; + margin: auto; + top: 0; + left: 0; + right: 0; +} + +.mcdu_case { + display: block; + width: 100%; + height: auto; +} + +.mcdu-glass { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: -1; + overflow: hidden; +} + +.mcdu-glass--dust { + display: none; + position: absolute; + top: 6%; + left: 13%; + width: 73.5%; + opacity: 0.5; + transform: scale(1, -1); + filter: blur(0.1vh); +} + +[data-used-universe="1"] .mcdu-glass--dust { + display: inline-block; +} + +.screen-img, +.screen-glow { + position: absolute; + top: 7.5%; + left: 13.4%; + width: 72.8%; +} + +.screen-glow { + display: none; +} + +[data-used-universe="1"] .screen-glow { + display: inline-block; + filter: brightness(50) blur(0.2vh); + opacity: 0.15; +} + + +.mcdu-fg { + position: absolute; + top: 0.3%; + left: 0; + width: 100%; + height: 100%; +} + +[data-button] { + position: absolute; + cursor: pointer; +} + +[data-showbuttons="1"] [data-button] { + background-color: red; + opacity: 0.5; +} + +.glassbutton { + top: 6%; + left: 13%; + width: 73.5%; + height: 40% +} + +.skbutton { + width: 7.7%; + height: 3.3%; + border-radius: 0.2vh; +} + +.menubutton { + width: 9.8%; + height: 4%; + border-radius: 0.2vh; +} + +.numberbutton { + width: 7.5%; + padding-bottom: 7.5%; + border-radius: 50%; +} + +.alphabutton { + width: 7.4%; + padding-bottom: 7.4%; + border-radius: 0.2vh; +} + +.skbuttons-left .skbutton { + left: 1.6%; +} + +.skbuttons-right .skbutton { + right: 2.1%; +} + +.sk-1 { + top: 12.3%; +} + +.sk-2 { + top: 17.34%; +} + +.sk-3 { + top: 22.4%; +} + +.sk-4 { + top: 27.4%; +} + +.sk-5 { + top: 32.5%; +} + +.sk-6 { + top: 37.6%; +} + +.menu-row1 .menubutton { + top: 48.2%; +} + +.menu-row2 .menubutton { + top: 53.04%; +} + +.menu-row3 .menubutton { + top: 57.9%; +} + +.menu-row4 .menubutton { + top: 62.8%; +} + +.menu-row5 .menubutton { + top: 67.6%; +} + +.menu-col1 { + left: 11.3%; +} + +.menu-col2 { + left: 23.2%; +} + +.menu-col3 { + left: 35.1%; +} + +.menu-col4 { + left: 47%; +} + +.menu-col5 { + left: 59%; +} + +.menu-col6 { + left: 70.95%; +} + +.number-row1 .numberbutton { + top: 73.9%; +} + +.number-row2 .numberbutton { + top: 79.6%; +} + +.number-row3 .numberbutton { + top: 85.3%; +} + +.number-row4 .numberbutton { + top: 91%; +} + +.number-col1 { + left: 11.5%; +} + +.number-col2 { + left: 21.1%; +} + +.number-col3 { + left: 30.6%; +} + +.alphabutton-row1 .alphabutton { + top: 59.5%; +} + +.alphabutton-row2 .alphabutton { + top: 65.8%; +} + +.alphabutton-row3 .alphabutton { + top: 72.1%; +} + +.alphabutton-row4 .alphabutton { + top: 78.4%; +} + +.alphabutton-row5 .alphabutton { + top: 84.8%; +} + +.alphabutton-row6 .alphabutton { + top: 91.1%; +} + +.alphabutton-col1 { + left: 40.6%; +} + +.alphabutton-col2 { + left: 50.7%; +} + +.alphabutton-col3 { + left: 60.7%; +} + +.alphabutton-col4 { + left: 70.7%; +} + +.alphabutton-col5 { + left: 80.7%; +} diff --git a/WebPanel/WebPanel2/img/dust2.png b/WebPanel/WebPanel2/img/dust2.png new file mode 100644 index 00000000..1312976c Binary files /dev/null and b/WebPanel/WebPanel2/img/dust2.png differ diff --git a/WebPanel/WebPanel2/img/mcdu-bg.png b/WebPanel/WebPanel2/img/mcdu-bg.png new file mode 100644 index 00000000..9401284f Binary files /dev/null and b/WebPanel/WebPanel2/img/mcdu-bg.png differ diff --git a/WebPanel/WebPanel2/img/screenshot.jpg b/WebPanel/WebPanel2/img/screenshot.jpg new file mode 100644 index 00000000..369e24c2 Binary files /dev/null and b/WebPanel/WebPanel2/img/screenshot.jpg differ diff --git a/WebPanel/WebPanel2/index.html b/WebPanel/WebPanel2/index.html new file mode 100644 index 00000000..c3214b3a --- /dev/null +++ b/WebPanel/WebPanel2/index.html @@ -0,0 +1,146 @@ + + + + A320 MCDU + + + + + + + +
+ +
+ + + +
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+ + + diff --git a/WebPanel/WebPanel2/js/mcdu.js b/WebPanel/WebPanel2/js/mcdu.js new file mode 100644 index 00000000..11944742 --- /dev/null +++ b/WebPanel/WebPanel2/js/mcdu.js @@ -0,0 +1,185 @@ +const MCDU = (function () { + const screenImageBaseUrl = '/screenshot?canvasindex=10&type=jpg'; + const refreshInterval = 2000; + + const body = document.body; + let currentCacheBust = 0; + let lastSentText = ''; + + init(); + + return { + toggleUsedUniverse + } + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// + + function init() + { + body.dataset.lastTouch = 0; + body.addEventListener('touchstart', preventZoomAction, { passive: false }); + + registerButtons(); + registerKeyboardInput(); + setInterval(refreshScreen, refreshInterval); + refreshScreen(); + } + + function refreshScreen() { + loadScreenImage(screenImageBaseUrl) + .then(setScreenSrc) + .catch(setScreenSrc); + } + + function setScreenSrc(url) { + url = typeof url === 'string' ? url : ''; + showScreenImageLoadState(url !== ''); + document.querySelectorAll('[data-element="lcdimage"]').forEach((imageElement) => { + imageElement.src = url; + }); + } + + function loadScreenImage(baseUrl) { + currentCacheBust = new Date().getTime(); + return new Promise((resolve, reject) => { + const url = baseUrl + '?cacheBust=' + currentCacheBust; + const img = new Image; + + img.addEventListener('error', reject); + + img.addEventListener('load', (event) => { + showScreenImageLoadState(true); + resolve(url); + }); + img.src = url; + }); + } + + function showScreenImageLoadState(isOK) { + if (!isOK) { + console.log('fail'); + } + } + + function toggleUsedUniverse() { + body.setAttribute('data-used-universe', body.getAttribute('data-used-universe') === '1' ? '0' : '1'); + } + + function registerButtons() { + document.querySelectorAll('[data-button]').forEach((buttonElement) => { + const buttonFunction = getButtonFunction(buttonElement); + if (!(typeof buttonFunction === 'function')) { + return; + } + buttonElement.addEventListener('click', buttonFunction); + buttonElement.addEventListener('touchstart', preventZoomAction, true); + }); + } + + function registerKeyboardInput() { + const keyTranslation = { + BACKSPACE: 'CLR' + }; + body.addEventListener('keyup', (event) => { + const key = event.key.toUpperCase(); + if (key.match(/^[A-Z0-9/\-+.\ ]$/)) { + if (key === '+' || key === '-') { + return sendPlusMinusKey(); + } + return sendButtonpress('button', key); + } + + const translatedKey = keyTranslation[key]; + if (translatedKey) { + return sendButtonpress('button', translatedKey); + } + }); + } + + function getButtonFunction(buttonElement) { + const buttonActions = buttonElement.getAttribute('data-button').split(':'); + const actionKey = buttonActions[0]; + const actionValue = buttonActions[1]; + + if(!actionKey) { + return; + } + + if (actionKey === 'toggleUsedUniverse') { + return toggleUsedUniverse; + } + + if (actionKey === 'button' && actionValue === '-') { + return sendPlusMinusKey; + } + + return function () { + sendButtonpress(actionKey, actionValue); + }; + } + + function sendPlusMinusKey() { + if (lastSentText === '-') { + sendButtonpress('button', 'CLR') + .then(() => { + sendButtonpress('button', '+'); + }) + return; + } + + if (lastSentText === '+') { + sendButtonpress('button', 'CLR') + .then(() => { + sendButtonpress('button', '-'); + }) + return; + } + + sendButtonpress('button', '-'); + } + + function sendButtonpress(type, text) { + // console.log({ type, text }); + let request = new XMLHttpRequest; + request.open("POST", "/run.cgi?value=nasal"); + request.setRequestHeader("Content-Type", "application/json"); + let body = JSON.stringify({ + "name": "", + "children": [ + { + "name": "script", + "index": 0, + "value": "mcdu." + type + "(\"" + text + "\", 0);" + } + ] + }); + request.send(body); + return new Promise((resolve) => { + request.addEventListener('load', () => { + lastSentText = text; + refreshScreen(); + resolve(); + }, true); + }); + } + + //https://exceptionshub.com/disable-double-tap-zoom-option-in-browser-on-touch-devices.html + function preventZoomAction(event) { + const t2 = event.timeStamp; + const touchedElement = event.currentTarget; + const t1 = touchedElement.dataset.lastTouch || t2; + const dt = t2 - t1; + const fingers = event.touches.length; + touchedElement.dataset.lastTouch = t2; + + if (!dt || dt > 500 || fingers > 1) { + // no double-tap + return; + } + + event.preventDefault(); + event.target.click(); + } +})(); diff --git a/WebPanel/mcdu.html b/WebPanel/mcdu.html index a6ebb489..264131af 100644 --- a/WebPanel/mcdu.html +++ b/WebPanel/mcdu.html @@ -1,342 +1,116 @@ - - - - - A320 MCDU - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -




- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ABCDE
FGHIJ
KLMNO
PQRST
UVWXY
Z/SPOVFY
CLR
- - - - - - - - - - - - - -
AIR
PORT
- - - - - - - - - - - - - - - - - - - - - -
123
456
789
.0 - +/- -
- - + + + + + A320 MCDU + + + + + + + + +

Web MCDU

+

Please choose:

+ + + \ No newline at end of file