diff --git a/A320-100-CFM-set.xml b/A320-100-CFM-set.xml index 67418f9a..3ab703be 100644 --- a/A320-100-CFM-set.xml +++ b/A320-100-CFM-set.xml @@ -185,7 +185,8 @@ 0 - + + Right Aft View lookfrom false diff --git a/A320-200-CFM-set.xml b/A320-200-CFM-set.xml index abdf47b8..3c94e222 100644 --- a/A320-200-CFM-set.xml +++ b/A320-200-CFM-set.xml @@ -185,7 +185,8 @@ 0 - + + Right Aft View lookfrom false @@ -200,7 +201,16 @@ 0 - + + + + Aircraft/A320-family/Systems/fadec-cfm.xml + + + Aircraft/A320-family/Systems/cfm56-sound.xml + + + diff --git a/A320-200-IAE-set.xml b/A320-200-IAE-set.xml index 677bda7c..98fa97d7 100644 --- a/A320-200-IAE-set.xml +++ b/A320-200-IAE-set.xml @@ -185,7 +185,8 @@ 0 - + + Right Aft View lookfrom false diff --git a/A320-main.xml b/A320-main.xml index 0199cdfc..1330016f 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -512,14 +512,6 @@ - - - - property-assign - /controls/adirs/skip - 1 - - @@ -1927,20 +1919,37 @@ Del CLR + true /FMGC/keyboard-left nasal - + /FMGC/keyboard-right nasal - + + + + + /FMGC/keyboard-left + + nasal + + + + + /FMGC/keyboard-right + + nasal + + + Disable MCDU keyboard mode @@ -2514,18 +2523,18 @@ - /FMGC/keyboard-left - /FMGC/keyboard-right - - - sim/current-view/name - Walk View - - - sim/current-view/name - Walker Orbit View - - + /FMGC/keyboard-left + /FMGC/keyboard-right + + + sim/current-view/name + Walk View + + + sim/current-view/name + Walker Orbit View + + property-assign @@ -2660,6 +2669,65 @@ SHIFT-d Autopilot Disconnect + + property-assign + + + /FMGC/keyboard-left + /FMGC/keyboard-right + + + sim/current-view/name + Walk View + + + sim/current-view/name + Walker Orbit View + + + + + sim/walker/key-triggers/slide + 1 + + + property-assign + + /FMGC/keyboard-left + /FMGC/keyboard-right + + sim/walker/key-triggers/speed + sim/walker/speed-mps + + + property-multiply + + /FMGC/keyboard-left + /FMGC/keyboard-right + + sim/walker/key-triggers/speed + 2.5 + + + + property-assign + + /FMGC/keyboard-left + /FMGC/keyboard-right + + sim/walker/key-triggers/slide + 0 + + + property-assign + + /FMGC/keyboard-left + /FMGC/keyboard-right + + sim/walker/key-triggers/speed + sim/walker/speed-mps + + /FMGC/keyboard-left @@ -2676,8 +2744,22 @@ - /FMGC/keyboard-left - /FMGC/keyboard-right + + /FMGC/keyboard-left + /FMGC/keyboard-right + + + sim/current-view/name + Walk View + + + + + sim/current-view/name + Walker Orbit View + + + nasal + + @@ -36,7 +46,7 @@ center /systems/acconfig/spin 1 - + diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 2d6e31c2..df18e859 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -1,4 +1,4 @@ - + @@ -138,86 +138,68 @@ - pick + knob ddrmi_vor_adf_select_1 + instrumentation/ddrmi/vor-adf-1 + + ddrmi_vor_adf_select_1.axis + - - false - property-cycle + property-adjust instrumentation/ddrmi/vor-adf-1 - 0 - 1 - -1 - - - - - false - - property-cycle - instrumentation/ddrmi/vor-adf-1 - -1 - 1 - 0 + -1 + 1 + - Knob 1 rotate - ddrmi_vor_adf_select_1 + DDRMI vor-adf knob 1 rotate + ddrmi_vor_adf_select_1 instrumentation/ddrmi/vor-adf-1 - -190 - 045 - 1 0 + -190 + 045 + 1 0 ddrmi_vor_adf_select_1.axis - + - pick + knob ddrmi_vor_adf_select_2 + instrumentation/ddrmi/vor-adf-2 + + ddrmi_vor_adf_select_2.axis + - - false - property-cycle + property-adjust instrumentation/ddrmi/vor-adf-2 - 0 - 1 - -1 - - - - - false - - property-cycle - instrumentation/ddrmi/vor-adf-2 - -1 - 1 - 0 + -1 + 1 + - Knob 2 rotate - ddrmi_vor_adf_select_2 + DDRMI vor-adf knob 2 rotate + ddrmi_vor_adf_select_2 instrumentation/ddrmi/vor-adf-2 - -1-90 - 0-45 - 1 0 + -1-90 + 0-45 + 1 0 ddrmi_vor_adf_select_2.axis - + @@ -227,7 +209,7 @@ rotate instrumentation/ddrmi/flag-1 - 045 + 0-45 1 0 @@ -241,7 +223,7 @@ rotate instrumentation/ddrmi/flag-2 - 0-45 + 045 1 0 @@ -428,7 +410,7 @@ rotate brakes_accum_psi - systems/hydraulic/brakes/accumulator-pressure-psi + systems/hydraulic/yellow-accumulator-psi 00 700-20 @@ -8339,30 +8321,21 @@ + - UTC selector rotate - pick + UTC selector animation + knob clock_knob + instrumentation/clock/utc-selector + + clock_knob.axis + - - false - property-cycle + property-adjust instrumentation/clock/utc-selector - 0 - 1 - 2 - - - - - false - - property-cycle - instrumentation/clock/utc-selector - 2 - 1 - 0 + 0 + 2 @@ -8373,9 +8346,9 @@ clock_knob instrumentation/clock/utc-selector - 00 - 145 - 290 + 290 + 145 + 0 0 clock_knob.axis diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index d8798419..cd696c70 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -292,8 +292,6 @@ var showIESI = func { dlg.setCanvas(A320IESI.MainScreen.canvas); } -setlistener("", func() { if (A320IESI.MainScreen != nil) { A320IESI.MainScreen.updateQNH(notification); } }, 0, 0); - var roundabout = func(x) { var y = x - int(x); return y < 0.5 ? int(x) : 1 + int(x); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 100b3f89..cbfddbc6 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -78,7 +78,6 @@ var elevator_ind_right = props.globals.getNode("/ECAM/Lower/elevator-ind-right", var elevator_trim_deg = props.globals.getNode("/ECAM/Lower/elevator-trim-deg", 1); var final_deg = props.globals.getNode("/fdm/jsbsim/hydraulics/rudder/final-deg", 1); var temperature_degc = props.globals.getNode("/environment/temperature-degc", 1); -var gw = props.globals.getNode("/fdm/jsbsim/inertia/weight-lbs", 1); var tank3_content_lbs = props.globals.getNode("/fdm/jsbsim/propulsion/tank[2]/contents-lbs", 1); var ir2_knob = props.globals.getNode("/controls/adirs/ir[1]/knob", 1); var apuBleedNotOn = props.globals.getNode("/systems/pneumatics/warnings/apu-bleed-not-on", 1); @@ -118,6 +117,7 @@ var doorR4_pos = props.globals.getNode("/sim/model/door-positions/doorr4/positio var cargobulk_pos = props.globals.getNode("/sim/model/door-positions/cargobulk/position-norm", 1); var cargofwd_pos = props.globals.getNode("/sim/model/door-positions/cargofwd/position-norm", 1); var cargoaft_pos = props.globals.getNode("/sim/model/door-positions/cargoaft/position-norm", 1); +var gLoad = props.globals.getNode("/ECAM/Lower/g-force-display", 1); # Hydraulic var blue_psi = 0; @@ -479,6 +479,7 @@ var canvas_lowerECAM_base = { lowerECAM_wheel.page.hide(); } }, + displayedGForce: 0, updateBottomStatus: func() { if (dmc.DMController.DMCs[1].outputs[4] != nil) { me["SAT"].setText(sprintf("%2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); @@ -496,13 +497,34 @@ var canvas_lowerECAM_base = { me["TAT"].setColor(0.7333,0.3803,0); } + me.gloadStore = gLoad.getValue(); + if ((me.gloadStore == 1 and !me.displayedGForce) or (me.gloadStore != 0 and me.displayedGForce)) { + me.displayedGForce = 1; + me["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", pts.Accelerations.pilotGDamped.getValue())); + me["GLoad"].show(); + } else { + me.displayedGForce = 0; + me["GLoad"].hide(); + } + me["UTCh"].setText(sprintf("%02d", hour.getValue())); me["UTCm"].setText(sprintf("%02d", minute.getValue())); + + if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and ecam.phaseNode.getValue() != 1) { + if (acconfig_weight_kgs.getValue()) { + me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); + } else { + me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000, 100))); + } + me["GW"].setColor(0.0509,0.7529,0.2941); + } else { + me["GW"].setText(sprintf("%s", "-----")); + me["GW"].setColor(0.0901,0.6039,0.7176); + } + if (acconfig_weight_kgs.getValue()) { - me["GW"].setText(sprintf("%s", math.round(math.round(gw.getValue() * LBS2KGS, 100)))); me["GW-weight-unit"].setText("KG"); } else { - me["GW"].setText(sprintf("%s", math.round(gw.getValue(), 100))); me["GW-weight-unit"].setText("LBS"); } }, @@ -516,7 +538,7 @@ var canvas_lowerECAM_apu = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","APUN-needle","APUEGT-needle","APUN","APUEGT","APUAvail","APUFlapOpen","APUBleedValve","APUBleedOnline","APUGenOnline","APUGentext","APUGenLoad","APUGenbox","APUGenVolt","APUGenHz","APUBleedPSI","APUfuelLO","APU-low-oil", + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","APUN-needle","APUEGT-needle","APUN","APUEGT","APUAvail","APUFlapOpen","APUBleedValve","APUBleedOnline","APUGenOnline","APUGentext","APUGenLoad","APUGenbox","APUGenVolt","APUGenHz","APUBleedPSI","APUfuelLO","APU-low-oil", "text3724","text3728","text3732"]; }, update: func() { @@ -649,7 +671,7 @@ var canvas_lowerECAM_bleed = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit", "BLEED-XFEED", "BLEED-Ram-Air", "BLEED-APU-CIRCLE", "BLEED-HP-Valve-1", + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit", "BLEED-XFEED", "BLEED-Ram-Air", "BLEED-APU-CIRCLE", "BLEED-HP-Valve-1", "BLEED-APU-LINES","BLEED-ENG-1", "BLEED-HP-Valve-2", "BLEED-ENG-2", "BLEED-Precooler-1-Inlet-Press", "BLEED-Precooler-1-Outlet-Temp", "BLEED-Precooler-2-Inlet-Press", "BLEED-Precooler-2-Outlet-Temp", "BLEED-ENG-1-label", "BLEED-ENG-2-label", "BLEED-GND", "BLEED-Pack-1-Flow-Valve", "BLEED-Pack-2-Flow-Valve", "BLEED-Pack-1-Out-Temp","BLEED-APU-connectionTop", @@ -997,7 +1019,7 @@ var canvas_lowerECAM_cond = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","CargoCond","CONDHotAirValve","CONDFanFwdFault","CONDFanAftFault", + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","CargoCond","CONDHotAirValve","CONDFanFwdFault","CONDFanAftFault", "CONDTrimValveCKPT","CONDTrimValveAFT","CONDTrimValveFWD","CONDDuctTempCKPT","CONDDuctTempAFT","CONDDuctTempFWD","CONDTempCKPT","CONDTempAFT","CONDTempFWD"]; }, update: func() { @@ -1047,7 +1069,7 @@ var canvas_lowerECAM_crz = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","Oil1","Oil2","FUsed1","FUsed2","FUsed","VIB1N1","VIB1N2","VIB2N1","VIB2N2","deltaPSI","LDGELEV-AUTO","LDGELEV","CABVS","CABALT","VS-Arrow-UP","VS-Arrow-DN","CKPT-TEMP","FWD-TEMP","AFT-TEMP","Fused-weight-unit"]; + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","Oil1","Oil2","FUsed1","FUsed2","FUsed","VIB1N1","VIB1N2","VIB2N1","VIB2N2","deltaPSI","LDGELEV-AUTO","LDGELEV","CABVS","CABALT","VS-Arrow-UP","VS-Arrow-DN","CKPT-TEMP","FWD-TEMP","AFT-TEMP","Fused-weight-unit"]; }, update: func() { @@ -1078,7 +1100,7 @@ var canvas_lowerECAM_door = { return m; }, getKeys: func() { - return["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","Bulk","BulkLine","BulkLbl","Exit1L","Exit1R","Cabin1Left","Cabin1LeftLbl","Cabin1LeftLine","Cabin1LeftSlide","Cabin1Right","Cabin1RightLbl","Cabin1RightLine","Cabin1RightSlide","Cabin2Left","Cabin2LeftLbl", + return["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","Bulk","BulkLine","BulkLbl","Exit1L","Exit1R","Cabin1Left","Cabin1LeftLbl","Cabin1LeftLine","Cabin1LeftSlide","Cabin1Right","Cabin1RightLbl","Cabin1RightLine","Cabin1RightSlide","Cabin2Left","Cabin2LeftLbl", "Cabin2LeftLine","Cabin2LeftSlide","Cabin2Right","Cabin2RightLbl","Cabin2RightLine","Cabin2RightSlide","Cabin3Left","Cabin3LeftLbl","Cabin3LeftLine","Cabin3LeftSlide","Cabin3Right","Cabin3RightLbl","Cabin3RightLine","Cabin3RightSlide","AvionicsLine1", "AvionicsLbl1","AvionicsLine2","AvionicsLbl2","Cargo1Line","Cargo1Lbl","Cargo1Door","Cargo2Line","Cargo2Lbl","Cargo2Door","ExitLSlide","ExitLLine","ExitLLbl","ExitRSlide","ExitRLine","ExitRLbl","Cabin4Left","Cabin4LeftLbl","Cabin4LeftLine", "Cabin4LeftSlide","Cabin4Right","Cabin4RightLbl","Cabin4RightLine","Cabin4RightSlide","DOOROXY-REGUL-LO-PR"]; @@ -1223,7 +1245,7 @@ var canvas_lowerECAM_elec = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","BAT1-label","Bat1Volt","Bat1Ampere","BAT2-label","Bat2Volt","Bat2Ampere","BAT1-charge","BAT1-discharge","BAT2-charge","BAT2-discharge","ELEC-Line-DC1-DCBAT","ELEC-Line-DC1-DCESS","ELEC-Line-DC2-DCBAT", + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","BAT1-label","Bat1Volt","Bat1Ampere","BAT2-label","Bat2Volt","Bat2Ampere","BAT1-charge","BAT1-discharge","BAT2-charge","BAT2-discharge","ELEC-Line-DC1-DCBAT","ELEC-Line-DC1-DCESS","ELEC-Line-DC2-DCBAT", "ELEC-Line-DC1-DCESS_DCBAT","ELEC-Line-DC2-DCESS_DCBAT","ELEC-Line-TR1-DC1","ELEC-Line-TR2-DC2","Shed-label","ELEC-Line-ESSTR-DCESS","TR1-label","TR1Volt","TR1Ampere","TR2-label","TR2Volt","TR2Ampere","EMERGEN-group","EmergenVolt","EmergenHz", "ELEC-Line-Emergen-ESSTR","EMERGEN-Label-off","Emergen-Label","EMERGEN-out","ELEC-Line-ACESS-TRESS","ELEC-Line-AC1-TR1","ELEC-Line-AC2-TR2","ELEC-Line-AC1-ACESS","ELEC-Line-AC2-ACESS","ACESS-SHED","ACESS","AC1-in","AC2-in","ELEC-Line-GEN1-AC1","ELEC-Line-GEN2-AC2", "ELEC-Line-APU-AC1","ELEC-Line-APU-EXT","ELEC-Line-EXT-AC2","APU-out","EXT-out","EXTPWR-group","ExtVolt","ExtHz","APU-content","APU-border","APUGentext","APUGenLoad","APUGenVolt","APUGenHz","APUGEN-off","GEN1-label","Gen1Load","Gen1Volt","Gen1Hz", @@ -1895,7 +1917,7 @@ var canvas_lowerECAM_eng = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","OilQT1-needle","OilQT2-needle","OilQT1","OilQT2","OilQT1-decimal","OilQT2-decimal","OilPSI1-needle","OilPSI2-needle","OilPSI1","OilPSI2","FUEL-used-1","FUEL-used-2", "Fused-weight-unit"]; + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","OilQT1-needle","OilQT2-needle","OilQT1","OilQT2","OilQT1-decimal","OilQT2-decimal","OilPSI1-needle","OilPSI2-needle","OilPSI1","OilPSI2","FUEL-used-1","FUEL-used-2", "Fused-weight-unit"]; }, update: func() { # Oil Quantity @@ -1953,7 +1975,7 @@ var canvas_lowerECAM_fctl = { return m; }, getKeys: func() { - return["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","ailL","ailR","elevL","elevR","PTcc","PT","PTupdn","elac1","elac2","sec1","sec2","sec3","ailLblue","ailRblue","elevLblue","elevRblue","rudderblue","ailLgreen","ailRgreen","elevLgreen","ruddergreen","PTgreen", + return["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","ailL","ailR","elevL","elevR","PTcc","PT","PTupdn","elac1","elac2","sec1","sec2","sec3","ailLblue","ailRblue","elevLblue","elevRblue","rudderblue","ailLgreen","ailRgreen","elevLgreen","ruddergreen","PTgreen", "elevRyellow","rudderyellow","PTyellow","rudder","spdbrkblue","spdbrkgreen","spdbrkyellow","spoiler1Rex","spoiler1Rrt","spoiler2Rex","spoiler2Rrt","spoiler3Rex","spoiler3Rrt","spoiler4Rex","spoiler4Rrt","spoiler5Rex","spoiler5Rrt","spoiler1Lex", "spoiler1Lrt","spoiler2Lex","spoiler2Lrt","spoiler3Lex","spoiler3Lrt","spoiler4Lex","spoiler4Lrt","spoiler5Lex","spoiler5Lrt","spoiler1Rf","spoiler2Rf","spoiler3Rf","spoiler4Rf","spoiler5Rf","spoiler1Lf","spoiler2Lf","spoiler3Lf","spoiler4Lf", "spoiler5Lf","ailLscale","ailRscale","path4249","path4249-3","path4249-3-6-7","path4249-3-6-7-5","path4249-3-6","text4343"]; @@ -2383,7 +2405,7 @@ var canvas_lowerECAM_fuel = { return m; }, getKeys: func() { - return["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","FUEL-Pump-Left-1","FUEL-Pump-Left-2","FUEL-Pump-Center-1","FUEL-Pump-Center-2","FUEL-Pump-Right-1","FUEL-Pump-Right-2","FUEL-Left-blocked","FUEL-Right-blocked","FUEL-Center-blocked","FUEL-Left-Transfer", + return["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","FUEL-Pump-Left-1","FUEL-Pump-Left-2","FUEL-Pump-Center-1","FUEL-Pump-Center-2","FUEL-Pump-Right-1","FUEL-Pump-Right-2","FUEL-Left-blocked","FUEL-Right-blocked","FUEL-Center-blocked","FUEL-Left-Transfer", "FUEL-Right-Transfer","FUEL-Left-Outer-Inacc","FUEL-Left-Inner-Inacc","FUEL-Center-Inacc","FUEL-Right-Inner-Inacc","FUEL-Right-Outer-Inacc","FUEL-Left-Outer-quantity","FUEL-Left-Inner-quantity","FUEL-Center-quantity","FUEL-Right-Inner-quantity", "FUEL-Right-Outer-quantity","FUEL-On-Board","FUEL-Flow-per-min","FUEL-APU-arrow","FUEL-APU-line","FUEL-APU-label","FUEL-used-1","FUEL-used-both","FUEL-used-2","FUEL-ENG-Master-1","FUEL-ENG-Master-2","FUEL-XFEED","FUEL-XFEED-pipes","FUEL-Left-Outer-temp", "FUEL-Left-Inner-temp","FUEL-Right-Inner-temp","FUEL-Right-Outer-temp","FUEL-Pump-Left-1-Closed","FUEL-Pump-Left-1-Open","FUEL-Pump-Left-2-Closed","FUEL-Pump-Left-2-Open","FUEL-Pump-Center-1-Open","FUEL-Pump-Center-1-Closed","FUEL-Pump-Center-2-Closed", @@ -2663,7 +2685,7 @@ var canvas_lowerECAM_press = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit", "PRESS-Cab-VS", "PRESS-Cab-VS-neg", "PRESS-Cab-Alt"]; + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit", "PRESS-Cab-VS", "PRESS-Cab-VS-neg", "PRESS-Cab-Alt"]; }, update: func() { me["PRESS-Cab-VS"].setText(sprintf("%4.0f", press_vs_norm.getValue())); @@ -2682,7 +2704,7 @@ var canvas_lowerECAM_status = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit"]; + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit"]; }, update: func() { @@ -2698,7 +2720,7 @@ var canvas_lowerECAM_hyd = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","Green-Indicator","Blue-Indicator","Yellow-Indicator","Press-Green","Press-Blue","Press-Yellow","Green-Line","Blue-Line","Yellow-Line","PTU-Supply-Line","PTU-supply-yellow","PTU-supply-green","PTU-connection", + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","Green-Indicator","Blue-Indicator","Yellow-Indicator","Press-Green","Press-Blue","Press-Yellow","Green-Line","Blue-Line","Yellow-Line","PTU-Supply-Line","PTU-supply-yellow","PTU-supply-green","PTU-connection", "PTU-Auto-or-off","RAT-label","RAT-stowed","RAT-not-stowed","ELEC-Yellow-off","ELEC-Yellow-on","ELEC-Yellow-label","ELEC-OVTH-Yellow","ELEC-Blue-label","ELEC-OVHT-Blue","ELEC-OVHT-Yellow","Pump-Green-label","Pump-Yellow-label","Pump-Green", "Pump-LOPR-Green","Pump-Green-off","Pump-Green-on","Pump-Yellow","Pump-LOPR-Yellow","Pump-Yellow-off","Pump-Yellow-on","Pump-Blue", "Pump-Blue-off","Pump-Blue-on","Fire-Valve-Green","Fire-Valve-Yellow","LO-AIR-PRESS-Green", "LO-AIR-PRESS-Yellow","LO-AIR-PRESS-Blue","OVHT-Green","OVHT-Blue","OVHT-Yellow","Quantity-Indicator-Green","Quantity-Indicator-Blue","Quantity-Indicator-Yellow","Green-label","Blue-label","Yellow-label"]; @@ -2967,7 +2989,7 @@ var canvas_lowerECAM_wheel = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","lgctltext","NORMbrk","NWStext","leftdoor","rightdoor","nosegeardoorL","nosegeardoorR", + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","lgctltext","NORMbrk","NWStext","leftdoor","rightdoor","nosegeardoorL","nosegeardoorR", "autobrk","autobrkind","NWS","NWSrect","normbrk-rect","altnbrk","normbrkhyd","spoiler1Rex","spoiler1Rrt","spoiler2Rex","spoiler2Rrt","spoiler3Rex", "spoiler3Rrt","spoiler4Rex","spoiler4Rrt","spoiler5Rex","spoiler5Rrt","spoiler1Lex","spoiler1Lrt","spoiler2Lex","spoiler2Lrt", "spoiler3Lex","spoiler3Lrt","spoiler4Lex","spoiler4Lrt","spoiler5Lex","spoiler5Lrt","spoiler1Rf","spoiler2Rf","spoiler3Rf","spoiler4Rf","spoiler5Rf", diff --git a/Models/Instruments/Lower-ECAM/res/apu.svg b/Models/Instruments/Lower-ECAM/res/apu.svg index 77fff762..3f443c84 100644 --- a/Models/Instruments/Lower-ECAM/res/apu.svg +++ b/Models/Instruments/Lower-ECAM/res/apu.svg @@ -201,6 +201,18 @@ x="465.99081" id="tspan4176" sodipodi:role="line">00 + G.LOAD 0.6 00 + G.LOAD 0.6 @@ -37,14 +37,14 @@ guidetolerance="1" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1920" - inkscape:window-height="1030" + inkscape:window-width="1366" + inkscape:window-height="705" id="namedview371" showgrid="true" - inkscape:zoom="0.70710678" - inkscape:cx="863.7473" - inkscape:cy="199.56079" - inkscape:window-x="1592" + inkscape:zoom="1.2381039" + inkscape:cx="615.56215" + inkscape:cy="75.799562" + inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="svg2"> @@ -81,8 +81,7 @@ style="font-style:normal;font-weight:normal;line-height:0%;font-family:'Liberation Sans';letter-spacing:0px;word-spacing:0px;fill:#179ab7;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" x="500.75214" y="977.31793" - id="text6232" - sodipodi:linespacing="0%">120000 °C 00 + G.LOAD 0.6 + diff --git a/Models/Instruments/Lower-ECAM/res/cond.svg b/Models/Instruments/Lower-ECAM/res/cond.svg index e00eb275..c8319978 100644 --- a/Models/Instruments/Lower-ECAM/res/cond.svg +++ b/Models/Instruments/Lower-ECAM/res/cond.svg @@ -987,6 +987,18 @@ x="560.88452" y="976.25214" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:36px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#0dc04b">00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 diff --git a/Models/Instruments/Lower-ECAM/res/status.svg b/Models/Instruments/Lower-ECAM/res/status.svg index 05be17ab..3efe4855 100644 --- a/Models/Instruments/Lower-ECAM/res/status.svg +++ b/Models/Instruments/Lower-ECAM/res/status.svg @@ -225,6 +225,18 @@ x="560.88452" y="976.25214" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:36px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#0dc04b">00 + G.LOAD 0.6 00 + G.LOAD 0.6 0) ? pagno ~ "/" ~ pagcnt : pagno); + me["ArrowLeft"].show(); + me["ArrowRight"].show(); + }, + showPageNumbersOnly: func(pagno,pagcnt) { + me["Simple_PageNum"].show(); + me["Simple_PageNum"].setText(sprintf("%9s",pagno ~ "/" ~ pagcnt)); + me["ArrowLeft"].hide(); + me["ArrowRight"].hide(); + }, hideAllArrows: func() { me["Simple_L1_Arrow"].hide(); me["Simple_L2_Arrow"].hide(); @@ -320,7 +345,9 @@ var canvas_MCDU_base = { me.fontRight(default, default, default, default, default, default); me.fontRightS(default, default, default, default, default, default); me.fontSizeLeft(normal, normal, normal, normal, normal, normal); + me.fontSizeLeftS(small, small, small, small, small, small); me.fontSizeRight(normal, normal, normal, normal, normal, normal); + me.fontSizeRightS(small, small, small, small, small, small); }, standardFontColour: func() { me.colorLeft("wht", "wht", "wht", "wht", "wht", "wht"); @@ -364,6 +391,9 @@ var canvas_MCDU_base = { me["PRINTPAGE"].setColor(WHITE); } } + + if (!pageSwitch[i].getBoolValue()) me.defaultHide(); + if (page != "ATIS") { me["ATISSend1"].hide(); me["ATISSend2"].hide(); @@ -419,7 +449,7 @@ var canvas_MCDU_base = { } else { me["FPLN_Callsign"].hide(); } - + me.dynamicPageFunc(myFpln[i].L1, "Simple_L1"); me.dynamicPageFunc(myFpln[i].L2, "Simple_L2"); me.dynamicPageFunc(myFpln[i].L3, "Simple_L3"); @@ -497,29 +527,36 @@ var canvas_MCDU_base = { me.standardFontColour(); me["Simple_L3"].setText(" AIDS"); me["Simple_L4"].setText(" CFDS"); + pageSwitch[i].setBoolValue(1); } if (active[i].getValue() == 0) { me["Simple_L1"].setText(" FMGC"); - me["Simple_L1"].setColor(1,1,1); + me["Simple_L1"].setColor(WHITE); + me["Simple_L1_Arrow"].setColor(WHITE); } else if (active[i].getValue() == 1) { - me["Simple_L1"].setText(" FMGC(SEL)"); - me["Simple_L1"].setColor(0.0901,0.6039,0.7176); + me["Simple_L1"].setText(" FMGC (SEL)"); + me["Simple_L1"].setColor(BLUE); + me["Simple_L1_Arrow"].setColor(BLUE); } else if (active[i].getValue() == 2) { me["Simple_L1"].setText(" FMGC"); - me["Simple_L1"].setColor(0.0509,0.7529,0.2941); + me["Simple_L1"].setColor(GREEN); + me["Simple_L1_Arrow"].setColor(GREEN); } if (activeAtsu[i].getValue() == 0) { me["Simple_L2"].setText(" ATSU"); - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); + me["Simple_L2_Arrow"].setColor(WHITE); } else if (activeAtsu[i].getValue() == 1) { - me["Simple_L2"].setText(" ATSU(SEL)"); - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setText(" ATSU (SEL)"); + me["Simple_L2"].setColor(BLUE); + me["Simple_L2_Arrow"].setColor(BLUE); } else if (activeAtsu[i].getValue() == 2) { me["Simple_L2"].setText(" ATSU"); - me["Simple_L2"].setColor(0.0509,0.7529,0.2941); + me["Simple_L2"].setColor(GREEN); + me["Simple_L2_Arrow"].setColor(GREEN); } } else if (page == "ATSUDLINK") { if (!pageSwitch[i].getBoolValue()) { @@ -588,6 +625,179 @@ var canvas_MCDU_base = { me["Simple_R6"].hide(); me["Simple_R6_Arrow"].hide(); } + } else if (page == "FLTLOG") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHideWithCenter(); + + me["Simple_L0S"].hide(); + me["ArrowLeft"].hide(); + me["ArrowRight"].hide(); + + me.showLeft(1, 1, 1, 1, 1, -1); + me.showLeftS(1, -1, 1, 1, 1, -1); + me.showLeftArrow(-1, -1, -1, -1, -1, -1); + me.showCenter(-1, 1, 1, 1, 1, -1); + me.showCenterS(-1, 1, 1, 1, 1, -1); + me.showRight(1, 1, 1, 1, 1, -1); + me.showRightS(1, 1, 1, 1, 1, -1); + me.showRightArrow(-1, -1, -1, -1, 1, -1); + me["Simple_C3B"].hide(); + me["Simple_C4B"].hide(); + + me.standardFontSize(); + me.standardFontColour(); + me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorCenter("wht", "wht", "wht", "wht", "wht", "wht"); + + #me["PRINTPAGE"] - TODO missing asterisk at 5L - only useful when printing available + + me["Simple_L1S"].setText(" FLT NUM-DATE"); + me["Simple_R1S"].setText("ORIG-DEST "); + me["Simple_L1"].setFontSize(small); + me["Simple_R1"].setFontSize(small); + me["Simple_L2"].setFontSize(small); + me["Simple_C2"].setFontSize(small); + me["Simple_R2"].setFontSize(small); + me["Simple_L3"].setFontSize(small); + me["Simple_C3"].setFontSize(small); + me["Simple_R3"].setFontSize(small); + + me["Simple_L5"].setText(" PRINT"); + me["Simple_L5"].setColor(BLUE); + + me["Simple_R5"].setText("SENSORS "); + me["Simple_R5"].setColor(WHITE); + + me["Simple_L4"].setFontSize(small); + me["Simple_L4"].setText(" FLIGHT"); + me["Simple_C4"].setFontSize(small); + me["Simple_C4"].setText("--TIMES--"); + me["Simple_R4"].setFontSize(small); + me["Simple_R4"].setText("BLOCK "); + + me["Simple_C2S"].setText("TIME"); + me["Simple_R2S"].setText("FOB "); + + me["Simple_L2"].setText( " OUT -"); + me["Simple_L3S"].setText(" OFF -"); + me["Simple_L3"].setText( " ON -"); + me["Simple_L4S"].setText(" IN -"); + + me["Simple_C5"].setFontSize(small); + + pageSwitch[i].setBoolValue(1); + } + + var logid = 1; #mcdu.FlightLogDatabase.getPageSize(); - one page only - TODO: multi pages + if (logid == 0) logid = 1; + + me.showPageNumbersOnly(1,1); + me["Simple_Title"].setText(sprintf("FLT LOG.%04d",logid)); + + me["Simple_C2"].setText( "--.--"); #TODO - missing ":" char on fontset + me["Simple_C3S"].setText("--.--"); + me["Simple_C3"].setText( "--.--"); + me["Simple_C4S"].setText("--.--"); + me["Simple_R2"].setText( "---.- "); + me["Simple_R3S"].setText("---.- "); + me["Simple_R3"].setText( "---.- "); + me["Simple_R4S"].setText("---.- "); + me.colorCenter("wht", "grn", "grn", "wht", "wht", "wht"); + me.colorRight("wht", "grn", "grn", "wht", "wht", "wht"); + me.colorLeftS("wht", "wht", "wht", "wht", "grn", "wht"); + me.colorCenterS("wht", "wht", "grn", "grn", "grn", "wht"); + me.colorRightS("wht", "wht", "grn", "grn", "grn", "wht"); + + var rowsC = ["Simple_C2","Simple_C3S","Simple_C3","Simple_C4S"]; + var rowsR = ["Simple_R2","Simple_R3S","Simple_R3","Simple_R4S"]; + var logs = mcdu.FlightLogDatabase.getLogByPage(logid); + var len = size(logs); + var flgtime = 0; + var blktime = 0; + for ( var i = 0; i < len; i = i + 1 ) { + if (logs[i] != nil) { # only valid reports + var p = logs[i].state; + if (p == 4) p = 3; # RETURN-IN + me[rowsC[p]].setText(logs[i].time); + me[rowsR[p]].setText(sprintf("%3.1f ",logs[i].fob)); + } + } + + var logpage = mcdu.FlightLogDatabase.getPage(logid); + + me["Simple_L1"].setText(sprintf("%8s- ",logpage.fltnum) ~ logpage.date); + me["Simple_R1"].setText(logpage.tofrom ~ " "); + + me["Simple_L5S"].setText( " " ~ logpage.flttime ); + me["Simple_C5S"].setText(sprintf("%02.0f", getprop("/sim/time/utc/hour")) ~ "." ~ sprintf("%02.0f", getprop("/sim/time/utc/minute")) ~ "." ~ sprintf("%02.0f", getprop("/sim/time/utc/second"))); + me["Simple_R5S"].setText( logpage.blktime ~ " " ); + + var fltstate = logpage.fltstate; + if (fltstate == "") { + fltstate = (fmgc.FMGCInternal.toFromSet) ? "BEGIN" : "RESET"; #CHECKME - my best guess, only ready when plan inserted + #TODO Pushback detection -> WPUSH state??? + } + me["Simple_C5"].setText(fltstate); + + } else if (page == "SENSORS") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHide(); + me.standardFontSize(); + me["Simple_Title"].setText("SENSORS "); + me.defaultPageNumbers(); + me["Simple_L0S"].hide(); + + me.showLeft(1, 1, 1, 1, 1, 1); + me.showLeftS(1, 1, 1, 1, -1, -1); + me.showLeftArrow(-1, -1, -1, -1, -1, 1); + me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); + me.showRight(1, 1, 1, 1, -1, -1); + me.showRightS(1, 1, 1, 1, -1, -1); + me.showRightArrow(-1, -1, -1, -1, -1, -1); + + #me["PRINTPAGE"] - TODO missing asterisk at 5L - only useful when printing available + + me.standardFontSize(); + me.standardFontColour(); + + me["Simple_L1"].setFontSize(small); + me["Simple_R1"].setFontSize(small); + me["Simple_L2"].setFontSize(small); + me["Simple_R2"].setFontSize(small); + me["Simple_L3"].setFontSize(small); + me["Simple_R3"].setFontSize(small); + me["Simple_L4"].setFontSize(small); + me["Simple_R4"].setFontSize(small); + + me.colorRight("grn", "grn", "grn", "grn", "grn", "grn"); + me.colorRightS("grn", "grn", "grn", "grn", "grn", "grn"); + + me["Simple_L1S"].setText(" PARK BRAKE"); + me["Simple_L1"].setText( " NOSE STRUT"); + me["Simple_L2S"].setText( " L FWD DOOR"); + me["Simple_L2"].setText( " R FWD DOOR"); + me["Simple_L3S"].setText( " L AFT DOOR"); + me["Simple_L3"].setText( " R AFT DOOR"); + me["Simple_L4S"].setText( " GND SPEED"); + me["Simple_L4"].setText( " FOB"); + + me["Simple_L5"].setText(" PRINT"); + me["Simple_L5"].setColor(BLUE); + + me["Simple_L6"].setText(" RETURN"); + + pageSwitch[i].setBoolValue(1); + } + + me["Simple_R1S"].setText(sprintf("%-10s",(parking_brake.getValue() == 1) ? "SET" : "RELEASED")); + me["Simple_R1"].setText(sprintf("%-10s",(gear0_wow.getValue() == 1) ? "GROUND" : "FLIGHT")); + me["Simple_R2S"].setText(sprintf("%-10s",(doorL1_pos.getValue() > 0.1) ? "OPEN" : "CLOSED")); + me["Simple_R2"].setText(sprintf("%-10s",(doorR1_pos.getValue() > 0.1) ? "OPEN" : "CLOSED")); + me["Simple_R3S"].setText(sprintf("%-10s",(doorL4_pos.getValue() > 0.1) ? "OPEN" : "CLOSED")); + me["Simple_R3"].setText(sprintf("%-10s",(doorR4_pos.getValue() > 0.1) ? "OPEN" : "CLOSED")); + me["Simple_R4S"].setText(sprintf("%-10s",sprintf("%03.3f",pts.Velocities.groundspeed.getValue()))); + me["Simple_R4"].setText(sprintf("%-10s",sprintf("%03.1f",fmgc.FMGCInternal.fob))); + } else if (page == "AOCCONFIG") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); @@ -912,7 +1122,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("ATC MENU"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("1/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -922,9 +1132,9 @@ var canvas_MCDU_base = { me["Simple_L0S"].hide(); me.showLeftS(-1, -1, -1, -1, -1, 1); me.showLeftArrow(1, 1, -1, 1, 1, 1); - me.showRight(1, 1, 1, -1, 1, 1); + me.showRight(1, 1, 1, 1, 1, 1); me.showRightS(-1, -1, -1, -1, 1, -1); - me.showRightArrow(1, 1, 1, -1, 1, 1); + me.showRightArrow(1, 1, 1, 1, 1, 1); me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); @@ -948,17 +1158,108 @@ var canvas_MCDU_base = { me["Simple_R1"].setText("VERT REQ "); me["Simple_R2"].setText("OTHER "); me["Simple_R3"].setText("TEXT "); - me["Simple_R3"].setText("REPORTS "); + me["Simple_R4"].setText("REPORTS "); me["Simple_R5"].setText("STATUS "); me["Simple_R5S"].setText("CONNECTION "); me["Simple_R6"].setText("EMERGENCY "); pageSwitch[i].setBoolValue(1); } + } else if (page == "MCDUTEXT") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHideWithCenter(); + me["Simple_Title"].setText("TEXT"); + me["Simple_Title"].setColor(WHITE); + me["Simple_PageNum"].setText("1/2"); + me["Simple_PageNum"].show(); + me["ArrowLeft"].show(); + me["ArrowRight"].show(); + + me.showLeft(1, 1, 1, 1, 1, 1); + me["Simple_L0S"].hide(); + me.showLeftS(1, 1, 1, -1, 1, 1); + me.showLeftArrow(1, 1, 1, -1, 1, 1); + me.showCenter(-1, -1, -1, -1, -1, -1); + me.showCenterS(-1, -1, -1, 1, -1, -1); + me.showRightS(1, 1, 1, -1, -1, 1); + me.showRight(1, 1, 1, -1, -1, 1); + me.showRightS(1, 1, 1, -1, -1, 1); + me.showRightArrow(1, 1, 1, -1, -1, 1); + me["Simple_C3B"].hide(); + me["Simple_C4B"].hide(); + + me.standardFontSize(); + me["Simple_L4"].setFont(symbol); + + me.colorLeft("wht", "wht", "wht", "blu", "wht", "wht"); + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftArrow("blu", "blu", "blu", "wht", "wht", "wht"); + me.colorRight("wht", "wht", "wht", "wht", "wht", "blu"); + me.colorRightS("wht", "wht", "wht", "wht", "wht", "blu"); + me.colorRightArrow("blu", "blu", "blu", "wht", "wht", "blu"); + + + me["Simple_L1"].setText(" A/C PERFORM."); + me["Simple_L1S"].setText(" DUE TO"); + me["Simple_L2"].setText(" WEATHER"); + me["Simple_L2S"].setText(" DUE TO"); + me["Simple_L3"].setText(" TURBULENCE"); + me["Simple_L3S"].setText(" DUE TO"); + me["Simple_R1"].setText("MEDICAL "); + me["Simple_R1S"].setText("DUE TO "); + me["Simple_R2"].setText("TECHNICAL "); + me["Simple_R2S"].setText("DUE TO" ); + me["Simple_R3"].setText("DISCRETION "); + me["Simple_R3S"].setText("AT PILOTS "); + me["Simple_C4S"].setText("-------- FREE TEXT --------"); + me["Simple_L4"].setText("[ ]"); + me["Simple_L5"].setText(" ERASE"); + me["Simple_L5S"].setText(" ALL FIELDS"); + me["Simple_L6S"].setText(" ATC MENU"); + me["Simple_L6"].setText(" RETURN"); + me["Simple_R6S"].setText("ATC "); + me["Simple_R6"].setText("TEXT DISPL "); + pageSwitch[i].setBoolValue(1); + } + + if (atsu.freeTexts[i].selection == 0) { + pageSwitch[i].setBoolValue(0); + me["Simple_L1_Arrow"].hide(); + me["Simple_L1"].setColor(BLUE); + me["Simple_L1S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 1) { + pageSwitch[i].setBoolValue(0); + me["Simple_L2_Arrow"].hide(); + me["Simple_L2"].setColor(BLUE); + me["Simple_L2S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 2) { + pageSwitch[i].setBoolValue(0); + me["Simple_L3_Arrow"].hide(); + me["Simple_L3"].setColor(BLUE); + me["Simple_L3S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 3) { + pageSwitch[i].setBoolValue(0); + me["Simple_R1_Arrow"].hide(); + me["Simple_R1"].setColor(BLUE); + me["Simple_R1S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 4) { + pageSwitch[i].setBoolValue(0); + me["Simple_R2_Arrow"].hide(); + me["Simple_R2"].setColor(BLUE); + me["Simple_R2S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 5) { + pageSwitch[i].setBoolValue(0); + me["Simple_R3_Arrow"].hide(); + me["Simple_R3"].setColor(BLUE); + me["Simple_R3S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 9) { + pageSwitch[i].setBoolValue(0); + me["Simple_L5_Arrow"].hide(); + } } else if (page == "ATCMENU2") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); me["Simple_Title"].setText("ATC MENU"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("2/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -1055,7 +1356,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); me["Simple_Title"].setText("ATS623 ATIS MENU"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].hide(); me["ArrowLeft"].hide(); me["ArrowRight"].hide(); @@ -1734,9 +2035,9 @@ var canvas_MCDU_base = { me["Simple_Title"].setText(sprintf("%s", " " ~ acType.getValue())); me.defaultPageNumbers(); - me.showLeft(1, 1, 1, -1, 1, 1); + me.showLeft(1, 1, 1, -1, -1, 1); me["Simple_L0S"].hide(); - me.showLeftS(1, 1, 1, -1, 1, 1); + me.showLeftS(1, 1, 1, -1, -1, 1); me.showLeftArrow(-1, -1, 1, -1, -1, -1); me.showRight(-1, 1, -1, 1, 1, 1); me.showRightS(-1, -1, -1, 1, 1, 1); @@ -1759,13 +2060,17 @@ var canvas_MCDU_base = { me.colorRightS("wht", "wht", "wht", "wht", "grn", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - - me["Simple_L5"].setText("[ ]"); + if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 7) { # only on preflight and done phases + me["Simple_L5S"].setText("CHG CODE"); + me["Simple_L5S"].show(); + me["Simple_L5"].setText("[ ]"); + me["Simple_L5"].show(); + } + me["Simple_L6"].setText("+0.0/+1.0"); me["Simple_L1S"].setText(" ENG"); me["Simple_L2S"].setText(" ACTIVE NAV DATA BASE"); - me["Simple_L3S"].setText(" SECOND NAV DATA BASE"); - me["Simple_L5S"].setText("CHG CODE"); + me["Simple_L3S"].setText(" SECOND NAV DATA BASE"); me["Simple_L6S"].setText("IDLE/PERF"); me["Simple_R6"].setText("STATUS/XLOAD "); me["Simple_R6S"].setText("SOFTWARE "); @@ -1816,7 +2121,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("DATA INDEX"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("1/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -1856,7 +2161,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("DATA INDEX"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("2/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -2137,7 +2442,7 @@ var canvas_MCDU_base = { me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("INIT"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].show(); @@ -2181,12 +2486,12 @@ var canvas_MCDU_base = { if (!fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.costIndexSet) { me["INITA_CostIndex"].hide(); - me["Simple_L5"].setColor(1,1,1); + me["Simple_L5"].setColor(WHITE); me["Simple_L5"].show(); me["Simple_L5"].setText("---"); } else if (fmgc.FMGCInternal.costIndexSet) { me["INITA_CostIndex"].hide(); - me["Simple_L5"].setColor(0.0901,0.6039,0.7176); + me["Simple_L5"].setColor(BLUE); me["Simple_L5"].show(); me["Simple_L5"].setText(sprintf("%s", fmgc.FMGCInternal.costIndex)); } else { @@ -2195,28 +2500,40 @@ var canvas_MCDU_base = { } if (!fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.crzSet) { me["INITA_CruiseFLTemp"].hide(); - me["Simple_L6"].setColor(1,1,1); + me["Simple_L6"].setColor(WHITE); me["Simple_L6"].setText("-----/---g"); } else if (fmgc.FMGCInternal.crzSet and fmgc.FMGCInternal.crzTempSet) { me["INITA_CruiseFLTemp"].hide(); - me["Simple_L6"].setColor(0.0901,0.6039,0.7176); + me["Simple_L6"].setColor(BLUE); me["Simple_L6"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzFl) ~ sprintf("/%sg", fmgc.FMGCInternal.crzTemp)); } else if (fmgc.FMGCInternal.crzSet) { me["INITA_CruiseFLTemp"].hide(); - me["Simple_L6"].setColor(0.0901,0.6039,0.7176); + me["Simple_L6"].setColor(BLUE); fmgc.FMGCInternal.crzTemp = 15 - (2 * fmgc.FMGCInternal.crzFl / 10); fmgc.FMGCInternal.crzTempSet = 1; me["Simple_L6"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzFl) ~ sprintf("/%sg", fmgc.FMGCInternal.crzTemp)); } else { me["INITA_CruiseFLTemp"].show(); - me["Simple_L6"].setColor(0.7333,0.3803,0); + me["Simple_L6"].setColor(AMBER); me["Simple_L6"].setText(" g"); } + + if (fmgc.FMGCInternal.coRouteSet) { # show coRoute when valid + me["INITA_CoRoute"].hide(); + me["Simple_L1"].setText(fmgc.FMGCInternal.coRoute); + me["Simple_L1"].setColor(BLUE); + me["Simple_L1"].show(); + } else { + me["Simple_L1"].hide(); + me["INITA_CoRoute"].show(); + me["Simple_L1"].setText("NONE"); + } + if (fmgc.FMGCInternal.toFromSet) { me["INITA_CoRoute"].hide(); me["INITA_FromTo"].hide(); me["Simple_L1"].show(); - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setColor(BLUE); if (fmgc.FMGCInternal.altAirportSet) { me["Simple_L2"].setText(fmgc.FMGCInternal.altAirport); } else { @@ -2229,7 +2546,7 @@ var canvas_MCDU_base = { me["INITA_CoRoute"].show(); me["INITA_FromTo"].show(); me["Simple_L1"].hide(); - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); me["Simple_L2"].setText("----/----------"); me.showRight(-1, 1, 0, 0, 0, 0); me["Simple_R2S"].show(); @@ -2273,7 +2590,7 @@ var canvas_MCDU_base = { me["Simple_L3S"].setText("FLT NBR"); me["Simple_L5S"].setText("COST INDEX"); me["Simple_L6S"].setText("CRZ FL/TEMP"); - me["Simple_L1"].setText("NONE"); + #me["Simple_L1"].setText("NONE"); # manage before (coRoute) me["Simple_L3"].setText(sprintf("%s", fmgc.FMGCInternal.flightNum)); me["Simple_R1S"].setText("FROM/TO "); me["Simple_R2S"].setText("INIT "); @@ -2460,48 +2777,65 @@ var canvas_MCDU_base = { } else if (page == "ROUTESELECTION") { if (!pageSwitch[i].getBoolValue()) { - me.defaultHideWithCenter(); + me.defaultHide(); + me.standardFontSize(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("ROUTE SELECTION"); - me.defaultPageNumbers(); + me.showPageNumbers(1,1); - me.showLeft(1, -1, -1, -1, -1, 1); + me.showLeft(1, 1, 1, 1, 1, 1); me["Simple_L0S"].hide(); - me.showLeftS(-1, -1, -1, -1, -1, -1); + me.showLeftS(-1, 1, 1, 1, 1, -1); me.showLeftArrow(-1, -1, -1, -1, -1, 1); - me.showRight(-1, -1, -1, -1, -1, -1); - me.showRightS(-1, -1, -1, -1, -1, -1); + me.showRight(-1, 1, 1, 1, 1, 1); + me.showRightS(-1, 1, 1, 1, 1, -1); me.showRightArrow(-1, -1, -1, -1, -1, -1); - me.showCenter(-1, -1, -1, -1, -1, -1); - me["Simple_C3B"].hide(); - me["Simple_C4B"].hide(); - me.showCenterS(-1, -1, -1, -1, -1, -1); + me.fontSizeLeftS(normal, normal, normal, normal, normal, normal); + me.fontSizeRight(0, small, small, small, small, normal); + me.fontSizeRightS(0, small, small, small, small, normal); - me.fontLeft(default, 0, 0, 0, 0, default); - - me.fontSizeLeft(normal, 0, 0, 0, 0, normal); - - me.colorLeft("grn", "ack", "ack", "ack", "ack", "wht"); - - pageSwitch[i].setBoolValue(1); + me.colorLeft("grn", "grn", "grn", "grn", "grn", "wht"); + me.colorLeftS("grn", "grn", "grn", "grn", "grn", "wht"); + me.colorRight("ack", "wht", "wht", "wht", "wht", "amb"); + me.colorRightS("ack", "wht", "wht", "wht", "wht", "wht"); + + me["Simple_L1"].setText("NONE"); + me["Simple_L6"].setText(" RETURN"); + me["Simple_R6"].setText("INSERT "); + me["PRINTPAGE"].show(); + me["PRINTPAGE"].setColor(AMBER); + + var rows = ["2S","2","3S","3","4S","4","5S","5"]; + + me["Simple_L1"].setText("DUBLHR1"); + + var r = 0; + #for ( ; r < 8; r += 1) { # Example how formats rows with 4 cols + # me["Simple_L" ~ rows[r]].setText(sprintf("%11s %11s","SELKA","NUGRA")); + # me["Simple_R" ~ rows[r]].setText(sprintf("%-13s %-13s","UL975","UL975")); + #} + while (r<8) { + me["Simple_L" ~ rows[r]].setText(""); + me["Simple_R" ~ rows[r]].setText(""); + r+=1; + } + + if (fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.altSelected) { + me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.depApt ~ "/" ~ fmgc.FMGCInternal.arrApt)); + } else if (!fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) { + me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.altAirport)); + } else if (fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) { + me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.arrApt ~ "/" ~ fmgc.FMGCInternal.altAirport)); + } else { + me["Simple_Title"].setText("ROUTE SELECTION"); + } + + pageSwitch[i].setBoolValue(1); # update on request only (left/right arrows) } - me["Simple_L1"].setText("NONE"); - me["Simple_L6"].setText(" RETURN"); - - if (fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.altSelected) { - me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.depApt ~ "/" ~ fmgc.FMGCInternal.arrApt)); - } else if (!fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) { - me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.altAirport)); - } else if (fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) { - me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.arrApt ~ "/" ~ fmgc.FMGCInternal.altAirport)); - } else { - me["Simple_Title"].setText("ROUTE SELECTION"); - } - } else if (page == "INITB") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); @@ -2575,7 +2909,7 @@ var canvas_MCDU_base = { me["Simple_R5"].setText(fmgc.FMGCInternal.tripWind); me["Simple_R6S"].setText("EXTRA/TIME"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); if (!fmgc.FMGCInternal.fuelRequest) { me["Simple_L2"].setText("---.-/----"); @@ -2615,7 +2949,7 @@ var canvas_MCDU_base = { me["Simple_R6"].setText("---.-/----"); me["Simple_Title"].setText("INIT"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me.colorLeft("ack", "wht", "wht", "wht", "wht", "wht"); me.colorRight("ack", "blu", "amb", "wht", "ack", "wht"); @@ -2968,7 +3302,7 @@ var canvas_MCDU_base = { me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("FUEL PRED"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].show(); @@ -3009,12 +3343,12 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (!engrdy.getBoolValue() or !fmgc.FMGCInternal.toFromSet) { + if (!engRdy.getBoolValue() or !fmgc.FMGCInternal.toFromSet) { me["Simple_L1"].setText("NONE"); } else { me["Simple_L1"].setText(fmgc.FMGCInternal.arrApt); } - if (!engrdy.getBoolValue() or !fmgc.FMGCInternal.altAirportSet) { + if (!engRdy.getBoolValue() or !fmgc.FMGCInternal.altAirportSet) { me["Simple_L2"].setText("NONE"); } else { me["Simple_L2"].setText(fmgc.FMGCInternal.altAirport); @@ -3242,8 +3576,11 @@ var canvas_MCDU_base = { me["Simple_L6"].setFontSize(small); } - } else if (page == "PROGTO" or page == "PROGCLB" or page == "PROGCRZ" or page == "PROGDES") { - if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { + } else if (page == "PROGPREF" or page == "PROGTO" or page == "PROGCLB" or page == "PROGCRZ" or page == "PROGDES") { + if (fmgc.FMGCInternal.phase == 0) { + setprop("/MCDU[" ~ i ~ "]/page", "PROGPREF"); + page = "PROGPREF"; + } else if (fmgc.FMGCInternal.phase == 1) { setprop("/MCDU[" ~ i ~ "]/page", "PROGTO"); page = "PROGTO"; } else if (fmgc.FMGCInternal.phase == 2) { @@ -3273,30 +3610,29 @@ var canvas_MCDU_base = { me["PERFAPPR"].hide(); me["PERFGA"].hide(); - if (fmgc.FMGCInternal.flightNumSet) { - if (page == "PROGTO") { - me["Simple_Title"].setText(sprintf("TAKE OFF %s", fmgc.FMGCInternal.flightNum)); - } else if (page == "PROGCLB") { - me["Simple_Title"].setText(sprintf("CLIMB %s", fmgc.FMGCInternal.flightNum)); - } else if (page == "PROGCRZ") { - me["Simple_Title"].setText(sprintf("CRUISE %s", fmgc.FMGCInternal.flightNum)); - } else if (page == "PROGDES") { - me["Simple_Title"].setText(sprintf("DESCENT %s", fmgc.FMGCInternal.flightNum)); - } - } else { - if (page == "PROGTO") { - me["Simple_Title"].setText("TAKE OFF"); - } else if (page == "PROGCLB") { - me["Simple_Title"].setText("CLIMB"); - } else if (page == "PROGCRZ") { - me["Simple_Title"].setText("CRUISE"); - } else if (page == "PROGDES") { - me["Simple_Title"].setText("DESCENT"); - } + var colortext = ["",""]; + + if (page == "PROGPREF") { + colortext[0] = "PREFLIGHT"; + } else if (page == "PROGTO") { + colortext[0] = "TAKE OFF"; + } else if (page == "PROGCLB") { + colortext[0] = "CLIMB"; + } else if (page == "PROGCRZ") { + colortext[0] = "CRUISE"; + } else if (page == "PROGDES") { + colortext[0] = "DESCENT"; } + + colortext[1] = (fmgc.FMGCInternal.flightNumSet) ? fmgc.FMGCInternal.flightNum ~ " " : ""; # push title a little left + + me["Simple_Title"].setText(colortext[0] ~ sprintf("%" ~ (size(colortext[1])+1) ~ "s"," ")); + me["Simple_Title2"].setText(sprintf("%" ~ (size(colortext[0])+1) ~ "s"," ") ~ colortext[1]); me["Simple_Title"].show(); - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); + me["Simple_Title2"].show(); + me["Simple_Title2"].setColor(WHITE); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].hide(); @@ -3335,6 +3671,8 @@ var canvas_MCDU_base = { me.fontSizeCenter(small, small, small, small, small, normal); me.fontSizeCenterS(normal, small, small, small, small, small); + me["Simple_C1S"].setFontSize(small); + me.colorLeft("blu", "wht", "blu", "wht", "wht", "blu"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); @@ -3415,7 +3753,7 @@ var canvas_MCDU_base = { me.showLeftS(1, 1, 1, 1, 1, 1); me.showLeftArrow(-1, -1, -1, -1, -1, 1); me.showRight(-1, 1, 1, 1, 1, 1); - me.showRightS(-1, 1, 1, 1, 1, 1); + me.showRightS(1, 1, 1, 1, 1, 1); me.showRightArrow(-1, -1, -1, -1, -1, 1); me.showCenter(1, 1, 1, -1, -1, -1); me["Simple_C3B"].hide(); @@ -3434,11 +3772,13 @@ var canvas_MCDU_base = { me.colorLeft("blu", "blu", "blu", "blu", "blu", "wht"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRight("wht", "blu", "blu", "blu", "blu", "wht"); + me.colorRight("grn", "blu", "blu", "blu", "blu", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); me.colorCenter("grn", "grn", "grn", "wht", "wht", "wht"); me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); + + me["Simple_Title"].setText("TAKE OFF"); pageSwitch[i].setBoolValue(1); } @@ -3478,17 +3818,24 @@ var canvas_MCDU_base = { me["Simple_L6S"].hide(); } - if (fmgc.FMGCInternal.phase == 1) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + if (fmgc.FMGCInternal.phase > 0) { # not modifiable from TO phase + me["Simple_Title"].setColor(GREEN); + me.colorLeft("grn", "grn", "grn", "blu", "grn", "wht"); + me.colorRight("grn", "blu", "grn", "grn", "grn", "wht"); } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); + me.colorLeft("blu", "blu", "blu", "blu", "blu", "wht"); + me.colorRight("grn", "blu", "blu", "blu", "blu", "wht"); } if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) { - me["Simple_Title"].setText(sprintf("TAKE OFF RWY %s", fmgc.flightPlanController.flightplans[2].departure_runway.id)); + me["Simple_R1"].setText(fmgc.flightPlanController.flightplans[2].departure_runway.id ~ " "); + me["Simple_R1"].show(); } else { - me["Simple_Title"].setText("TAKE OFF"); + me["Simple_R1"].hide(); } + + if (fmgc.FMGCInternal.v1set) { me["PERFTO_V1"].hide(); @@ -3610,7 +3957,7 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 2) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); me.showLeft(0, 0, 0, 0, 1, 0); me.showLeftS(0, 0, 0, 0, 1, 0); me.showLeftArrow(0, 0, 0, 0, 1, 1); @@ -3651,7 +3998,7 @@ var canvas_MCDU_base = { setprop("/FMGC/internal/activate-twice", 0); } } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me.showLeft(0, 0, 0, 0, -1, 0); me.showLeftS(0, 0, 0, 0, -1, 0); me.showLeftArrow(0, 0, 0, 0, -1, 0); @@ -3685,10 +4032,10 @@ var canvas_MCDU_base = { me["Simple_L2S"].setText(" CI"); if (fmgc.FMGCInternal.costIndexSet) { - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setColor(BLUE); me["Simple_L2"].setText(sprintf(" %s", fmgc.FMGCInternal.costIndex)); } else { - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); me["Simple_L2"].setText(" ---"); } @@ -3763,7 +4110,7 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 3) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); if (managedSpeed.getValue() == 1) { me.showLeft(0, 0, 0, -1, 0, 0); @@ -3798,7 +4145,7 @@ var canvas_MCDU_base = { setprop("/FMGC/internal/activate-twice", 0); } } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me.colorLeft("ack", "ack", "ack", "ack", "ack", "wht"); me.colorLeftS("ack", "ack", "ack", "ack", "ack", "wht"); @@ -3825,10 +4172,10 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.costIndexSet) { - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setColor(BLUE); me["Simple_L2"].setText(sprintf(" %s", fmgc.FMGCInternal.costIndex)); } else { - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); me["Simple_L2"].setText(" ---"); } @@ -3901,7 +4248,7 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 4) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); me.showLeft(0, 0, 0, 0, 1, 0); me.showRight(0, 1, 0, 1, 0, 0); me.showRightS(0, 0, 1, 0, 0, 0); @@ -3941,7 +4288,7 @@ var canvas_MCDU_base = { setprop("/FMGC/internal/activate-twice", 0); } } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me.showLeft(0, 0, 0, 0, -1, 0); me.showRight(0, -1, 0, -1, 0, 0); me.showRightS(0, 0, -1, 0, 0, 0); @@ -3973,10 +4320,10 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.costIndexSet) { - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setColor(BLUE); me["Simple_L2"].setText(sprintf(" %2.0f", fmgc.FMGCInternal.costIndex)); } else { - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); me["Simple_L2"].setText(" ---"); } @@ -4057,9 +4404,9 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 5) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); } me["Simple_L0S"].setText("DEST"); @@ -4240,9 +4587,9 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 6) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); } if (thrAccSet.getValue() == 1) { diff --git a/Models/Instruments/MCDU/MCDU1.xml b/Models/Instruments/MCDU/MCDU1.xml index 51439c6d..1b7c9182 100644 --- a/Models/Instruments/MCDU/MCDU1.xml +++ b/Models/Instruments/MCDU/MCDU1.xml @@ -1705,7 +1705,7 @@ true nasal - + @@ -1719,6 +1719,24 @@ + + + nasal + + + + + systems/electrical/bus/ac-1 + 110 + + + controls/lighting/DU/mcdu1 + 0.01 + + + + + diff --git a/Models/Instruments/MCDU/MCDU2.xml b/Models/Instruments/MCDU/MCDU2.xml index 38324cf0..78516b3e 100644 --- a/Models/Instruments/MCDU/MCDU2.xml +++ b/Models/Instruments/MCDU/MCDU2.xml @@ -1705,7 +1705,7 @@ true nasal - + @@ -1719,6 +1719,24 @@ + + + nasal + + + + + systems/electrical/bus/ac-2 + 110 + + + controls/lighting/DU/mcdu2 + 0.01 + + + + + diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg index 9eb38288..ecda2737 100644 --- a/Models/Instruments/MCDU/res/mcdu.svg +++ b/Models/Instruments/MCDU/res/mcdu.svg @@ -12,7 +12,7 @@ viewBox="0 0 1024 864" version="1.1" id="svg2" - inkscape:version="0.92.4 (5da689c313, 2019-01-14)" + inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)" sodipodi:docname="mcdu.svg"> @@ -37,17 +37,17 @@ guidetolerance="20" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1366" - inkscape:window-height="705" + inkscape:window-width="1920" + inkscape:window-height="1017" id="namedview371" showgrid="true" - inkscape:zoom="3.1578866" - inkscape:cx="1122.1906" - inkscape:cy="986.92422" + inkscape:zoom="0.55824076" + inkscape:cx="608.20261" + inkscape:cy="690.7315" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" - inkscape:current-layer="svg2" + inkscape:current-layer="Simple" showguides="false" inkscape:snap-global="false" units="px" @@ -306,6 +306,19 @@ y="539.16522" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke-width:1px">TEXT + TITLE + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -1103,7 +1116,7 @@ x="177.72771" style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" xml:space="preserve"> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -1235,7 +1248,7 @@ inkscape:label="arrow5L" id="arrow5L"> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -2617,7 +2630,7 @@ id="tspan1088" x="478.87796" y="171.04486" - style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.99240112px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">= + style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.9924px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">= = + style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.9924px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">= @@ -3019,9 +3032,9 @@ inkscape:connector-curvature="0" id="path1273" d="M 998.71909,284.70793 H 970.18944" - style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> = 110 and du1_lgt.getValue() > 0.01) { if (du1_test_time.getValue() + du1_test_amount.getValue() >= elapsedtime_act and cpt_du_xfr.getValue() != 1) { PFD_1_test.update(); - updateL = 0; PFD_1.page.hide(); PFD_1_test.page.show(); } else if (du2_test_time.getValue() + du2_test_amount.getValue() >= elapsedtime_act and cpt_du_xfr.getValue() == 1) { PFD_1_test.update(); - updateL = 0; PFD_1.page.hide(); PFD_1_test.page.show(); } else { - PFD_1.updateFast(); - if (!updateL) { # Update slow here once so that no flicker if timers don't perfectly align - updateL = 1; - PFD_1.update(); - } + PFD_1.update(); PFD_1_test.page.hide(); PFD_1.page.show(); } } else { - updateL = 0; PFD_1_test.page.hide(); PFD_1.page.hide(); } if (systems.ELEC.Bus.ac2.getValue() >= 110 and du6_lgt.getValue() > 0.01) { if (du6_test_time.getValue() + du6_test_amount.getValue() >= elapsedtime_act and fo_du_xfr.getValue() != 1) { PFD_2_test.update(); - updateR = 0; PFD_2.page.hide(); PFD_2_test.page.show(); } else if (du5_test_time.getValue() + du5_test_amount.getValue() >= elapsedtime_act and fo_du_xfr.getValue() == 1) { PFD_2_test.update(); - updateR = 0; PFD_2.page.hide(); PFD_2_test.page.show(); } else { - PFD_2.updateFast(); - if (!updateR) { # Update slow here once so that no flicker if timers don't perfectly align - updateR = 1; - PFD_2.update(); - } + PFD_2.update(); PFD_2_test.page.hide(); PFD_2.page.show(); } } else { - updateR = 0; PFD_2_test.page.hide(); PFD_2.page.hide(); } } else { - updateL = 0; - updateR = 0; PFD_1_test.page.hide(); PFD_1.page.hide(); PFD_2_test.page.hide(); @@ -342,14 +323,6 @@ var canvas_PFD_base = { PFD_2_mismatch.page.show(); } }, - updateSlow: func() { - if (updateL) { - PFD_1.update(); - } - if (updateR) { - PFD_2.update(); - } - }, updateCommon: func () { # FMA MAN TOGA MCT FLX THR # Set properties used a lot to a variable to avoid calling getValue() multiple times @@ -360,6 +333,310 @@ var canvas_PFD_base = { toga_lk_act = toga_lk.getValue(); thr1_act = thr1.getValue(); thr2_act = thr2.getValue(); + + # Attitude Indicator + pitch_cur = pitch.getValue(); + roll_cur = roll.getValue(); + + me.AI_horizon_trans.setTranslation(0, pitch_cur * 11.825); + me.AI_horizon_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); + me.AI_horizon_ground_trans.setTranslation(0, horizon_ground.getValue() * 11.825); + me.AI_horizon_ground_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); + me.AI_horizon_sky_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); + + me["AI_slipskid"].setTranslation(math.clamp(slip_skid.getValue(), -15, 15) * 7, 0); + me["AI_bank"].setRotation(-roll_cur * D2R); + + if (fbw_law.getValue() == 0) { + me["AI_bank_lim"].show(); + me["AI_pitch_lim"].show(); + me["AI_bank_lim_X"].hide(); + me["AI_pitch_lim_X"].hide(); + } else { + me["AI_bank_lim"].hide(); + me["AI_pitch_lim"].hide(); + me["AI_bank_lim_X"].show(); + me["AI_pitch_lim_X"].show(); + } + + fd_roll_cur = fd_roll.getValue(); + fd_pitch_cur = fd_pitch.getValue(); + if (fd_roll_cur != nil) { + me["FD_roll"].setTranslation((fd_roll_cur) * 2.2, 0); + } + if (fd_pitch_cur != nil) { + me["FD_pitch"].setTranslation(0, -(fd_pitch_cur) * 3.8); + } + + gear_agl_cur = gear_agl.getValue(); + + me["AI_agl"].setText(sprintf("%s", math.round(math.clamp(gear_agl_cur, 0, 2500)))); + + if (fmgc.FMGCInternal.phase < 3 or fmgc.flightPlanController.arrivalDist >= 250) { + me["FMA_dh_box"].hide(); + me["FMA_dh"].hide(); + me["FMA_dhn"].hide(); + me["FMA_nodh"].hide(); + #me["dhReached"].hide(); + if (gear_agl_cur <= 2500) { + me["AI_agl"].show(); + if (gear_agl_cur <= decision.getValue()) { + me["AI_agl"].setColor(0.7333,0.3803,0); + } else { + me["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } else { + me["AI_agl"].hide(); + } + } else { + if (gear_agl_cur <= 2500) { + me["AI_agl"].show(); + me["FMA_dh_box"].hide(); #not implemented + if (int(getprop("/FMGC/internal/radio")) != 99999) { + me["FMA_dh"].setText("RADIO"); + me["FMA_dh"].show(); + me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/radio"))); + me["FMA_dhn"].show(); + me["FMA_nodh"].hide(); + hundredAbove.setValue(getprop("/FMGC/internal/radio") + 100); + minimum.setValue(getprop("/FMGC/internal/radio")); + if (gear_agl_cur <= getprop("/FMGC/internal/radio") + 100) { + me["AI_agl"].setColor(0.7333,0.3803,0); + } else { + me["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } else if (int(getprop("/FMGC/internal/baro")) != 99999) { + me["FMA_dh"].setText("BARO"); + me["FMA_dh"].show(); + me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/baro"))); + me["FMA_dhn"].show(); + me["FMA_nodh"].hide(); + hundredAbove.setValue(getprop("/FMGC/internal/baro") + 100); + minimum.setValue(getprop("/FMGC/internal/baro")); + if (gear_agl_cur <= getprop("/FMGC/internal/baro") + 100) { + me["AI_agl"].setColor(0.7333,0.3803,0); + } else { + me["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } else if (fmgc.FMGCInternal.radioNo) { + me["FMA_dh"].setText("BARO"); + me["FMA_dh"].show(); + me["FMA_dhn"].setText("100"); + me["FMA_dhn"].show(); + me["FMA_nodh"].hide(); + hundredAbove.setValue(100); + minimum.setValue(0); + if (gear_agl_cur <= 100) { + me["AI_agl"].setColor(0.7333,0.3803,0); + } else { + me["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } else { + me["FMA_dh"].hide(); + me["FMA_dhn"].hide(); + me["FMA_nodh"].show(); + hundredAbove.setValue(400); + minimum.setValue(300); + if (gear_agl_cur <= 400) { + me["AI_agl"].setColor(0.7333,0.3803,0); + } else { + me["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } + } else { + me["AI_agl"].hide(); + me["FMA_nodh"].hide(); + me["FMA_dh_box"].hide(); #not implemented + if (int(getprop("/FMGC/internal/radio")) != 99999) { + me["FMA_dh"].setText("RADIO"); + me["FMA_dh"].show(); + me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/radio"))); + me["FMA_dhn"].show(); + me["FMA_nodh"].hide(); + } else if (int(getprop("/FMGC/internal/baro")) != 99999) { + me["FMA_dh"].setText("BARO"); + me["FMA_dh"].show(); + me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/baro"))); + me["FMA_dhn"].show(); + me["FMA_nodh"].hide(); + } else if (fmgc.FMGCInternal.radioNo) { + me["FMA_dh"].setText("BARO"); + me["FMA_dh"].show(); + me["FMA_dhn"].setText("100"); + me["FMA_dhn"].show(); + me["FMA_nodh"].hide(); + } else { + me["FMA_dh"].hide(); + me["FMA_dhn"].hide(); + me["FMA_nodh"].show(); + } + } + } + + me["AI_agl_g"].setRotation(-roll_cur * D2R); + + FMGCphase_act = fmgc.FMGCInternal.phase; + if ((wow1.getValue() == 1 or wow2.getValue() == 1) and FMGCphase_act != 0 and FMGCphase_act != 1) { + me["AI_stick"].show(); + me["AI_stick_pos"].show(); + + } else if ((wow1.getValue() == 1 or wow2.getValue() == 1) and (FMGCphase_act == 0 or FMGCphase_act == 1) and (eng0_state.getValue() == 3 or eng1_state.getValue() == 3)) { + me["AI_stick"].show(); + me["AI_stick_pos"].show(); + } else { + me["AI_stick"].hide(); + me["AI_stick_pos"].hide(); + } + + me["AI_stick_pos"].setTranslation(aileron_input.getValue() * 196.8, elevator_input.getValue() * 151.5); + + # Vertical Speed + me["VS_pointer"].setRotation(vs_needle.getValue() * D2R); + + me["VS_box"].setTranslation(0, vs_digit.getValue()); + + var vs_pfd_cur = ap_vs_pfd.getValue(); + if (vs_pfd_cur < 2) { + me["VS_box"].hide(); + } else { + me["VS_box"].show(); + } + + if (vs_pfd_cur < 10) { + me["VS_digit"].setText(sprintf("%02d", "0" ~ vs_pfd_cur)); + } else { + me["VS_digit"].setText(sprintf("%02d", vs_pfd_cur)); + } + + var vs_itaf = fmgc.Internal.vs.getValue(); + var gearAgl = gear_agl.getValue(); + + if (abs(vs_itaf) >= 6000 or (vs_itaf <= -2000 and gearAgl <= 2500) or (vs_itaf <= -1200 and gearAgl <= 1000)) { + me["VS_digit"].setColor(0.7333,0.3803,0); + me["VS_pointer"].setColor(0.7333,0.3803,0); + me["VS_pointer"].setColorFill(0.7333,0.3803,0); + } else { + me["VS_digit"].setColor(0.0509,0.7529,0.2941); + me["VS_pointer"].setColor(0.0509,0.7529,0.2941); + me["VS_pointer"].setColorFill(0.0509,0.7529,0.2941); + } + + # ILS + me["LOC_pointer"].setTranslation(loc.getValue() * 197, 0); + me["GS_pointer"].setTranslation(0, gs.getValue() * -197); + + # Heading + me.heading = hdg_scale.getValue(); + me.headOffset = me.heading / 10 - int(me.heading / 10); + me.middleText = roundabout(me.heading / 10); + me.middleOffset = nil; + if(me.middleText == 36) { + me.middleText = 0; + } + me.leftText1 = me.middleText == 0?35:me.middleText - 1; + me.rightText1 = me.middleText == 35?0:me.middleText + 1; + me.leftText2 = me.leftText1 == 0?35:me.leftText1 - 1; + me.rightText2 = me.rightText1 == 35?0:me.rightText1 + 1; + me.leftText3 = me.leftText2 == 0?35:me.leftText2 - 1; + me.rightText3 = me.rightText2 == 35?0:me.rightText2 + 1; + if (me.headOffset > 0.5) { + me.middleOffset = -(me.headOffset - 1) * 98.5416; + } else { + me.middleOffset = -me.headOffset * 98.5416; + } + me["HDG_scale"].setTranslation(me.middleOffset, 0); + me["HDG_scale"].update(); + me["HDG_four"].setText(sprintf("%d", me.middleText)); + me["HDG_five"].setText(sprintf("%d", me.rightText1)); + me["HDG_three"].setText(sprintf("%d", me.leftText1)); + me["HDG_six"].setText(sprintf("%d", me.rightText2)); + me["HDG_two"].setText(sprintf("%d", me.leftText2)); + me["HDG_seven"].setText(sprintf("%d", me.rightText3)); + me["HDG_one"].setText(sprintf("%d", me.leftText3)); + + me["HDG_four"].setFontSize(fontSizeHDG(me.middleText), 1); + me["HDG_five"].setFontSize(fontSizeHDG(me.rightText1), 1); + me["HDG_three"].setFontSize(fontSizeHDG(me.leftText1), 1); + me["HDG_six"].setFontSize(fontSizeHDG(me.rightText2), 1); + me["HDG_two"].setFontSize(fontSizeHDG(me.leftText2), 1); + me["HDG_seven"].setFontSize(fontSizeHDG(me.rightText3), 1); + me["HDG_one"].setFontSize(fontSizeHDG(me.leftText3), 1); + + show_hdg_act = show_hdg.getValue(); + hdg_diff_act = hdg_diff.getValue(); + if (show_hdg_act == 1 and hdg_diff_act >= -23.62 and hdg_diff_act <= 23.62) { + me["HDG_target"].setTranslation((hdg_diff_act / 10) * 98.5416, 0); + me["HDG_digit_L"].hide(); + me["HDG_digit_R"].hide(); + me["HDG_target"].show(); + } else if (show_hdg_act == 1 and hdg_diff_act < -23.62 and hdg_diff_act >= -180) { + me["HDG_digit_L"].setText(sprintf("%3.0f", ap_hdg.getValue())); + me["HDG_digit_L"].show(); + me["HDG_digit_R"].hide(); + me["HDG_target"].hide(); + } else if (show_hdg_act == 1 and hdg_diff_act > 23.62 and hdg_diff_act <= 180) { + me["HDG_digit_R"].setText(sprintf("%3.0f", ap_hdg.getValue())); + me["HDG_digit_R"].show(); + me["HDG_digit_L"].hide(); + me["HDG_target"].hide(); + } else { + me["HDG_digit_L"].hide(); + me["HDG_digit_R"].hide(); + me["HDG_target"].hide(); + } + + + var heading_deg = heading.getValue(); + track_diff = geo.normdeg180(track.getValue() - heading_deg); + me["TRK_pointer"].setTranslation(me.getTrackDiffPixels(track_diff),0); + split_ils = split("/", ils_data1.getValue()); + + if (ap_ils_mode.getValue() == 1 and size(split_ils) == 2) { + magnetic_hdg = ils_crs.getValue(); + magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading_deg); + if (magnetic_hdg_dif >= -23.62 and magnetic_hdg_dif <= 23.62) { + me["CRS_pointer"].setTranslation((magnetic_hdg_dif / 10) * 98.5416, 0); + me["ILS_HDG_R"].hide(); + me["ILS_HDG_L"].hide(); + me["CRS_pointer"].show(); + } else if (magnetic_hdg_dif < -23.62 and magnetic_hdg_dif >= -180) { + if (int(magnetic_hdg) < 10) { + me["ILS_left"].setText(sprintf("00%1.0f", int(magnetic_hdg))); + } else if (int(magnetic_hdg) < 100) { + me["ILS_left"].setText(sprintf("0%2.0f", int(magnetic_hdg))); + } else { + me["ILS_left"].setText(sprintf("%3.0f", int(magnetic_hdg))); + } + me["ILS_HDG_L"].show(); + me["ILS_HDG_R"].hide(); + me["CRS_pointer"].hide(); + } else if (magnetic_hdg_dif > 23.62 and magnetic_hdg_dif <= 180) { + if (int(magnetic_hdg) < 10) { + me["ILS_right"].setText(sprintf("00%1.0f", int(magnetic_hdg))); + } else if (int(magnetic_hdg) < 100) { + me["ILS_right"].setText(sprintf("0%2.0f", int(magnetic_hdg))); + } else { + me["ILS_right"].setText(sprintf("%3.0f", int(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(); + } + + # AI HDG + me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, horizon_pitch.getValue() * 11.825); + me.AI_horizon_hdg_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); + me["AI_heading"].update(); + if (athr.getValue() == 1 and (state1_act == "TOGA" or state1_act == "MCT" or state1_act == "MAN THR" or state2_act == "TOGA" or state2_act == "MCT" or state2_act == "MAN THR") and eng_out.getValue() != 1 and alpha_floor_act != 1 and toga_lk_act != 1) { me["FMA_man"].show(); @@ -724,310 +1001,6 @@ var canvas_PFD_base = { } }, - updateCommonFast: func() { - # Attitude Indicator - pitch_cur = pitch.getValue(); - roll_cur = roll.getValue(); - - me.AI_horizon_trans.setTranslation(0, pitch_cur * 11.825); - me.AI_horizon_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); - me.AI_horizon_ground_trans.setTranslation(0, horizon_ground.getValue() * 11.825); - me.AI_horizon_ground_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); - me.AI_horizon_sky_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); - - me["AI_slipskid"].setTranslation(math.clamp(slip_skid.getValue(), -15, 15) * 7, 0); - me["AI_bank"].setRotation(-roll_cur * D2R); - - if (fbw_law.getValue() == 0) { - me["AI_bank_lim"].show(); - me["AI_pitch_lim"].show(); - me["AI_bank_lim_X"].hide(); - me["AI_pitch_lim_X"].hide(); - } else { - me["AI_bank_lim"].hide(); - me["AI_pitch_lim"].hide(); - me["AI_bank_lim_X"].show(); - me["AI_pitch_lim_X"].show(); - } - - fd_roll_cur = fd_roll.getValue(); - fd_pitch_cur = fd_pitch.getValue(); - if (fd_roll_cur != nil) { - me["FD_roll"].setTranslation((fd_roll_cur) * 2.2, 0); - } - if (fd_pitch_cur != nil) { - me["FD_pitch"].setTranslation(0, -(fd_pitch_cur) * 3.8); - } - - gear_agl_cur = gear_agl.getValue(); - - me["AI_agl"].setText(sprintf("%s", math.round(math.clamp(gear_agl_cur, 0, 2500)))); - - if (fmgc.FMGCInternal.phase < 3 or fmgc.flightPlanController.arrivalDist >= 250) { - me["FMA_dh_box"].hide(); - me["FMA_dh"].hide(); - me["FMA_dhn"].hide(); - me["FMA_nodh"].hide(); - #me["dhReached"].hide(); - if (gear_agl_cur <= 2500) { - me["AI_agl"].show(); - if (gear_agl_cur <= decision.getValue()) { - me["AI_agl"].setColor(0.7333,0.3803,0); - } else { - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } else { - me["AI_agl"].hide(); - } - } else { - if (gear_agl_cur <= 2500) { - me["AI_agl"].show(); - me["FMA_dh_box"].hide(); #not implemented - if (int(getprop("/FMGC/internal/radio")) != 99999) { - me["FMA_dh"].setText("RADIO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/radio"))); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - hundredAbove.setValue(getprop("/FMGC/internal/radio") + 100); - minimum.setValue(getprop("/FMGC/internal/radio")); - if (gear_agl_cur <= getprop("/FMGC/internal/radio") + 100) { - me["AI_agl"].setColor(0.7333,0.3803,0); - } else { - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } else if (int(getprop("/FMGC/internal/baro")) != 99999) { - me["FMA_dh"].setText("BARO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/baro"))); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - hundredAbove.setValue(getprop("/FMGC/internal/baro") + 100); - minimum.setValue(getprop("/FMGC/internal/baro")); - if (gear_agl_cur <= getprop("/FMGC/internal/baro") + 100) { - me["AI_agl"].setColor(0.7333,0.3803,0); - } else { - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } else if (fmgc.FMGCInternal.radioNo) { - me["FMA_dh"].setText("BARO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText("100"); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - hundredAbove.setValue(100); - minimum.setValue(0); - if (gear_agl_cur <= 100) { - me["AI_agl"].setColor(0.7333,0.3803,0); - } else { - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } else { - me["FMA_dh"].hide(); - me["FMA_dhn"].hide(); - me["FMA_nodh"].show(); - hundredAbove.setValue(400); - minimum.setValue(300); - if (gear_agl_cur <= 400) { - me["AI_agl"].setColor(0.7333,0.3803,0); - } else { - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } - } else { - me["AI_agl"].hide(); - me["FMA_nodh"].hide(); - me["FMA_dh_box"].hide(); #not implemented - if (int(getprop("/FMGC/internal/radio")) != 99999) { - me["FMA_dh"].setText("RADIO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/radio"))); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - } else if (int(getprop("/FMGC/internal/baro")) != 99999) { - me["FMA_dh"].setText("BARO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/baro"))); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - } else if (fmgc.FMGCInternal.radioNo) { - me["FMA_dh"].setText("BARO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText("100"); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - } else { - me["FMA_dh"].hide(); - me["FMA_dhn"].hide(); - me["FMA_nodh"].show(); - } - } - } - - me["AI_agl_g"].setRotation(-roll_cur * D2R); - - FMGCphase_act = fmgc.FMGCInternal.phase; - if ((wow1.getValue() == 1 or wow2.getValue() == 1) and FMGCphase_act != 0 and FMGCphase_act != 1) { - me["AI_stick"].show(); - me["AI_stick_pos"].show(); - - } else if ((wow1.getValue() == 1 or wow2.getValue() == 1) and (FMGCphase_act == 0 or FMGCphase_act == 1) and (eng0_state.getValue() == 3 or eng1_state.getValue() == 3)) { - me["AI_stick"].show(); - me["AI_stick_pos"].show(); - } else { - me["AI_stick"].hide(); - me["AI_stick_pos"].hide(); - } - - me["AI_stick_pos"].setTranslation(aileron_input.getValue() * 196.8, elevator_input.getValue() * 151.5); - - # Vertical Speed - me["VS_pointer"].setRotation(vs_needle.getValue() * D2R); - - me["VS_box"].setTranslation(0, vs_digit.getValue()); - - var vs_pfd_cur = ap_vs_pfd.getValue(); - if (vs_pfd_cur < 2) { - me["VS_box"].hide(); - } else { - me["VS_box"].show(); - } - - if (vs_pfd_cur < 10) { - me["VS_digit"].setText(sprintf("%02d", "0" ~ vs_pfd_cur)); - } else { - me["VS_digit"].setText(sprintf("%02d", vs_pfd_cur)); - } - - var vs_itaf = fmgc.Internal.vs.getValue(); - var gearAgl = gear_agl.getValue(); - - if (abs(vs_itaf) >= 6000 or (vs_itaf <= -2000 and gearAgl <= 2500) or (vs_itaf <= -1200 and gearAgl <= 1000)) { - me["VS_digit"].setColor(0.7333,0.3803,0); - me["VS_pointer"].setColor(0.7333,0.3803,0); - me["VS_pointer"].setColorFill(0.7333,0.3803,0); - } else { - me["VS_digit"].setColor(0.0509,0.7529,0.2941); - me["VS_pointer"].setColor(0.0509,0.7529,0.2941); - me["VS_pointer"].setColorFill(0.0509,0.7529,0.2941); - } - - # ILS - me["LOC_pointer"].setTranslation(loc.getValue() * 197, 0); - me["GS_pointer"].setTranslation(0, gs.getValue() * -197); - - # Heading - me.heading = hdg_scale.getValue(); - me.headOffset = me.heading / 10 - int(me.heading / 10); - me.middleText = roundabout(me.heading / 10); - me.middleOffset = nil; - if(me.middleText == 36) { - me.middleText = 0; - } - me.leftText1 = me.middleText == 0?35:me.middleText - 1; - me.rightText1 = me.middleText == 35?0:me.middleText + 1; - me.leftText2 = me.leftText1 == 0?35:me.leftText1 - 1; - me.rightText2 = me.rightText1 == 35?0:me.rightText1 + 1; - me.leftText3 = me.leftText2 == 0?35:me.leftText2 - 1; - me.rightText3 = me.rightText2 == 35?0:me.rightText2 + 1; - if (me.headOffset > 0.5) { - me.middleOffset = -(me.headOffset - 1) * 98.5416; - } else { - me.middleOffset = -me.headOffset * 98.5416; - } - me["HDG_scale"].setTranslation(me.middleOffset, 0); - me["HDG_scale"].update(); - me["HDG_four"].setText(sprintf("%d", me.middleText)); - me["HDG_five"].setText(sprintf("%d", me.rightText1)); - me["HDG_three"].setText(sprintf("%d", me.leftText1)); - me["HDG_six"].setText(sprintf("%d", me.rightText2)); - me["HDG_two"].setText(sprintf("%d", me.leftText2)); - me["HDG_seven"].setText(sprintf("%d", me.rightText3)); - me["HDG_one"].setText(sprintf("%d", me.leftText3)); - - me["HDG_four"].setFontSize(fontSizeHDG(me.middleText), 1); - me["HDG_five"].setFontSize(fontSizeHDG(me.rightText1), 1); - me["HDG_three"].setFontSize(fontSizeHDG(me.leftText1), 1); - me["HDG_six"].setFontSize(fontSizeHDG(me.rightText2), 1); - me["HDG_two"].setFontSize(fontSizeHDG(me.leftText2), 1); - me["HDG_seven"].setFontSize(fontSizeHDG(me.rightText3), 1); - me["HDG_one"].setFontSize(fontSizeHDG(me.leftText3), 1); - - show_hdg_act = show_hdg.getValue(); - hdg_diff_act = hdg_diff.getValue(); - if (show_hdg_act == 1 and hdg_diff_act >= -23.62 and hdg_diff_act <= 23.62) { - me["HDG_target"].setTranslation((hdg_diff_act / 10) * 98.5416, 0); - me["HDG_digit_L"].hide(); - me["HDG_digit_R"].hide(); - me["HDG_target"].show(); - } else if (show_hdg_act == 1 and hdg_diff_act < -23.62 and hdg_diff_act >= -180) { - me["HDG_digit_L"].setText(sprintf("%3.0f", ap_hdg.getValue())); - me["HDG_digit_L"].show(); - me["HDG_digit_R"].hide(); - me["HDG_target"].hide(); - } else if (show_hdg_act == 1 and hdg_diff_act > 23.62 and hdg_diff_act <= 180) { - me["HDG_digit_R"].setText(sprintf("%3.0f", ap_hdg.getValue())); - me["HDG_digit_R"].show(); - me["HDG_digit_L"].hide(); - me["HDG_target"].hide(); - } else { - me["HDG_digit_L"].hide(); - me["HDG_digit_R"].hide(); - me["HDG_target"].hide(); - } - - - var heading_deg = heading.getValue(); - track_diff = geo.normdeg180(track.getValue() - heading_deg); - me["TRK_pointer"].setTranslation(me.getTrackDiffPixels(track_diff),0); - split_ils = split("/", ils_data1.getValue()); - - if (ap_ils_mode.getValue() == 1 and size(split_ils) == 2) { - magnetic_hdg = ils_crs.getValue(); - magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading_deg); - if (magnetic_hdg_dif >= -23.62 and magnetic_hdg_dif <= 23.62) { - me["CRS_pointer"].setTranslation((magnetic_hdg_dif / 10) * 98.5416, 0); - me["ILS_HDG_R"].hide(); - me["ILS_HDG_L"].hide(); - me["CRS_pointer"].show(); - } else if (magnetic_hdg_dif < -23.62 and magnetic_hdg_dif >= -180) { - if (int(magnetic_hdg) < 10) { - me["ILS_left"].setText(sprintf("00%1.0f", int(magnetic_hdg))); - } else if (int(magnetic_hdg) < 100) { - me["ILS_left"].setText(sprintf("0%2.0f", int(magnetic_hdg))); - } else { - me["ILS_left"].setText(sprintf("%3.0f", int(magnetic_hdg))); - } - me["ILS_HDG_L"].show(); - me["ILS_HDG_R"].hide(); - me["CRS_pointer"].hide(); - } else if (magnetic_hdg_dif > 23.62 and magnetic_hdg_dif <= 180) { - if (int(magnetic_hdg) < 10) { - me["ILS_right"].setText(sprintf("00%1.0f", int(magnetic_hdg))); - } else if (int(magnetic_hdg) < 100) { - me["ILS_right"].setText(sprintf("0%2.0f", int(magnetic_hdg))); - } else { - me["ILS_right"].setText(sprintf("%3.0f", int(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(); - } - - # AI HDG - me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, horizon_pitch.getValue() * 11.825); - me.AI_horizon_hdg_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); - me["AI_heading"].update(); - }, # Get Angle of Attack from ADR1 or, depending on Switching panel, ADR3 getAOAForPFD1: func() { @@ -1235,9 +1208,6 @@ var canvas_PFD_1 = { me["ilsError"].hide(); } - me.updateCommon(); - }, - updateFast: func() { # Airspeed # ind_spd = ind_spd_kt.getValue(); # Subtract 30, since the scale starts at 30, but don"t allow less than 0, or more than 420 situations @@ -1719,7 +1689,7 @@ var canvas_PFD_1 = { me["ALT_tens"].setTranslation(0, altTens * 1.392); ap_alt_cur = ap_alt.getValue(); - alt_diff_cur = alt_diff.getValue(); + alt_diff_cur = dmc.DMController.DMCs[0].outputs[7].getValue(); if (alt_diff_cur >= -565 and alt_diff_cur <= 565) { me["ALT_target"].setTranslation(0, (alt_diff_cur / 100) * -48.66856); me["ALT_target_digit"].setText(sprintf("%03d", math.round(ap_alt_cur / 100))); @@ -1830,7 +1800,7 @@ var canvas_PFD_1 = { me["ALT_box"].hide(); } - me.updateCommonFast(); + me.updateCommon(); }, }; @@ -2010,9 +1980,6 @@ var canvas_PFD_2 = { me["ilsError"].hide(); } - me.updateCommon(); - }, - updateFast: func() { # Airspeed # ind_spd = ind_spd_kt.getValue(); # Subtract 30, since the scale starts at 30, but don"t allow less than 0, or more than 420 situations @@ -2494,7 +2461,7 @@ var canvas_PFD_2 = { me["ALT_tens"].setTranslation(0, altTens * 1.392); ap_alt_cur = ap_alt.getValue(); - alt_diff_cur = alt_diff.getValue(); + alt_diff_cur = dmc.DMController.DMCs[1].outputs[7].getValue(); if (alt_diff_cur >= -565 and alt_diff_cur <= 565) { me["ALT_target"].setTranslation(0, (alt_diff_cur / 100) * -48.66856); me["ALT_target_digit"].setText(sprintf("%03d", math.round(ap_alt_cur / 100))); @@ -2605,7 +2572,7 @@ var canvas_PFD_2 = { me["ALT_box"].hide(); } - me.updateCommonFast(); + me.updateCommon(); }, }; @@ -2783,7 +2750,6 @@ setlistener("sim/signals/fdm-initialized", func { PFD_2_mismatch = canvas_PFD_2_mismatch.new(group_pfd2_mismatch, "Aircraft/A320-family/Models/Instruments/Common/res/mismatch.svg"); PFD_update.start(); - PFD_update_fast.start(); if (pfdrate.getValue() == 1) { rateApply(); @@ -2791,15 +2757,10 @@ setlistener("sim/signals/fdm-initialized", func { }); var rateApply = func { - PFD_update.restart(0.15 * pfdrate.getValue()); - PFD_update_fast.restart(0.05 * pfdrate.getValue()); + PFD_update.restart(0.05 * pfdrate.getValue()); } -var PFD_update = maketimer(0.15, func { - canvas_PFD_base.updateSlow(); -}); - -var PFD_update_fast = maketimer(0.05, func { +var PFD_update = maketimer(0.05, func { canvas_PFD_base.update(); }); diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index cdc8609d..ae43662d 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -1,5 +1,4 @@ var flapsPos = nil; -var elapsedtime = nil; var LBS2KGS = 0.4535924; var slatLockGoing = 0; var slatLockFlash = 0; @@ -508,7 +507,7 @@ var canvas_upperECAM = { me.updatePower(); if (me.test.getVisible() == 1) { - me.updateTest(); + me.updateTest(notification); } if (me.group.getVisible() == 0) { @@ -905,8 +904,8 @@ var canvas_upperECAM = { } }, - updateTest: func() { - if (du3_test_time.getValue() + 1 >= pts.Sim.Time.elapsedSec.getValue()) { + updateTest: func(notification) { + if (du3_test_time.getValue() + 1 >= notification.elapsedTime) { me["Test_white"].show(); me["Test_text"].hide(); } else { diff --git a/Nasal/Displays/DMC.nas b/Nasal/Displays/DMC.nas index 6b555bf9..efe94e5b 100644 --- a/Nasal/Displays/DMC.nas +++ b/Nasal/Displays/DMC.nas @@ -13,11 +13,12 @@ var DMC = { d.airspeeds = [props.globals.getNode("/systems/navigation/adr/output/cas-1", 1), props.globals.getNode("/systems/navigation/adr/output/cas-2", 1), props.globals.getNode("/systems/navigation/adr/output/cas-3", 1)]; d.altitudes = [props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-1-capt", 1), props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-2-capt", 1), props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-3-capt", 1)]; d.machs = [props.globals.getNode("/systems/navigation/adr/output/mach-1", 1), props.globals.getNode("/systems/navigation/adr/output/mach-2", 1), props.globals.getNode("/systems/navigation/adr/output/mach-3", 1)]; - d.altitudesPfd = [props.globals.getNode("instrumentation/altimeter[0]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[1]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[2]/indicated-altitude-ft-pfd", 1)]; + d.altitudesPfd = [props.globals.getNode("/instrumentation/altimeter[0]/indicated-altitude-ft-pfd", 1), props.globals.getNode("/instrumentation/altimeter[1]/indicated-altitude-ft-pfd", 1), props.globals.getNode("/instrumentation/altimeter[2]/indicated-altitude-ft-pfd", 1)]; d.sats = [props.globals.getNode("/systems/navigation/adr/output/sat-1", 1), props.globals.getNode("/systems/navigation/adr/output/sat-2", 1), props.globals.getNode("/systems/navigation/adr/output/sat-3", 1)]; d.tats = [props.globals.getNode("/systems/navigation/adr/output/tat-1", 1), props.globals.getNode("/systems/navigation/adr/output/tat-2", 1), props.globals.getNode("/systems/navigation/adr/output/tat-3", 1)]; - d.trends = [props.globals.getNode("instrumentation/pfd/speed-lookahead-1", 1), props.globals.getNode("instrumentation/pfd/speed-lookahead-2", 1), props.globals.getNode("instrumentation/pfd/speed-lookahead-3", 1)]; - d.outputs = [nil, nil, nil, nil, nil, nil, nil]; # airspeed, altitude, mach, pfd altitude, sat, tat, speed trend + d.trends = [props.globals.getNode("/instrumentation/pfd/speed-lookahead-1", 1), props.globals.getNode("/instrumentation/pfd/speed-lookahead-2", 1), props.globals.getNode("/instrumentation/pfd/speed-lookahead-3", 1)]; + d.altitudeDiffs = [props.globals.getNode("//instrumentation/pfd/alt-diff[0]", 1), props.globals.getNode("//instrumentation/pfd/alt-diff[1]", 1), props.globals.getNode("//instrumentation/pfd/alt-diff[2]", 1)]; + d.outputs = [nil, nil, nil, nil, nil, nil, nil, nil]; # airspeed, altitude, mach, pfd altitude, sat, tat, speed trend, altitudeDiffs return d; }, changeActiveADIRS: func(newADIRS) { @@ -32,6 +33,7 @@ var DMC = { me.outputs[4] = me.sats[ADIRS]; me.outputs[5] = me.tats[ADIRS]; me.outputs[6] = me.trends[ADIRS]; + me.outputs[7] = me.altitudeDiffs[ADIRS]; }, setOutputsNil: func() { me.outputs[0] = nil; @@ -41,6 +43,7 @@ var DMC = { me.outputs[4] = nil; me.outputs[5] = nil; me.outputs[6] = nil; + me.outputs[7] = nil; }, update: func() { if (systems.ADIRS.ADIRunits[me.activeADIRS].operative and systems.ADIRS.ADIRunits[me.activeADIRS].outputOn) { @@ -71,8 +74,8 @@ var DMController = { # update DMC2 to correct properties for first officer PFD me.DMCs[1].altitudes = [props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-1-fo", 1), props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-2-fo", 1), props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-3-fo", 1)]; - me.DMCs[1].altitudesPfd = [props.globals.getNode("instrumentation/altimeter[3]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[4]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[5]/indicated-altitude-ft-pfd", 1)]; - + me.DMCs[1].altitudesPfd = [props.globals.getNode("/instrumentation/altimeter[3]/indicated-altitude-ft-pfd", 1), props.globals.getNode("/instrumentation/altimeter[4]/indicated-altitude-ft-pfd", 1), props.globals.getNode("/instrumentation/altimeter[5]/indicated-altitude-ft-pfd", 1)]; + me.DMCs[1].altitudeDiffs = [props.globals.getNode("//instrumentation/pfd/alt-diff[3]", 1), props.globals.getNode("//instrumentation/pfd/alt-diff[4]", 1), props.globals.getNode("//instrumentation/pfd/alt-diff[5]", 1)]; me._init = 1; } }, diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index fc21405f..8a2a6a78 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -58,7 +58,7 @@ var FCU = { var FCUController = { FCU1: nil, FCU2: nil, - activeFMGC: props.globals.getNode("FMGC/active-fmgc-channel"), + activeFMGC: props.globals.getNode("/FMGC/active-fmgc-channel"), FCUworking: 0, _init: 0, init: func() { @@ -81,9 +81,8 @@ var FCUController = { FCUworkingNode.setValue(0); } - notification = nil; foreach (var update_item; me.update_items) { - update_item.update(notification); + update_item.update(nil); } }, update_items: [ @@ -99,8 +98,8 @@ var FCUController = { me.FCU2.restore(); }, AP1: func() { - if (me.FCUworking and fbw.FBW.activeLaw.getValue() == 0) { - if (!ap1.getBoolValue()) { + if (me.FCUworking) { + if (!ap1.getBoolValue() and fbw.FBW.apOff == 0) { ap1Input.setValue(1); ecam.apWarnNode.setValue(0); pts.Controls.Flight.rudderTrim.setValue(0); @@ -110,9 +109,10 @@ var FCUController = { } }, AP2: func() { - if (me.FCUworking and fbw.FBW.activeLaw.getValue() == 0) { - if (!ap2.getBoolValue()) { + if (me.FCUworking) { + if (!ap2.getBoolValue() and fbw.FBW.apOff == 0) { ap2Input.setValue(1); + ecam.apWarnNode.setValue(0); pts.Controls.Flight.rudderTrim.setValue(0); } else { apOff("hard", 2); @@ -120,8 +120,8 @@ var FCUController = { } }, ATHR: func() { - if (me.FCUworking and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.activeLaw.getValue() == 0) { - if (!athr.getBoolValue()) { + if (me.FCUworking) { + if (!athr.getBoolValue() and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0) { athrInput.setValue(1); } else { athrOff("hard"); diff --git a/Nasal/FMGC/FMGC-b.nas b/Nasal/FMGC/FMGC-b.nas index 32ab417d..b5f19f1b 100644 --- a/Nasal/FMGC/FMGC-b.nas +++ b/Nasal/FMGC/FMGC-b.nas @@ -441,7 +441,7 @@ var ITAF = { }, ap1Master: func(s) { if (s == 1) { - if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and Misc.fbwLaw.getValue() == 0 and Position.gearAglFt.getValue() >= 100) { + if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100) { me.revertBasicMode(); Output.ap1.setBoolValue(1); Output.latTemp = Output.lat.getValue(); @@ -462,7 +462,7 @@ var ITAF = { }, ap2Master: func(s) { if (s == 1) { - if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and Misc.fbwLaw.getValue() == 0 and Position.gearAglFt.getValue() >= 100) { + if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100) { me.revertBasicMode(); Output.ap2.setBoolValue(1); Output.latTemp = Output.lat.getValue(); @@ -492,7 +492,7 @@ var ITAF = { }, athrMaster: func(s) { if (s == 1) { - if (systems.ELEC.Bus.acEss.getValue() >= 110) { + if (systems.ELEC.Bus.acEss.getValue() >= 110 and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0) { Output.athr.setBoolValue(1); Custom.ThrLock.setValue(0); Custom.Sound.enableAthrOff = 1; diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 6c2868ce..a106e8b1 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -62,6 +62,7 @@ var altsel = 0; var crzFl = 0; var windHdg = 0; var windSpeed = 0; +var windsDidChange = 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); @@ -168,6 +169,8 @@ var FMGCInternal = { altAirportSet: 0, altSelected: 0, arrApt: "", + coRoute: "", + coRouteSet: 0, costIndex: 0, costIndexSet: 0, crzFt: 10000, @@ -308,6 +311,7 @@ var updateArptLatLon = func { updateRouteManagerAlt = func() { setprop("autopilot/route-manager/cruise/altitude-ft", FMGCInternal.crzFt); + # TODO - update FMGCInternal.phase when DES to re-enter in CLIMB/CRUIZE }; ######## @@ -644,9 +648,15 @@ var masterFMGC = maketimer(0.2, func { } } - if (FMGCInternal.phase == 4 and getprop("/FMGC/internal/decel")) { - FMGCInternal.phase = 5; - } + if (FMGCInternal.phase == 4) { + if (getprop("/FMGC/internal/decel")) { + FMGCInternal.phase = 5; + } + else if (altSel == (FMGCInternal.crzFl * 100)) { # back to CRZ state + FMGCInternal.phase = 3; + systems.PNEU.pressMode.setValue("CR"); + } + } if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and flightPlanController.arrivalDist <= 15 and (modelat == "NAV" or modelat == "LOC" or modelat == "LOC*") and pts.Position.gearAglFt.getValue() < 9500) { #todo decel pseudo waypoint setprop("/FMGC/internal/decel", 1); @@ -683,7 +693,7 @@ var masterFMGC = maketimer(0.2, func { windHdg = pts.Environment.windFromHdg.getValue(); windSpeed = pts.Environment.windSpeedKt.getValue(); if (FMGCInternal.phase == 3 or FMGCInternal.phase == 4 or FMGCInternal.phase == 6) { - var windsDidChange = 0; + windsDidChange = 0; if (FMGCInternal.crzFt > 5000 and alt > 4980 and alt < 5020) { if (sprintf("%03d", windHdg) != fmgc.windController.fl50_wind[0] or sprintf("%03d", windSpeed) != fmgc.windController.fl50_wind[1]) { fmgc.windController.fl50_wind[0] = sprintf("%03d", windHdg); @@ -969,6 +979,7 @@ var reset_FMGC = func { mcdu.MCDU_reset(0); mcdu.MCDU_reset(1); mcdu.ReceivedMessagesDatabase.clearDatabase(); + mcdu.FlightLogDatabase.reset(); # track reset events without loosing recorded data Input.fd1.setValue(fd1); Input.fd2.setValue(fd2); @@ -1020,9 +1031,7 @@ var ManagedSPD = maketimer(0.25, func { if (mach > mng_alt_mach and (FMGCInternal.phase == 2 or FMGCInternal.phase == 3)) { FMGCInternal.machSwitchover = 1; - } - - if (ias > mng_alt_spd and (FMGCInternal.phase == 4 or FMGCInternal.phase == 5)) { + } elsif (ias > mng_alt_spd and (FMGCInternal.phase == 4 or FMGCInternal.phase == 5)) { FMGCInternal.machSwitchover = 0; } diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 47b2b640..087c1f44 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -1,5 +1,6 @@ # A3XX Simbrief Parser # Copyright (c) 2020 Jonathan Redpath (legoboyvdlp) +# enhanced 12/2020 - parse TOD & TOC psedo waypoints, set computer speeds on fix wps, fake coRoute name var LBS2KGS = 0.4535924; @@ -13,7 +14,7 @@ var SimbriefParser = { me.inhibit = 1; var stamp = systime(); http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml") - .fail(func me.failure(i)) + .fail(func { me.failure(i) }) .done(func { var errs = []; call(me.read, [(getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml"),i], SimbriefParser, {}, errs); @@ -48,6 +49,33 @@ var SimbriefParser = { me.failure(i); } }, + validateFile: func(xml) { + var data = io.readxml(xml); + if (data != nil) { + return (data.getChild("OFP") != nil); + } + return false; + }, + readLegs: func(xml) { # lite OFP parser only for legs = wapoinst + airways + var legs = []; + var data = io.readxml(xml); + if (data != nil) { + var ofp = data.getChild("OFP"); + if (ofp != nil) { + var ofpNavlog = ofp.getNode("navlog"); + var ofpFixes = ofpNavlog.getChildren("fix"); + var ident = ""; + foreach (var ofpFix; ofpFixes) { + if (ofpFix.getNode("is_sid_star").getBoolValue()) continue; + ident = ofpFix.getNode("ident").getValue(); + if (ident == "TOC" or ident == "TOD") continue; + append(legs, [ ofpFix.getNode("ident").getValue() , ofpFix.getNode("via_airway").getValue() ] ); + } + return legs; + } + } + return nil; + }, tryFindByCoord: func(coords, id, type) { var result = nil; if (type == "nav") { @@ -59,9 +87,9 @@ var SimbriefParser = { } if (size(result) == 0) { return nil; } - foreach (var test; result) { - if (math.abs(test.lat - coords.lat()) < 0.01666666666 and math.abs(test.lon - coords.lon()) < 0.01666666666) { - return test; + forindex (var test; result) { + if (math.abs(result[test].lat - coords.lat()) < 0.01666666666 and math.abs(result[test].lon - coords.lon()) < 0.01666666666) { + return result[test]; } } return nil; @@ -157,12 +185,18 @@ var SimbriefParser = { if (ident == "TOC") { _foundTOC = 1; - continue; + #setprop("/autopilot/route-manager/vnav/tc/latitude-deg",ofpFix.getNode("pos_lat").getValue()); + #setprop("/autopilot/route-manager/vnav/tc/longitude-deg",ofpFix.getNode("pos_long").getValue()); + #ident = "(T/C)"; + continue; # restore skip TOC/TOD } if (ident == "TOD") { _foundTOD = 1; - continue; + #setprop("/autopilot/route-manager/vnav/td/latitude-deg",ofpFix.getNode("pos_lat").getValue()); + #setprop("/autopilot/route-manager/vnav/td/longitude-deg",ofpFix.getNode("pos_long").getValue()); + #ident = "(T/D)"; + continue; # restore skip TOC/TOD } coords = geo.Coord.new(); @@ -170,11 +204,13 @@ var SimbriefParser = { ofpFix.getNode("pos_lat").getValue(), ofpFix.getNode("pos_long").getValue()); - wp = me.tryFindByCoord(coords,ident,"fix"); - wp = me.tryFindByCoord(coords,ident,"nav"); - if (wp == nil) { + #wp = me.tryFindByCoord(coords,ident,"fix"); + #if (wp == nil) { + # wp = me.tryFindByCoord(coords,ident,"nav"); + #} + #if (wp == nil) { wp = createWP(coords, ident); - } + #} append(wps, wp); } @@ -187,6 +223,34 @@ var SimbriefParser = { fmgc.flightPlanController.flightplans[3].star = _star; } fmgc.flightPlanController.destroyTemporaryFlightPlan(3, 1); + + #var idx = 1; + #var plan = fmgc.flightPlanController.flightplans[2]; + #var altitude = ""; + #var speed = ""; + #var wpname = ""; + + #foreach (var ofpFix; ofpFixes) { + # ident = ofpFix.getNode("ident").getValue(); + + # if (ident == "TOC") wpname = "(T/C)"; + # else if (ident == "TOD") wpname = "(T/D)"; + # else wpname = ident; + + # wp = plan.getWP(idx); # get leg + # if (wp != nil) { + # if (wp.wp_name == wpname) { + # altitude = ofpFix.getNode("altitude_feet").getValue(); + # speed = ofpFix.getNode("ind_airspeed").getValue(); + + # if (speed>0) wp.setSpeed(speed, "computed"); + # if (altitude>0) wp.setAltitude(math.round(altitude, 10), "computed"); +# +# idx = idx + 1; +# } +# } +# } + fmgc.windController.updatePlans(); fmgc.updateRouteManagerAlt(); @@ -197,6 +261,8 @@ var SimbriefParser = { if (me.buildFlightplan() == nil) { return nil; } + #fmgc.FMGCInternal.coRoute = "SB" ~ me.OFP.getNode("origin/iata_code").getValue() ~ me.OFP.getNode("destination/iata_code").getValue() ~ "00"; + #fmgc.FMGCInternal.coRouteSet = 1; fmgc.FMGCInternal.flightNum = (me.OFP.getNode("general/icao_airline").getValue() or "") ~ (me.OFP.getNode("general/flight_number").getValue() or ""); fmgc.FMGCInternal.flightNumSet = 1; fmgc.FMGCInternal.costIndex = me.OFP.getNode("general/costindex").getValue(); diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index 8ac87b43..b3274ff5 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -69,6 +69,7 @@ var scratchpadController = { sp.scratchpadColour = "wht"; sp.showTypeIMsg = 0; sp.showTypeIIMsg = 0; + sp.clrmode = 0; # 1 = CLR mode sp.mcdu = mcdu; return sp; }, @@ -88,6 +89,11 @@ var scratchpadController = { me.clearTypeI(); } + if (me.clrmode == 1) { # prevent add chars in CLR mode + me.clear(); + } + else if (character == "CLR") me.clrmode = 1; + me.scratchpad = me.scratchpad ~ character; me.scratchpadColour = "wht"; me.update(); @@ -140,6 +146,7 @@ var scratchpadController = { }, empty: func() { me.scratchpad = ""; + me.clrmode = 0; me.update(); }, clear: func() { @@ -173,12 +180,16 @@ var MessageController = { TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),TypeIMessage.new("RWY/LS MISMATCH"), TypeIMessage.new("VHF3 VOICE MSG NOT GEN"),TypeIMessage.new("NO COMM MSG NOT GEN"),TypeIMessage.new("WX UPLINK"), TypeIMessage.new("SIMBRIEF DOWNLOAD FAILED"),TypeIMessage.new("MISSING USERNAME"),TypeIMessage.new("AOC ACT F-PLN UPLINK"), - TypeIMessage.new("NO ANSWER TO REQUEST"),TypeIMessage.new("NO D-ATIS AVAILABLE"),TypeIMessage.new("BAD SERVER RESPONSE") + TypeIMessage.new("NO ANSWER TO REQUEST"),TypeIMessage.new("NO D-ATIS AVAILABLE"),TypeIMessage.new("NO METAR AVAILABLE"),TypeIMessage.new("BAD SERVER RESPONSE"), + TypeIMessage.new("WIND DATA UPLINK"),TypeIMessage.new("CHECK ALT WIND"),TypeIMessage.new("INVALID WIND UPLINK"),TypeIMessage.new("WIND UPLINK EXISTS"), #p.533 + TypeIMessage.new("FM DATALINK UNAVAIL"),TypeIMessage.new("NOT XMITTED TO ACARS"), #p.559 + TypeIMessage.new("PRINTER NOT AVAILABLE"), ]), typeIIMessages: std.Vector.new([ TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"), TypeIIMessage.new("STEP NOW"),TypeIIMessage.new("TIME TO EXIT", "amb", 0),TypeIIMessage.new("V1/VR/V2 DISAGREE", "amb", 0), TypeIIMessage.new("TO SPEED TOO LOW", "amb", 0), + TypeIIMessage.new("CHECK DEST DATA", "amb", 0), #p.533 ]), # to speed to low - new on a320, margin against vmcg / vs1g diff --git a/Nasal/Libraries/buttons.nas b/Nasal/Libraries/buttons.nas index 5c6ec78e..289abfb2 100644 --- a/Nasal/Libraries/buttons.nas +++ b/Nasal/Libraries/buttons.nas @@ -3,8 +3,6 @@ # Copyright (c) 2020 Josh Davidson (Octal450) -var wow = nil; -var wowr = nil; var OnLt = props.globals.getNode("/controls/switches/emerCallLtO"); var CallLt = props.globals.getNode("/controls/switches/emerCallLtC"); var EmerCall = props.globals.getNode("/controls/switches/emerCall"); @@ -13,7 +11,7 @@ var MechCall = props.globals.getNode("/controls/switches/mechCall"); var cvr_tone = props.globals.getNode("/controls/CVR/tone"); # Resets buttons to the default values -var variousReset = func { +var variousReset = func() { setprop("/modes/cpt-du-xfr", 0); setprop("/modes/fo-du-xfr", 0); setprop("/controls/fadec/n1mode1", 0); @@ -64,72 +62,89 @@ var variousReset = func { setprop("/modes/fcu/hdg-time", -45); setprop("/controls/navigation/switching/att-hdg", 0); setprop("/controls/navigation/switching/air-data", 0); - setprop("/controls/switches/no-smoking-sign", 1); + setprop("/controls/switches/no-smoking-sign", 0.5); setprop("/controls/switches/seatbelt-sign", 1); } var BUTTONS = { + storeEmerCall: 0, update: func() { - if (EmerCall.getValue()) { - EmerCallOnLight(); - EmerCallLight(); + me.storeEmerCall = EmerCall.getValue(); + if (me.storeEmerCall) { + EmerCallOnLight(me.storeEmerCall); + EmerCallLight(me.storeEmerCall); } }, }; var _OnLt = nil; -var _EmerCall = nil; - -var EmerCallOnLight = func() { +var EmerCallOnLight = func(emerCallSts) { _OnLt = OnLt.getValue(); - _EmerCall = EmerCall.getValue(); - if ((_OnLt and _EmerCall) or !_EmerCall) { + if ((_OnLt and emerCallSts) or !emerCallSts) { OnLt.setValue(0); - } else if (!_OnLt and _EmerCall) { + } else if (!_OnLt and emerCallSts) { OnLt.setValue(1); } } var _CallLt = nil; -var _EmerCall2 = nil; - -var EmerCallLight = func() { +var EmerCallLight = func(emerCallSts) { _CallLt = CallLt.getValue(); - _EmerCall2 = EmerCall.getValue(); - if ((_CallLt and _EmerCall2) or !_EmerCall2) { + _EmerCall2 = emerCallSts; + if ((_CallLt and emerCallSts) or !emerCallSts) { CallLt.setValue(0); - } else if (!_CallLt and _EmerCall2) { + } else if (!_CallLt and emerCallSts) { CallLt.setValue(1); } } -var EmerCallFunc = func { - EmerCall.setValue(1); - settimer(func() { - EmerCall.setValue(0); - }, 10); -} - -var CabinCallFunc = func { - CabinCall.setValue(1); - settimer(func() { - CabinCall.setValue(0); - }, 15); -} - -var MechCallFunc = func { - MechCall.setValue(1); - settimer(func() { - MechCall.setValue(0); - }, 15); -} - -var CVR_test = func { - if (pts.Controls.Gear.parkingBrake.getValue()) { - cvr_tone.setValue(1); +var _EmerCallRunning = 0; +var EmerCallFunc = func() { + if (!_EmerCallRunning) { + _EmerCallRunning = 1; + EmerCall.setValue(1); settimer(func() { - cvr_tone.setValue(0); - }, 15); + EmerCall.setValue(0); + _EmerCallRunning = 0; + }, 7); + } +} + +var _CabinCallRunning = 0; +var CabinCallFunc = func() { + if (!_CabinCallRunning) { + _CabinCallRunning = 1; + CabinCall.setValue(1); + settimer(func() { + CabinCall.setValue(0); + _CabinCallRunning = 0; + }, 2); + } +} + +var _MechCallRunning = 0; +var MechCallFunc = func() { + if (!_MechCallRunning) { + _MechCallRunning = 1; + MechCall.setValue(1); + settimer(func() { + MechCall.setValue(0); + _MechCallRunning = 0; + }, 6); + } +} + +var _CVRtestRunning = 0; +var CVR_test = func() { + if (pts.Controls.Gear.parkingBrake.getValue()) { + if (!_CVRtestRunning) { + _CVRtestRunning = 1; + cvr_tone.setValue(1); + settimer(func() { + _CVRtestRunning = 0; + cvr_tone.setValue(0); + }, 15); + } } } @@ -140,7 +155,7 @@ setlistener("/controls/apu/master", func() { # poor mans set-reset latch } }, 0, 0); -var toggleSTD = func { +var toggleSTD = func() { if (pts.Instrumentation.Altimeter.std.getBoolValue()) { pts.Instrumentation.Altimeter.settingInhg.setValue(pts.Instrumentation.Altimeter.oldQnh.getValue()); pts.Instrumentation.Altimeter.std.setBoolValue(0); @@ -149,10 +164,4 @@ var toggleSTD = func { pts.Instrumentation.Altimeter.settingInhg.setValue(29.92); pts.Instrumentation.Altimeter.std.setBoolValue(1); } -} - -var pushbuttonSound = props.globals.getNode("/sim/sounde/pushbutton"); -var pushbutton = func { - pushbuttonSound.setValue(1); - settimer(func {pushbuttonSound.setValue(0);},0.20); } \ No newline at end of file diff --git a/Nasal/Libraries/controls-override.nas b/Nasal/Libraries/controls-override.nas new file mode 100644 index 00000000..89f2b05f --- /dev/null +++ b/Nasal/Libraries/controls-override.nas @@ -0,0 +1,110 @@ +# A320 Main Libraries +# Joshua Davidson (Octal450) + +# Copyright (c) 2020 Josh Davidson (Octal450) + +############ +# Controls # +############ + +controls.stepSpoilers = func(step) { + pts.Controls.Flight.speedbrakeArm.setValue(0); + if (step == 1) { + deploySpeedbrake(); + } else if (step == -1) { + retractSpeedbrake(); + } +} + +var deploySpeedbrake = func() { + if (pts.Gear.wow[1].getBoolValue() or pts.Gear.wow[2].getBoolValue()) { + if (pts.Controls.Flight.speedbrake.getValue() < 1.0) { + pts.Controls.Flight.speedbrake.setValue(1.0); + } + } else { + if (pts.Controls.Flight.speedbrake.getValue() < 0.5) { + pts.Controls.Flight.speedbrake.setValue(0.5); + } else if (pts.Controls.Flight.speedbrake.getValue() < 1.0) { + pts.Controls.Flight.speedbrake.setValue(1.0); + } + } +} + +var retractSpeedbrake = func() { + if (pts.Gear.wow[1].getBoolValue() or pts.Gear.wow[2].getBoolValue()) { + if (pts.Controls.Flight.speedbrake.getValue() > 0.0) { + pts.Controls.Flight.speedbrake.setValue(0.0); + } + } else { + if (pts.Controls.Flight.speedbrake.getValue() > 0.5) { + pts.Controls.Flight.speedbrake.setValue(0.5); + } else if (pts.Controls.Flight.speedbrake.getValue() > 0.0) { + pts.Controls.Flight.speedbrake.setValue(0.0); + } + } +} + +var delta = 0; +var output = 0; +var slewProp = func(prop, delta) { + delta *= pts.Sim.Time.deltaRealtimeSec.getValue(); + output = props.globals.getNode(prop).getValue() + delta; + props.globals.getNode(prop).setValue(output); + return output; +} + +controls.flapsDown = func(step) { + pts.Controls.Flight.flapsTemp = pts.Controls.Flight.flaps.getValue(); + if (step == 1) { + if (pts.Controls.Flight.flapsTemp < 0.2) { + pts.Controls.Flight.flaps.setValue(0.2); + } else if (pts.Controls.Flight.flapsTemp < 0.4) { + pts.Controls.Flight.flaps.setValue(0.4); + } else if (pts.Controls.Flight.flapsTemp < 0.6) { + pts.Controls.Flight.flaps.setValue(0.6); + } else if (pts.Controls.Flight.flapsTemp < 0.8) { + pts.Controls.Flight.flaps.setValue(0.8); + } + } else if (step == -1) { + if (pts.Controls.Flight.flapsTemp > 0.6) { + pts.Controls.Flight.flaps.setValue(0.6); + } else if (pts.Controls.Flight.flapsTemp > 0.4) { + pts.Controls.Flight.flaps.setValue(0.4); + } else if (pts.Controls.Flight.flapsTemp > 0.2) { + pts.Controls.Flight.flaps.setValue(0.2); + } else if (pts.Controls.Flight.flapsTemp > 0) { + pts.Controls.Flight.flaps.setValue(0); + } + } +} + +controls.elevatorTrim = func(d) { + if (systems.HYD.Psi.green.getValue() >= 1500 or systems.HYD.Psi.yellow.getValue() >= 1500) { + slewProp("/controls/flight/elevator-trim", d * 0.0185); # Rate in JSB normalized (0.25 / 13.5) + } else { + slewProp("/controls/flight/elevator-trim", d * 0.0092) # Handcranking? + } +} + +setlistener("/controls/flight/elevator-trim", func() { + if (pts.Controls.Flight.elevatorTrim.getValue() > 0.296296) { + pts.Controls.Flight.elevatorTrim.setValue(0.296296); + } +}, 0, 0); + +# For the cockpit rotation and anywhere else you want to use it +var cmdDegCalc = 0; +var slewPitchWheel = func(d) { + cmdDegCalc = math.round(pts.Fdm.JSBsim.Hydraulics.ElevatorTrim.cmdDeg.getValue(), 0.1); + if (d > 0) { # DN + if (cmdDegCalc < 4) { + cmdDegCalc = (cmdDegCalc + 0.1) / 13.5; # Add and normalize, NOT 4! 13.5 = 1 on either polarity + pts.Controls.Flight.elevatorTrim.setValue(cmdDegCalc); + } + } else { # UP + if (cmdDegCalc > -13.5) { + cmdDegCalc = (cmdDegCalc - 0.1) / 13.5; # Subtract and normalize + pts.Controls.Flight.elevatorTrim.setValue(cmdDegCalc); + } + } +} diff --git a/Nasal/Libraries/custom-views.nas b/Nasal/Libraries/custom-views.nas index 8443915d..0b90fcc6 100644 --- a/Nasal/Libraries/custom-views.nas +++ b/Nasal/Libraries/custom-views.nas @@ -8,7 +8,7 @@ var viewNumberRaw = 0; var shakeFlag = 0; var resetView = func() { viewNumberRaw = pts.Sim.CurrentView.viewNumberRaw.getValue(); - if (viewNumberRaw == 0 or (viewNumberRaw >= 100 and viewNumberRaw <= 110)) { + if (viewNumberRaw == 0 or (viewNumberRaw >= 100 and viewNumberRaw <= 109) or viewNumberRaw == 112) { if (pts.Sim.Rendering.Headshake.enabled.getBoolValue()) { shakeFlag = 1; pts.Sim.Rendering.Headshake.enabled.setBoolValue(0); diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index 2e93c670..c5b05971 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -7,6 +7,7 @@ print("------------------------------------------------"); print("Copyright (c) 2016-2020 Josh Davidson (Octal450)"); print("------------------------------------------------"); +# Disable specific menubar items setprop("/sim/menubar/default/menu[0]/item[0]/enabled", 0); setprop("/sim/menubar/default/menu[2]/item[0]/enabled", 0); setprop("/sim/menubar/default/menu[2]/item[2]/enabled", 0); @@ -28,9 +29,6 @@ var beacon = aircraft.light.new("/sim/model/lights/beacon", [0.1, 1], "/controls var strobe = aircraft.light.new("/sim/model/lights/strobe", [0.05, 0.06, 0.05, 1], "/controls/lighting/strobe"); var tail_strobe = aircraft.light.new("/sim/model/lights/tailstrobe", [0.1, 1], "/controls/lighting/strobe"); -var stateL = 0; -var stateR = 0; - ########### # Effects # ########### @@ -40,121 +38,6 @@ aircraft.rain.init(); aircraft.livery.init(getprop("/sim/model/livery-dir")); -########## -# Sounds # -########## - -setlistener("/sim/sounde/btn1", func { - if (!getprop("/sim/sounde/btn1")) { - return; - } - settimer(func { - props.globals.getNode("/sim/sounde/btn1").setBoolValue(0); - }, 0.05); -}); - -setlistener("/sim/sounde/oh-btn", func { - if (!getprop("/sim/sounde/oh-btn")) { - return; - } - settimer(func { - props.globals.getNode("/sim/sounde/oh-btn").setBoolValue(0); - }, 0.05); -}); - -setlistener("/sim/sounde/btn3", func { - if (!getprop("/sim/sounde/btn3")) { - return; - } - settimer(func { - props.globals.getNode("/sim/sounde/btn3").setBoolValue(0); - }, 0.05); -}); - -setlistener("/sim/sounde/knb1", func { - if (!getprop("/sim/sounde/knb1")) { - return; - } - settimer(func { - props.globals.getNode("/sim/sounde/knb1").setBoolValue(0); - }, 0.05); -}); - -setlistener("/sim/sounde/switch1", func { - if (!getprop("/sim/sounde/switch1")) { - return; - } - settimer(func { - props.globals.getNode("/sim/sounde/switch1").setBoolValue(0); - }, 0.05); -}); - -setlistener("/controls/lighting/seatbelt-sign", func { - props.globals.getNode("/sim/sounde/seatbelt-sign").setBoolValue(1); - settimer(func { - props.globals.getNode("/sim/sounde/seatbelt-sign").setBoolValue(0); - }, 2); -}, 0, 0); - -setlistener("/controls/lighting/no-smoking-sign", func { - props.globals.getNode("/sim/sounde/no-smoking-sign").setBoolValue(1); - settimer(func { - props.globals.getNode("/sim/sounde/no-smoking-sign").setBoolValue(0); - }, 1); -}, 0, 0); - -var flaps_click = props.globals.getNode("/sim/sounde/flaps-click"); - -setlistener("/controls/flight/flaps-input", func { - flaps_click.setBoolValue(1); -}, 0, 0); - -setlistener("/sim/sounde/flaps-click", func { - if (!flaps_click.getValue()) { - return; - } - settimer(func { - flaps_click.setBoolValue(0); - }, 0.4); -}); - -var spdbrk_click = props.globals.getNode("/sim/sounde/spdbrk-click"); - -setlistener("/controls/flight/speedbrake", func { - spdbrk_click.setBoolValue(1); -}, 0, 0); - -setlistener("/sim/sounde/spdbrk-click", func { - if (!spdbrk_click.getValue()) { - return; - } - settimer(func { - spdbrk_click.setBoolValue(0); - }, 0.4); -}); - -var relayBatt1 = func { - setprop("/sim/sounde/relay-batt-1",1); - settimer(func {setprop("/sim/sounde/relay-batt-1",0);},0.35); -} -var relayBatt2 = func { - setprop("/sim/sounde/relay-batt-2",1); - settimer(func {setprop("/sim/sounde/relay-batt-2",0);},0.35); -} -var relayApu = func { - setprop("/sim/sounde/relay-apu",1); - settimer(func {setprop("/sim/sounde/relay-apu",0);},0.35); -} -var relayExt = func { - setprop("/sim/sounde/relay-ext",1); - settimer(func {setprop("/sim/sounde/relay-ext",0);},0.35); -} - -setlistener("/systems/electrical/sources/bat-1/contact", relayBatt1, nil, 0); -setlistener("/systems/electrical/sources/bat-2/contact", relayBatt2, nil, 0); -setlistener("/systems/electrical/relay/apu-glc/contact-pos", relayApu, nil, 0); -setlistener("/systems/electrical/relay/ext-epc/contact-pos", relayExt, nil, 0); - ######### # Doors # ######### @@ -199,7 +82,11 @@ var triggerDoor = func(door, doorName, doorDesc) { ########### # Systems # ########### -var systemsInit = func { +var systemsInitialized = 0; +var A320Libraries = nil; + +var systemsInit = func() { + systemsInitialized = 0; fbw.FBW.init(); effects.light_manager.init(); systems.ELEC.init(); @@ -221,9 +108,7 @@ var systemsInit = func { mcdu.MCDU_init(1); mcdu_scratchpad.mcduMsgtimer1.start(); mcdu_scratchpad.mcduMsgtimer2.start(); - systemsLoop.start(); effects.icingInit(); - lightsLoop.start(); ecam.ECAM.init(); libraries.variousReset(); rmp.init(); @@ -235,13 +120,17 @@ var systemsInit = func { fmgc.flightPlanController.init(); fmgc.windController.init(); atsu.CompanyCall.init(); + systemsInitialized = 1; } -setlistener("/sim/signals/fdm-initialized", func { +setlistener("/sim/signals/fdm-initialized", func() { systemsInit(); fmgc.postInit(); fmgc.flightPlanTimer.start(); fmgc.WaypointDatabase.read(); + + A320Libraries = LibrariesRecipient.new("A320 Libraries"); + emesary.GlobalTransmitter.Register(A320Libraries); }); var collectorTankL = props.globals.getNode("/fdm/jsbsim/propulsion/tank[5]/contents-lbs"); @@ -249,10 +138,42 @@ var collectorTankR = props.globals.getNode("/fdm/jsbsim/propulsion/tank[6]/conte var groundAir = props.globals.getNode("/controls/pneumatics/switches/groundair"); var groundCart = props.globals.getNode("/controls/electrical/ground-cart"); var chocks = props.globals.getNode("/services/chocks/enable"); -var engRdy = props.globals.getNode("/engines/ready"); var groundspeed = 0; +var stateL = 0; +var stateR = 0; -var systemsLoop = maketimer(0.1, func { +var seatbeltLight = props.globals.getNode("/controls/lighting/seatbelt-sign"); +var noSmokingLight = props.globals.getNode("/controls/lighting/no-smoking-sign"); + +var update_items = [ + props.UpdateManager.FromHashValue("seatbelt", nil, func(val) { + if (val) { + if (!seatbeltLight.getBoolValue()) { + seatbeltLight.setValue(1); + } + } else { + if (seatbeltLight.getBoolValue()) { + seatbeltLight.setValue(0); + } + } + }), + props.UpdateManager.FromHashList(["noSmoking","gearPosNorm"], nil, func(val) { + if (val.noSmoking == 1) { + if (!noSmokingLight.getBoolValue()) { + noSmokingLight.setBoolValue(1); + } + } elsif (val.noSmoking == 0.5 and val.gearPosNorm != 0) { # todo: should be when uplocks not engaged + if (!noSmokingLight.getBoolValue()) { + noSmokingLight.setBoolValue(1); + } + } else { + noSmokingLight.setBoolValue(0); # sign stays on in cabin but sound still occurs + } + }), +]; + +var systemsLoop = func(notification) { + if (!systemsInitialized) { return; } systems.ELEC.loop(); systems.PNEU.loop(); systems.HYD.loop(); @@ -265,36 +186,19 @@ var systemsLoop = maketimer(0.1, func { dmc.DMController.loop(); atsu.ATSU.loop(); libraries.BUTTONS.update(); - systems.HFLoop(); + systems.HFLoop(notification); - groundspeed = pts.Velocities.groundspeed.getValue(); - if ((groundAir.getBoolValue() or groundCart.getBoolValue()) and ((groundspeed > 2) or (!pts.Controls.Gear.parkingBrake.getBoolValue() and !chocks.getBoolValue()))) { - groundAir.setBoolValue(0); - groundCart.setBoolValue(0); - } - - if (groundspeed > 15) { - shakeEffectA3XX.setBoolValue(1); - } else { - shakeEffectA3XX.setBoolValue(0); - } - - stateL = pts.Engines.Engine.state[0].getValue(); - stateR = pts.Engines.Engine.state[1].getValue(); - - if (stateL == 3 and stateR == 3) { - engRdy.setBoolValue(1); - } else { - engRdy.setBoolValue(0); - } - - if ((stateL == 2 or stateL == 3) and collectorTankL.getValue() < 1) { + if ((notification.engine1State == 2 or notification.engine1State == 3) and collectorTankL.getValue() < 1) { systems.cutoff_one(); } - if ((stateR == 2 or stateR == 3) and collectorTankR.getValue() < 1) { + if ((notification.engine2State == 2 or notification.engine2State == 3) and collectorTankR.getValue() < 1) { systems.cutoff_two(); } -}); + + foreach (var update_item; update_items) { + update_item.update(notification); + } +} # GPWS var GPWS = { @@ -340,7 +244,7 @@ setlistener("/sim/replay/replay-state", func() { }, 0, 0); # Steep ILS -setlistener("/options/steep-ils", func { +setlistener("/options/steep-ils", func() { if (getprop("/options/steep-ils") == 1) { setprop("/instrumentation/mk-viii/inputs/discretes/steep-approach", 1); } else { @@ -356,12 +260,12 @@ canvas.Text.setText = func(text) { me.set("text", typeof(text) == 'scalar' ? text : ""); }; canvas.Element._lastVisible = nil; -canvas.Element.show = func { +canvas.Element.show = func() { if (1 == me._lastVisible) {return me;} me._lastVisible = 1; me.setBool("visible", 1); }; -canvas.Element.hide = func { +canvas.Element.hide = func() { if (0 == me._lastVisible) {return me;} me._lastVisible = 0; me.setBool("visible", 0); @@ -372,147 +276,10 @@ canvas.Element.setVisible = func(vis) { me.setBool("visible", vis); }; -############ -# Controls # -############ - -controls.stepSpoilers = func(step) { - pts.Controls.Flight.speedbrakeArm.setValue(0); - if (step == 1) { - deploySpeedbrake(); - } else if (step == -1) { - retractSpeedbrake(); - } -} - -var deploySpeedbrake = func { - if (pts.Gear.wow[1].getBoolValue() or pts.Gear.wow[2].getBoolValue()) { - if (pts.Controls.Flight.speedbrake.getValue() < 1.0) { - pts.Controls.Flight.speedbrake.setValue(1.0); - } - } else { - if (pts.Controls.Flight.speedbrake.getValue() < 0.5) { - pts.Controls.Flight.speedbrake.setValue(0.5); - } else if (pts.Controls.Flight.speedbrake.getValue() < 1.0) { - pts.Controls.Flight.speedbrake.setValue(1.0); - } - } -} - -var retractSpeedbrake = func { - if (pts.Gear.wow[1].getBoolValue() or pts.Gear.wow[2].getBoolValue()) { - if (pts.Controls.Flight.speedbrake.getValue() > 0.0) { - pts.Controls.Flight.speedbrake.setValue(0.0); - } - } else { - if (pts.Controls.Flight.speedbrake.getValue() > 0.5) { - pts.Controls.Flight.speedbrake.setValue(0.5); - } else if (pts.Controls.Flight.speedbrake.getValue() > 0.0) { - pts.Controls.Flight.speedbrake.setValue(0.0); - } - } -} - -var delta = 0; -var output = 0; -var slewProp = func(prop, delta) { - delta *= pts.Sim.Time.deltaRealtimeSec.getValue(); - output = props.globals.getNode(prop).getValue() + delta; - props.globals.getNode(prop).setValue(output); - return output; -} - -controls.flapsDown = func(step) { - pts.Controls.Flight.flapsTemp = pts.Controls.Flight.flaps.getValue(); - if (step == 1) { - if (pts.Controls.Flight.flapsTemp < 0.2) { - pts.Controls.Flight.flaps.setValue(0.2); - } else if (pts.Controls.Flight.flapsTemp < 0.4) { - pts.Controls.Flight.flaps.setValue(0.4); - } else if (pts.Controls.Flight.flapsTemp < 0.6) { - pts.Controls.Flight.flaps.setValue(0.6); - } else if (pts.Controls.Flight.flapsTemp < 0.8) { - pts.Controls.Flight.flaps.setValue(0.8); - } - } else if (step == -1) { - if (pts.Controls.Flight.flapsTemp > 0.6) { - pts.Controls.Flight.flaps.setValue(0.6); - } else if (pts.Controls.Flight.flapsTemp > 0.4) { - pts.Controls.Flight.flaps.setValue(0.4); - } else if (pts.Controls.Flight.flapsTemp > 0.2) { - pts.Controls.Flight.flaps.setValue(0.2); - } else if (pts.Controls.Flight.flapsTemp > 0) { - pts.Controls.Flight.flaps.setValue(0); - } - } -} - -controls.elevatorTrim = func(d) { - if (systems.HYD.Psi.green.getValue() >= 1500) { - slewProp("/controls/flight/elevator-trim", d * 0.0185); # Rate in JSB normalized (0.125 / 13.5) - } else { - slewProp("/controls/flight/elevator-trim", d * 0.0092) # Rate in JSB normalized (0.125 / 13.5) - } -} - -setlistener("/controls/flight/elevator-trim", func { - if (pts.Controls.Flight.elevatorTrim.getValue() > 0.296296) { - pts.Controls.Flight.elevatorTrim.setValue(0.296296); - } -}, 0, 0); - -# For the cockpit rotation and anywhere else you want to use it -var cmdDegCalc = 0; -var slewPitchWheel = func(d) { - cmdDegCalc = math.round(pts.Fdm.JSBsim.Hydraulics.ElevatorTrim.cmdDeg.getValue(), 0.1); - if (d > 0) { # DN - if (cmdDegCalc < 4) { - cmdDegCalc = (cmdDegCalc + 0.1) / 13.5; # Add and normalize, NOT 4! 13.5 = 1 on either polarity - pts.Controls.Flight.elevatorTrim.setValue(cmdDegCalc); - } - } else { # UP - if (cmdDegCalc > -13.5) { - cmdDegCalc = (cmdDegCalc - 0.1) / 13.5; # Subtract and normalize - pts.Controls.Flight.elevatorTrim.setValue(cmdDegCalc); - } - } -} - ########## -# Lights # +# Misc # ########## -var lightsLoop = maketimer(0.2, func { - # signs - - if (getprop("/systems/pressurization/cabinalt-norm") > 11300) { - setprop("/controls/lighting/seatbelt-sign", 1); - setprop("/controls/lighting/no-smoking-sign", 1); - } else { - if (getprop("/controls/switches/seatbelt-sign") == 1) { - if (getprop("/controls/lighting/seatbelt-sign") == 0) { - setprop("/controls/lighting/seatbelt-sign", 1); - } - } elsif (getprop("/controls/switches/seatbelt-sign") == 0) { - if (getprop("/controls/lighting/seatbelt-sign") == 1) { - setprop("/controls/lighting/seatbelt-sign", 0); - } - } - - if (getprop("/controls/switches/no-smoking-sign") == 1) { - if (getprop("/controls/lighting/no-smoking-sign") == 0) { - setprop("/controls/lighting/no-smoking-sign", 1); - } - } elsif (getprop("/controls/switches/no-smoking-sign") == 0.5 and getprop("/gear/gear[0]/position-norm") != 0) { # todo: should be when uplocks not engaged - if (getprop("/controls/lighting/no-smoking-sign") == 0) { - setprop("/controls/lighting/no-smoking-sign", 1); - } - } else { - setprop("/controls/lighting/no-smoking-sign", 0); # sign stays on in cabin but sound still occurs - } - } -}); - var pilotComfortTwoPos = func(prop) { var item = getprop(prop); if (item < 0.5) { @@ -533,25 +300,24 @@ var pilotComfortOnePos = func(prop) { } } -var lTray = func { +var lTray = func() { pilotComfortTwoPos("/controls/tray/lefttrayext"); } -var rTray = func { +var rTray = func() { pilotComfortTwoPos("/controls/tray/righttrayext"); } -var l1Pedal = func { +var l1Pedal = func() { pilotComfortOnePos("/controls/footrest-cpt[0]"); } -var l2Pedal = func { +var l2Pedal = func() { pilotComfortOnePos("/controls/footrest-cpt[1]"); } -var r1Pedal = func { +var r1Pedal = func() { pilotComfortOnePos("/controls/footrest-fo[0]"); } -var r2Pedal = func { - var r2PedalCMD = getprop("/controls/footrest-fo[1]"); +var r2Pedal = func() { pilotComfortOnePos("/controls/footrest-fo[1]"); } @@ -566,7 +332,7 @@ if (pts.Controls.Flight.autoCoordination.getBoolValue()) { pts.Controls.Flight.aileronDrivesTiller.setBoolValue(0); } -setlistener("/controls/flight/auto-coordination", func { +setlistener("/controls/flight/auto-coordination", func() { pts.Controls.Flight.autoCoordination.setBoolValue(0); print("System: Auto Coordination has been turned off as it is not compatible with the fly-by-wire of this aircraft."); screen.log.write("Auto Coordination has been disabled as it is not compatible with the fly-by-wire of this aircraft", 1, 0, 0); @@ -584,4 +350,58 @@ var APPanel = { }, }; + +# Emesary +var LibrariesRecipient = +{ + new: func(_ident) + { + var NewLibrariesRecipient = emesary.Recipient.new(_ident); + NewLibrariesRecipient.Receive = func(notification) + { + if (notification.NotificationType == "FrameNotification") + { + if (math.mod(notifications.frameNotification.FrameCount,4) == 0) { + systemsLoop(notification); + } + return emesary.Transmitter.ReceiptStatus_OK; + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + return NewLibrariesRecipient; + }, +}; + +var input = { + # Libraries + "seatbelt": "/controls/switches/seatbelt-sign", + "noSmoking": "/controls/switches/no-smoking-sign", + "gearPosNorm": "/gear/gear[0]/position-norm", +}; + +foreach (var name; keys(input)) { + emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Libraries", name, input[name])); +} + +# TODO split EFIS altimeters +var newinhg = nil; +setlistener("/instrumentation/altimeter/setting-inhg", func() { + newinhg = getprop("/instrumentation/altimeter/setting-inhg"); + setprop("/instrumentation/altimeter[1]/setting-inhg", newinhg); + setprop("/instrumentation/altimeter[2]/setting-inhg", newinhg); + setprop("/instrumentation/altimeter[3]/setting-inhg", newinhg); + setprop("/instrumentation/altimeter[4]/setting-inhg", newinhg); + setprop("/instrumentation/altimeter[5]/setting-inhg", newinhg); +}, 0, 0); + +var newhpa = nil; +setlistener("/instrumentation/altimeter/setting-hpa", func() { + newhpa = getprop("/instrumentation/altimeter/setting-hpa"); + setprop("/instrumentation/altimeter[1]/setting-hpa", newhpa); + setprop("/instrumentation/altimeter[2]/setting-hpa", newhpa); + setprop("/instrumentation/altimeter[3]/setting-hpa", newhpa); + setprop("/instrumentation/altimeter[4]/setting-hpa", newhpa); + setprop("/instrumentation/altimeter[5]/setting-hpa", newhpa); +}, 0, 0); + setprop("/systems/acconfig/libraries-loaded", 1); diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 4ff7ff9e..deba6c97 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -4,6 +4,10 @@ # Anything that says Temp is set by another file to avoid multiple getValue calls # Usage Example: pts.Class.SubClass.node.getValue() +var Accelerations = { + pilotGDamped: props.globals.getNode("/accelerations/pilot-gdamped"), +}; + var Acconfig = { running: props.globals.getNode("/systems/acconfig/autoconfig-running"), }; @@ -248,6 +252,11 @@ var Sim = { }, }, Version: props.globals.getNode("/sim/version/flightgear"), + View: { + Config: { + defaultFieldOfViewDeg: props.globals.getNode("/sim/view/config/default-field-of-view-deg", 1), + }, + }, }; var Systems = { diff --git a/Nasal/Libraries/shake.nas b/Nasal/Libraries/shake.nas index d861590f..eb9e8091 100644 --- a/Nasal/Libraries/shake.nas +++ b/Nasal/Libraries/shake.nas @@ -5,16 +5,9 @@ var shakeEffectA3XX = props.globals.initNode("/systems/shake/effect", 0, "BOOL"); var shakeA3XX = props.globals.initNode("/systems/shake/shaking", 0, "DOUBLE"); var sf = 0; -var n_g_c = 0; -var n_g_l = 0; -var n_g_r = 0; var theShakeEffect = func { - n_g_c = pts.Gear.compression[0].getValue() or 0; - n_g_l = pts.Gear.compression[1].getValue() or 0; - n_g_r = pts.Gear.compression[2].getValue() or 0; - - if (shakeEffectA3XX.getBoolValue() and (n_g_c > 0 or n_g_l > 0 or n_g_r > 0)) { + if (shakeEffectA3XX.getBoolValue()) { sf = pts.Gear.rollspeed[0].getValue() / 94000; interpolate("/systems/shake/shaking", sf, 0.03); settimer(func { diff --git a/Nasal/Libraries/sounds.nas b/Nasal/Libraries/sounds.nas new file mode 100644 index 00000000..fabe002d --- /dev/null +++ b/Nasal/Libraries/sounds.nas @@ -0,0 +1,125 @@ +# A320 Main Libraries +# Joshua Davidson (Octal450) + +# Copyright (c) 2020 Josh Davidson (Octal450) + +########## +# Sounds # +########## + +setlistener("/sim/sounde/btn1", func { + if (!getprop("/sim/sounde/btn1")) { + return; + } + settimer(func { + props.globals.getNode("/sim/sounde/btn1").setBoolValue(0); + }, 0.05); +}); + +setlistener("/sim/sounde/oh-btn", func { + if (!getprop("/sim/sounde/oh-btn")) { + return; + } + settimer(func { + props.globals.getNode("/sim/sounde/oh-btn").setBoolValue(0); + }, 0.05); +}); + +setlistener("/sim/sounde/btn3", func { + if (!getprop("/sim/sounde/btn3")) { + return; + } + settimer(func { + props.globals.getNode("/sim/sounde/btn3").setBoolValue(0); + }, 0.05); +}); + +setlistener("/sim/sounde/knb1", func { + if (!getprop("/sim/sounde/knb1")) { + return; + } + settimer(func { + props.globals.getNode("/sim/sounde/knb1").setBoolValue(0); + }, 0.05); +}); + +setlistener("/sim/sounde/switch1", func { + if (!getprop("/sim/sounde/switch1")) { + return; + } + settimer(func { + props.globals.getNode("/sim/sounde/switch1").setBoolValue(0); + }, 0.05); +}); + +setlistener("/controls/lighting/seatbelt-sign", func { + props.globals.getNode("/sim/sounde/seatbelt-sign").setBoolValue(1); + settimer(func { + props.globals.getNode("/sim/sounde/seatbelt-sign").setBoolValue(0); + }, 2); +}, 0, 0); + +setlistener("/controls/lighting/no-smoking-sign", func { + props.globals.getNode("/sim/sounde/no-smoking-sign").setBoolValue(1); + settimer(func { + props.globals.getNode("/sim/sounde/no-smoking-sign").setBoolValue(0); + }, 1); +}, 0, 0); + +var flaps_click = props.globals.getNode("/sim/sounde/flaps-click"); + +setlistener("/controls/flight/flaps-input", func { + flaps_click.setBoolValue(1); +}, 0, 0); + +setlistener("/sim/sounde/flaps-click", func { + if (!flaps_click.getValue()) { + return; + } + settimer(func { + flaps_click.setBoolValue(0); + }, 0.4); +}); + +var spdbrk_click = props.globals.getNode("/sim/sounde/spdbrk-click"); + +setlistener("/controls/flight/speedbrake", func { + spdbrk_click.setBoolValue(1); +}, 0, 0); + +setlistener("/sim/sounde/spdbrk-click", func { + if (!spdbrk_click.getValue()) { + return; + } + settimer(func { + spdbrk_click.setBoolValue(0); + }, 0.4); +}); + +var relayBatt1 = func { + setprop("/sim/sounde/relay-batt-1",1); + settimer(func {setprop("/sim/sounde/relay-batt-1",0);},0.35); +} +var relayBatt2 = func { + setprop("/sim/sounde/relay-batt-2",1); + settimer(func {setprop("/sim/sounde/relay-batt-2",0);},0.35); +} +var relayApu = func { + setprop("/sim/sounde/relay-apu",1); + settimer(func {setprop("/sim/sounde/relay-apu",0);},0.35); +} +var relayExt = func { + setprop("/sim/sounde/relay-ext",1); + settimer(func {setprop("/sim/sounde/relay-ext",0);},0.35); +} + +setlistener("/systems/electrical/sources/bat-1/contact", relayBatt1, nil, 0); +setlistener("/systems/electrical/sources/bat-2/contact", relayBatt2, nil, 0); +setlistener("/systems/electrical/relay/apu-glc/contact-pos", relayApu, nil, 0); +setlistener("/systems/electrical/relay/ext-epc/contact-pos", relayExt, nil, 0); + +var pushbuttonSound = props.globals.getNode("/sim/sounde/pushbutton"); +var pushbutton = func() { + pushbuttonSound.setValue(1); + settimer(func {pushbuttonSound.setValue(0);},0.20); +} \ No newline at end of file diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index f086d6fd..f3cab9a5 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -68,9 +68,21 @@ var fplnItem = { me.spd = me.getSpd(); me.alt = me.getAlt(); me.dist = me.getDist(); - me._colour = "wht"; - if (me.spd[1] != "wht" or me.alt[1] != "wht") { - me._colour = "mag"; + if (me.colour != "yel") { # not temporary flightplan + me._colour = "wht"; + #if (me.spd[1] != "wht" or me.alt[1] != "wht") { + if (me.spd[1] == me.alt[1]) { + me._colour = me.spd[1]; + } + else if (me.spd[1] == "mag" or me.alt[1] == "mag") { + me._colour = "mag"; + } + else if (me.spd[1] == "grn" or me.alt[1] == "grn") { + me._colour = "grn"; + } + + } else { # temporary flightplan + me._colour = "yel"; } return [me.spd[0] ~ "/" ~ me.alt[0], " " ~ me.dist ~ "NM ", me._colour]; } else { @@ -95,23 +107,25 @@ var fplnItem = { }, getSpd: func() { if (me.index == 0 and left(me.wp.wp_name, 4) == fmgc.FMGCInternal.depApt and fmgc.FMGCInternal.v1set) { - return [sprintf("%3.0f", math.round(fmgc.FMGCInternal.v1)), "mag"]; - } elsif (me.wp.speed_cstr != nil and me.wp.speed_cstr != 0) { - return [sprintf("%3.0f", me.wp.speed_cstr), "mag"]; + return [sprintf("%3.0f", math.round(fmgc.FMGCInternal.v1)), "grn"]; # why "mag"? I think "grn" + } elsif (me.wp.speed_cstr != nil and me.wp.speed_cstr > 0) { + var tcol = (me.wp.speed_cstr_type == "computed" or me.wp.speed_cstr_type == "computed_mach") ? "grn" : "mag"; # TODO - check if only computed + return [sprintf("%3.0f", me.wp.speed_cstr), tcol]; } else { return ["---", "wht"]; } }, getAlt: func() { if (me.index == 0 and left(me.wp.wp_name, 4) == fmgc.FMGCInternal.depApt and fmgc.flightPlanController.flightplans[me.plan].departure != nil) { - return [" " ~ sprintf("%-5.0f", math.round(fmgc.flightPlanController.flightplans[me.plan].departure.elevation * M2FT)), "mag"]; + return [" " ~ sprintf("%5.0f", math.round(fmgc.flightPlanController.flightplans[me.plan].departure.elevation * M2FT)), "grn"]; #fixed - aligned to right } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1) and fmgc.flightPlanController.fromWptAlt != nil) { return [" " ~ fmgc.flightPlanController.fromWptAlt, "mag"]; - } elsif (me.wp.alt_cstr != nil and me.wp.alt_cstr != 0) { + } elsif (me.wp.alt_cstr != nil and me.wp.alt_cstr > 0) { + var tcol = (me.wp.alt_cstr_type == "computed" or me.wp.alt_cstr_type == "computed_mach") ? "grn" : "mag"; # TODO - check if only computed if (me.wp.alt_cstr > fmgc.FMGCInternal.transAlt) { - return [" " ~ sprintf("%-5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)), "mag"]; + return [" " ~ sprintf("%5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)), tcol]; #fixed - aligned to right } else { - return [" " ~ sprintf("%-5.0f", me.wp.alt_cstr), "mag"]; + return [" " ~ sprintf("%5.0f", me.wp.alt_cstr), tcol]; #fixed - aligned to right } } else { return ["------", "wht"]; @@ -337,7 +351,7 @@ var fplnPage = { # this one is only created once, and then updated - remember th if (size(me.outputList) >= 1) { me.L1 = me.outputList[0].updateLeftText(); me.C1 = me.outputList[0].updateCenterText(); - me.C1[1] = "TIME "; + me.C1[1] = (fmgc.flightPlanController.fromWptTime != nil) ? "UTC " : "TIME "; # since TO change to UTC time (1 space left to center) me.R1 = me.outputList[0].updateRightText(); me.R1[1] = "SPD/ALT "; } else { diff --git a/Nasal/MCDU/FLIGHTLOG.nas b/Nasal/MCDU/FLIGHTLOG.nas new file mode 100644 index 00000000..c8550c1f --- /dev/null +++ b/Nasal/MCDU/FLIGHTLOG.nas @@ -0,0 +1,197 @@ +# AOC Flight Log system +# Basic OOOI system implementation + +var OOOIReport = { + new: func(state,time=0,fob="") { + var report = {parents:[OOOIReport]}; + report.state = state; + report.fob = (fob != "") ? fob : fmgc.FMGCInternal.fob; + if (time != 0) { + report.time = formatSecToHHMM(time); + report.elapsed = time; + } else { + report.time = sprintf("%02d.%02d", getprop("/sim/time/utc/hour"), getprop("/sim/time/utc/minute")); + report.elapsed = int(getprop("/sim/time/elapsed-sec")); + } + report.gmt = getprop("/sim/time/gmt-string"); + report.date = getprop("/sim/time/utc/day"); + report.fltnum = (fmgc.FMGCInternal.flightNumSet == 1) ? fmgc.FMGCInternal.flightNum : "----"; + report.tofrom = (fmgc.FMGCInternal.toFromSet) ? fmgc.FMGCInternal.depApt ~ "-" ~ fmgc.FMGCInternal.arrApt : "----/----"; + return report; + }, +}; + +# Flight phase states: RESET, BEGIN, WPUSH, OUT, OFF, ON, END + +var OOOIReportPage = { + new: func(index) { + var page = {parents:[OOOIReportPage]}; + page.index = index; + page.fltstate = ""; #UNDEF state RESET/BEGIN/WPUSH + page.fltnum = (fmgc.FMGCInternal.flightNumSet == 1) ? fmgc.FMGCInternal.flightNum : ""; + page.date = getprop("/sim/time/utc/day"); + page.tofrom = (fmgc.FMGCInternal.toFromSet) ? fmgc.FMGCInternal.depApt ~ "-" ~ fmgc.FMGCInternal.arrApt : ""; + page.fltstart = 0; + page.blkstart = 0; + page.flttime = "--.--"; + page.blktime = "--.--"; + return page; + }, +}; + +var formatSecToHHMM = func(sec) { + var mn = int(sec / 60); + return sprintf("%02d.%02d",int(mn/60),math.mod(mn,60)); +} + +var FlightLogDatabase = { + database: std.Vector.new(), + pages: std.Vector.new(), + currpageindex: 0, + addReport: func(report) { + if (report.state == 0 or me.getPageSize()==0) me.addPage(); + me.database.append(report); + var pg = me.pages.vector[me.pages.size()-1]; + if (report.state < 3) { # IN states (3/4) don't update page data + if (report.fltnum != "") pg.fltnum = report.fltnum; + if (report.tofrom != "") pg.tofrom = report.tofrom; + } + if (report.state == 0) { + pg.fltstate = "OUT"; + pg.blkstart = report.elapsed; + } + else if (report.state == 1) { + pg.fltstate = "OFF"; + pg.fltstart = report.elapsed; + } + else if (report.state == 2) { + pg.fltstate = "ON"; + if (pg.fltstart > 0) pg.flttime = formatSecToHHMM(report.elapsed - pg.fltstart); + } + else if (report.state > 2) { + pg.fltstate = "END"; + if (pg.blkstart > 0) pg.blktime = formatSecToHHMM(report.elapsed - pg.blkstart); + } + }, + reset: func() { + #Actually reset occurs before IN state - I have no solution for this + #if (me.getPageSize()>0 and me.currpageindex < me.getSize()) me.addPage(); + }, + getSize: func() { + return me.database.size(); + }, + getPageSize: func() { + return me.pages.size(); + }, + clearDatabase: func() { + me.database.clear(); + me.pages.clear(); + }, + getLogs: func() { + var lst = []; + foreach (var log; me.database) { + append(lst,log); + } + return lst; + }, + addPage: func() { + me.currpageindex = me.getSize(); + me.pages.append( OOOIReportPage.new(me.getSize()) ); + }, + getPage: func(pg) { + return (pg<=me.getPageSize()) ? me.pages.vector[pg-1] : OOOIReportPage.new(0); + }, + getLogByPage: func(no) { + var lst = [nil,nil,nil,nil]; + if (me.getPageSize() == 0) return lst; + var i = (me.getPageSize()>=no) ? me.pages.vector[no-1].index : 0; + var len = me.getSize(); + var v = 0; + var p = 0; + while (i 9) { # imho - it's useful few speed tollerance, 10kts min speed on taxiways - CHECKME - better with pushback detection? + FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); + expectedOOOIState = 1; + lastgear0 = 0; + } + } + } else if (expectedOOOIState == 1) { # OFF + if (!gear0) { + FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); + expectedOOOIState = 2; + } + else if (gs < 1) { # RETURN-IN ?? - rejected takeoff, A/C back to apron - CHECKME + if (doorL1_pos.getValue()>0 or doorR1_pos.getValue()>0 or doorL4_pos.getValue()>0 or doorR4_pos.getValue()>0) { + FlightLogDatabase.addReport(OOOIReport.new(4)); # RETURN-IN + expectedOOOIState = 0; + } + } + } else if (expectedOOOIState == 2) { # ON + if (gear0 and (phase == 7 or phase == 0)) { #done or preflight + FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); + expectedOOOIState = 3; + lastgear0 = 0; + lastgsrestart = 0; + } + } else if (expectedOOOIState == 3) { # IN + if (gear0 and gs < 1) { + if (lastgs0 == 0) { + lastgs0 = int(getprop("/sim/time/elapsed-sec")); + lastgsrestart = 0; + } + if (doorL1_pos.getValue()>0 or doorR1_pos.getValue()>0 or doorL4_pos.getValue()>0 or doorR4_pos.getValue()>0) { + FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); + expectedOOOIState = 0; + } + } + else if (!gear0) { # OFF without IN -> TO without stop and opening doors + if (lastgear0) FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState,lastgear0)); # IN (estimated) + FlightLogDatabase.addPage(); + if (lastgsrestart) FlightLogDatabase.addReport(OOOIReport.new(0,lastgsrestart)); # OUT (estimated) + expectedOOOIState = 1; # go on to OFF state + } + else if (gs > 9 and lastgsrestart == 0) { # try to detect OFF without IN + lastgsrestart = int(getprop("/sim/time/elapsed-sec")); + } + } + +}); + +var engine_one_chk_OOOI = setlistener("/engines/engine[0]/state", func { + if (getprop("/engines/engine[0]/state") == 3) { + removelistener(engine_one_chk_OOOI); + waitingOOOIChange.start(); + } +},0,0); \ No newline at end of file diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index e734af23..e96f0df2 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -5,7 +5,40 @@ var initInputA = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (key == "L2") { + if (key == "L1") { #clear coRoute if set + if (scratchpad == "CLR") { + if (fmgc.FMGCInternal.coRouteSet == 1) { + fmgc.FMGCInternal.coRouteSet = 0; + fmgc.FMGCInternal.coRoute = ""; + fmgc.FMGCInternal.depApt = ""; + fmgc.FMGCInternal.arrApt = ""; + fmgc.FMGCInternal.toFromSet = 0; + fmgc.FMGCNodes.toFromSet.setValue(0); + fmgc.windController.resetDesWinds(); + setprop("/FMGC/internal/align-ref-lat", 0); + setprop("/FMGC/internal/align-ref-long", 0); + setprop("/FMGC/internal/align-ref-lat-edit", 0); + setprop("/FMGC/internal/align-ref-long-edit", 0); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.fuelCalculating.setValue(0); + fmgc.FMGCInternal.fuelCalculating = 1; + fmgc.fuelCalculating.setValue(1); + } + fmgc.flightPlanController.reset(2); + fmgc.flightPlanController.init(); + Simbrief.SimbriefParser.inhibit = 0; + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + var len = size(scratchpad); + if (fmgc.FMGCInternal.coRouteSet == 1 or len != 10) { + mcdu_message(i, "NOT ALLOWED"); + } else { + mcdu_message(i, "NOT IN DATA BASE"); # fake message - TODO flightplan loader + } + } + } else if (key == "L2") { if (scratchpad == "CLR") { fmgc.FMGCInternal.altAirport = ""; fmgc.FMGCInternal.altAirportSet = 0; @@ -183,7 +216,10 @@ var initInputA = func(key, i) { } } } else if (key == "R1") { - if (scratchpad == "CLR") { + if (fmgc.FMGCInternal.coRouteSet == 1) { + mcdu_message(i, "NOT ALLOWED"); + } + else if (scratchpad == "CLR") { fmgc.FMGCInternal.depApt = ""; fmgc.FMGCInternal.arrApt = ""; fmgc.FMGCInternal.toFromSet = 0; @@ -206,7 +242,7 @@ var initInputA = func(key, i) { #} else if (scratchpad == "") { #fmgc.FMGCInternal.altSelected = 0; #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); - } else { + } else { if (!fmgc.flightPlanController.temporaryFlag[i]) { var tfs = size(scratchpad); if (tfs == 9 and find("/", scratchpad) != -1) { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 05d5d240..d1fd839d 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -18,6 +18,7 @@ var MCDU_reset = func(i) { setprop("it-autoflight/settings/togaspd", 157); #aka v2 clone setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", "STATUS"); setprop("/MCDU[" ~ i ~ "]/last-atsu-page", "ATSUDLINK"); + setprop("/MCDU[" ~ i ~ "]/active-system",""); pageNode[i].setValue("MCDU"); setprop("/FMGC/keyboard-left", 0); @@ -75,6 +76,8 @@ var MCDU_reset = func(i) { fmgc.FMGCInternal.gndTempSet = 0; fmgc.FMGCInternal.toFromSet = 0; fmgc.FMGCNodes.toFromSet.setValue(0); + fmgc.FMGCInternal.coRoute = ""; + fmgc.FMGCInternal.coRouteSet = 0; fmgc.FMGCInternal.tropo = 36090; fmgc.FMGCInternal.tropoSet = 0; @@ -216,9 +219,11 @@ var lskbutton = func(btn, i) { pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); mcdu_scratchpad.scratchpads[i].empty(); setprop("/MCDU[" ~ i ~ "]/active", 2); + setprop("/MCDU[" ~ i ~ "]/active-system","fmgc"); }, 2); - } else { + } else { pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); + setprop("/MCDU[" ~ i ~ "]/active-system","fmgc"); mcdu_scratchpad.scratchpads[i].empty(); } } @@ -232,6 +237,8 @@ var lskbutton = func(btn, i) { canvas_mcdu.myCRZWIND[i].pushButtonLeft(1); } else if (page == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonLeft(1); + } else if (page == "PROGPREF") { + progTOInput("L1",i); # same fn as TO } else if (page == "PROGTO") { progTOInput("L1",i); } else if (page == "PROGCLB") { @@ -354,6 +361,9 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 0; + atsu.freeTexts[i].changed = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -369,9 +379,11 @@ var lskbutton = func(btn, i) { pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-atsu-page")); mcdu_scratchpad.scratchpads[i].empty(); setprop("/MCDU[" ~ i ~ "]/atsu-active", 2); + setprop("/MCDU[" ~ i ~ "]/active-system","atsu"); }, 2); } else { pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-atsu-page")); + setprop("/MCDU[" ~ i ~ "]/active-system","atsu"); mcdu_scratchpad.scratchpads[i].empty(); } } @@ -495,6 +507,9 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 1; + atsu.freeTexts[i].changed = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -619,6 +634,9 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 2; + atsu.freeTexts[i].changed = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -786,6 +804,11 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } else if (page == "ATCMENU") { pageNode[i].setValue("NOTIFICATION"); + } else if (page == "FLTLOG") { + mcdu_message(i, "NOT ALLOWED"); + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 9; + atsu.freeTexts[i].changed = 1; } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(5); } else { @@ -845,7 +868,9 @@ var lskbutton = func(btn, i) { canvas_mcdu.myClosestAirport[i].freeze(); } else if (page == "AOCMENU" or page == "ATCMENU" or page == "ATCMENU2") { pageNode[i].setValue("ATSUDLINK"); - } else if (page == "NOTIFICATION" or page == "CONNECTSTATUS") { + } else if (page == "SENSORS") { + pageNode[i].setValue("FLTLOG"); + } else if (page == "NOTIFICATION" or page == "CONNECTSTATUS" or page == "MCDUTEXT") { pageNode[i].setValue("ATCMENU"); } else if (page == "WEATHERREQ" or page == "RECEIVEDMSGS") { pageNode[i].setValue("AOCMENU"); @@ -931,6 +956,8 @@ var rskbutton = func(btn, i) { } } else if (page == "ATSUDLINK") { pageNode[i].setValue("AOCMENU"); + } else if (page == "AOCMENU") { + pageNode[i].setValue("FLTLOG"); } else if (page == "WEATHERREQ") { var result = atsu.AOC.newStation(mcdu_scratchpad.scratchpads[i].scratchpad, i); if (result == 1) { @@ -951,6 +978,9 @@ var rskbutton = func(btn, i) { } else { mcdu_message(i, "NOT ALLOWED"); } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 3; + atsu.freeTexts[i].changed = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -991,7 +1021,10 @@ var rskbutton = func(btn, i) { } else { mcdu_message(i, "NOT ALLOWED"); } - } else { + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 4; + atsu.freeTexts[i].changed = 1; + } else { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "3") { @@ -1037,6 +1070,11 @@ var rskbutton = func(btn, i) { } else { mcdu_message(i, "NOT ALLOWED"); } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 5; + atsu.freeTexts[i].changed = 1; + } else if (page == "ATCMENU") { + pageNode[i].setValue("MCDUTEXT"); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -1180,6 +1218,8 @@ var rskbutton = func(btn, i) { } } else if (page == "ATCMENU") { pageNode[i].setValue("CONNECTSTATUS"); + } else if (page == "FLTLOG") { + pageNode[i].setValue("SENSORS"); } else if (page == "WEATHERREQ") { var result = atsu.AOC.sendReq(i); if (result == 1) { @@ -1247,6 +1287,9 @@ var rskbutton = func(btn, i) { } } else if (page == "NOTIFICATION") { pageNode[i].setValue("CONNECTSTATUS"); + } else if (page == "MCDUTEXT") { + # todo transfer to DCDU + pageNode[i].setValue("ATCMENU"); } else if (page == "ATSUDLINK") { pageNode[i].setValue("COMMMENU"); } else if (page == "CONNECTSTATUS") { @@ -1369,10 +1412,19 @@ var pagebutton = func(btn, i) { page = pageNode[i].getValue(); setprop("/MCDU[" ~ i ~ "]/scratchpad-color", "wht"); if (page != "MCDU") { + + # A more flexible system/page tracking for future system expansion + if (getprop("/MCDU[" ~ i ~ "]/active-system") == "fmgc") setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", page); + else if (getprop("/MCDU[" ~ i ~ "]/active-system") == "atsu") setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page); + if (btn == "atc") setprop("/MCDU[" ~ i ~ "]/active-system","atsu"); + else setprop("/MCDU[" ~ i ~ "]/active-system","fmgc"); + if (btn == "radnav") { - pageNode[i].setValue("RADNAV"); + pageNode[i].setValue("RADNAV"); } else if (btn == "prog") { - if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { + if (fmgc.FMGCInternal.phase == 0) { + pageNode[i].setValue("PROGPREF"); + } else if (fmgc.FMGCInternal.phase == 1) { pageNode[i].setValue("PROGTO"); } else if (fmgc.FMGCInternal.phase == 2) { pageNode[i].setValue("PROGCLB"); @@ -1405,12 +1457,13 @@ var pagebutton = func(btn, i) { } else if (btn == "data") { pageNode[i].setValue("DATA"); } else if (btn == "mcdu") { - var page = page; - if (page != "ATSUDLINK" and page != "AOCMENU" and page != "AOCCONFIG" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "RECEIVEDMSG" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT" and page != "ATIS" and page != "ATISDETAIL") { - setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", page); - } else { - setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page); - } + #var page = page; + #if (page != "ATSUDLINK" and page != "AOCMENU" and page != "AOCCONFIG" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "RECEIVEDMSG" and page != "ATCMENU" and page != "ATCMENU2" and page != "MCDUTEXT" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT" and page != "ATIS" and page != "ATISDETAIL") { + #if (getprop("/MCDU[0]/active-system") == "fmgc") { + # setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", page); + #} else { + # #setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page); + #} mcdu_message(i, "SELECT DESIRED SYSTEM"); pageNode[i].setValue("MCDU"); } else if (btn == "f-pln" or btn == "airport") { @@ -1449,16 +1502,18 @@ var pagebutton = func(btn, i) { settimer(func(){ pageNode[i].setValue("ATCMENU"); mcdu_scratchpad.scratchpads[i].empty(); - setprop("/MCDU[" ~ i ~ "]/atsu-active", 2); + setprop("/MCDU[" ~ i ~ "]/atsu-active", 2); }, 2); } else { - pageNode[i].setValue("ATCMENU"); + pageNode[i].setValue("ATCMENU"); } } } } -var button = func(btn, i) { +var buttonCLRDown = [0,0]; # counter for down event + +var button = func(btn, i, event = "") { page = pageNode[i].getValue(); if (page != "MCDU") { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; @@ -1467,11 +1522,24 @@ var button = func(btn, i) { } else if (btn == "SP") { mcdu_scratchpad.scratchpads[i].addChar(" "); } else if (btn == "CLR") { - var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (size(scratchpad) == 0) { - mcdu_scratchpad.scratchpads[i].addChar("CLR"); - } else { - mcdu_scratchpad.scratchpads[i].clear(); + if (event == "down") { + if (size(scratchpad) > 0) { + if (buttonCLRDown[i] > 4) { + mcdu_scratchpad.scratchpads[i].empty(); + } + buttonCLRDown[i] = buttonCLRDown[i] + 1; + } + } + else if (event == "" or buttonCLRDown[i]<=4) { + buttonCLRDown[i] = 0; + #var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; <- useless?? + if (size(scratchpad) == 0) { + mcdu_scratchpad.scratchpads[i].addChar("CLR"); + } else { + mcdu_scratchpad.scratchpads[i].clear(); + } + } else { # up with buttonCLRDown[i]>4 + buttonCLRDown[i] = 0; } } else if (btn == "DOT") { mcdu_scratchpad.scratchpads[i].addChar("."); @@ -1488,6 +1556,12 @@ var mcdu_message = func(i, string, overrideStr = "") { mcdu_scratchpad.scratchpads[i].override(overrideStr); } +# Messagge Type II - TODO 5 messages queue - remove only on resolve +var mcdu_messageTypeII = func(i, string, overrideStr = "") { + mcdu_scratchpad.scratchpads[i].showTypeII(mcdu_scratchpad.MessageController.getTypeIIMsgByText(string)); + mcdu_scratchpad.scratchpads[i].override(overrideStr); +} + var screenFlash = func(time, i) { page = pageNode[i].getValue(); pageNode[i].setValue("NONE"); diff --git a/Nasal/MCDU/PERFTO.nas b/Nasal/MCDU/PERFTO.nas index fc0d92dc..d4cdcd29 100644 --- a/Nasal/MCDU/PERFTO.nas +++ b/Nasal/MCDU/PERFTO.nas @@ -3,6 +3,22 @@ # Copyright (c) 2020 Josh Davidson (Octal450) # Copyright (c) 2020 Matthew Maring (mattmaring) +# VMCA 109.5 at 0ft +# VMCG 106.5 at 0ft all conf + +var standard_VMCA = 109.5; # TODO calculate VMCA/VMCG on altitude (ft) of departure airport (read below) +var standard_VMCG = 106.5; + +# TODO - DepArp elevation or current elevation (on ground only!!) -> math.round(fmgc.flightPlanController.flightplans[2].departure.elevation * M2FT)) + +var perfTOCheckVSpeeds = func(i) { + if (fmgc.FMGCInternal.v1set == 1 and fmgc.FMGCInternal.vrset == 1 and fmgc.FMGCInternal.v2set == 1) { # only when v1/vr/v2 all sets + if (fmgc.FMGCInternal.v1>fmgc.FMGCInternal.vr or fmgc.FMGCInternal.vr > fmgc.FMGCInternal.v2) mcdu_messageTypeII(i,"V1/VR/V2 DISAGREE"); + else if (fmgc.FMGCInternal.v1= 3 and thrreds <= 5) and thrred >= 400 and thrred <= 39000 and int(acc) != nil and (accs == 3 or accs == 4 or accs == 5) and acc >= 400 and acc <= 39000) { - setprop("/systems/thrust/clbreduc-ft", int(thrred / 10) * 10); - setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); - setprop("MCDUC/thracc-set", 1); - mcdu_scratchpad.scratchpads[i].empty(); + + if (thrred<=acc) { # validation + setprop("/systems/thrust/clbreduc-ft", int(thrred / 10) * 10); + setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); + setprop("MCDUC/thracc-set", 1); + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else if (thrreds == 0 and int(acc) != nil and (accs >= 3 and accs <= 5) and acc >= 400 and acc <= 39000) { setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); mcdu_scratchpad.scratchpads[i].empty(); diff --git a/Nasal/Systems/APU.nas b/Nasal/Systems/APU.nas index 8f57a2df..829acc60 100644 --- a/Nasal/Systems/APU.nas +++ b/Nasal/Systems/APU.nas @@ -101,7 +101,7 @@ var APU = { me.inletFlap.open(); me.listenSignals = 1; settimer(func() { - if (APUNodes.Controls.master.getValue() and !getprop("/systems/acconfig/autoconfig-running")) { + if (APUNodes.Controls.master.getValue() and !pts.Acconfig.running.getValue()) { me.setState(2); } }, 3); @@ -131,7 +131,7 @@ var APU = { apuStartTimer.start(); }, waitStart: func() { - if (pts.APU.rpm.getValue() >= 4.9) { + if (pts.APU.rpm.getValue() >= 4.9 or me.fastStart) { me.GenericControls.cutoff.setValue(0); if (me.fastStart) { setprop("/fdm/jsbsim/propulsion/set-running", 2); diff --git a/Nasal/Systems/Comm/CPDLC.nas b/Nasal/Systems/Comm/CPDLC.nas index fb680947..d145e758 100644 --- a/Nasal/Systems/Comm/CPDLC.nas +++ b/Nasal/Systems/Comm/CPDLC.nas @@ -3,11 +3,35 @@ # Copyright (c) 2020 Josh Davidson (Octal450) var CPDLCmessage = { - new: func(text) { + new: func(text, response = 0) { var cpdlcMessage = {parents: [CPDLCmessage] }; cpdlcMessage.text = text; + cpdlcMessage.response = response; return cpdlcMessage; }, }; -makeNewDictionaryItem(CPDLCmessage.new("CONNECT"), "CONNECT"); \ No newline at end of file +makeNewDictionaryItem(CPDLCmessage.new("CONNECT",0), "CONNECT"); + + +makeNewDictionaryItem(CPDLCmessage.new("WILCO",0), "WILCO"); +makeNewDictionaryItem(CPDLCmessage.new("UNABLE",0), "UNABLE"); +makeNewDictionaryItem(CPDLCmessage.new("STANDBY",0), "STANDBY"); +makeNewDictionaryItem(CPDLCmessage.new("ROGER",0), "ROGER"); +makeNewDictionaryItem(CPDLCmessage.new("AFFIRM",0), "AFFIRM"); +makeNewDictionaryItem(CPDLCmessage.new("NEGATIVE",0), "NEGATIVE"); + + +makeNewDictionaryItem(CPDLCmessage.new("REQUEST ALTITUDE",0), "REQUEST ALTITUDE"); + +var freeText = { + new: func(index) { + var freeTextObj = {parents: [freeText]}; + freeTextObj.index = index; + return freeTextObj; + }, + selection: 9, + changed: 0, +}; + +var freeTexts = [freeText.new(0), freeText.new(1)]; \ No newline at end of file diff --git a/Nasal/Systems/Comm/HF.nas b/Nasal/Systems/Comm/HF.nas index 1a4257ff..3440d4d6 100644 --- a/Nasal/Systems/Comm/HF.nas +++ b/Nasal/Systems/Comm/HF.nas @@ -118,9 +118,9 @@ var HFS = [highFrequencyRadio.new(systems.ELEC.Bus.acEssShed, 0), highFrequencyR # Can't use setlistener on the voltage as it always gets written to by JSB (and changes according to engine rpm) var update_items_HF_radio = [ - props.UpdateManager.FromProperty("/systems/electrical/bus/ac-ess-shed", 0.1, func(notification) + props.UpdateManager.FromHashValue("elecACEssShed", 0.1, func(val) { - if (systems.ELEC.Bus.acEssShed.getValue() < 110) { + if (val < 110) { HFS[0].transmit = 0; HFS[0].receptionProp.setValue(0); toneTimer1.stop(); @@ -133,9 +133,9 @@ var update_items_HF_radio = [ } } ), - props.UpdateManager.FromProperty("/systems/electrical/bus/ac-2", 0.1, func(notification) + props.UpdateManager.FromHashValue("elecAC2", 0.1, func(val) { - if (systems.ELEC.Bus.ac2.getValue() < 110) { + if (val) { HFS[1].transmit = 0; HFS[1].receptionProp.setValue(0); toneTimer2.stop(); @@ -150,9 +150,9 @@ var update_items_HF_radio = [ ), ]; -var HFLoop = func() { +var HFLoop = func(notification) { foreach (var update_item_HF; update_items_HF_radio) { - update_item_HF.update(nil); + update_item_HF.update(notification); } } diff --git a/Nasal/Systems/Comm/Notification.nas b/Nasal/Systems/Comm/Notification.nas index 408f2be1..5d01f494 100644 --- a/Nasal/Systems/Comm/Notification.nas +++ b/Nasal/Systems/Comm/Notification.nas @@ -168,12 +168,12 @@ var AOC = { var serverString = ""; if (me.server.getValue() == "vatsim") { - serverString = "https://api.flybywiresim.com/metar?source=vatsim&icao="; + serverString = "https://api.flybywiresim.com/metar/" ~ airport ~ "?source=vatsim"; } else { - serverString = defaultServer; + serverString = defaultServer ~ airport; } - http.load(serverString ~ airport) + http.load(serverString) .fail(func(r) me.downloadFail(i, r)) .done(func(r) { var errs = []; @@ -212,7 +212,23 @@ var AOC = { }, processMETAR: func(r, i) { var raw = r.response; + if (find('"statusCode":404',raw) != -1) { + me.received = 0; + me.sent = 0; + mcdu.mcdu_message(i, "NO METAR AVAILABLE"); + return; + } + if (me.server.getValue() == "vatsim") { + if (find("metar", raw) != -1) { + raw = split('"metar":"', raw)[1]; + raw = split('","source":"Vatsim"}', raw)[0]; + } else { + me.received = 0; + me.sent = 0; + mcdu.mcdu_message(i, "BAD SERVER RESPONSE"); + return; + } me.lastMETAR = raw; } else if (find("", raw) != -1) { raw = split("", raw)[1]; @@ -330,7 +346,7 @@ var ATIS = { }, processATIS: func(r, i) { var raw = r.response; - if (r.response == "FBW_ERROR: D-ATIS not available at this airport" or find("atis not avail",r.response) != -1 or find('"statusCode":404',r.response) != -1) { + if (raw == "FBW_ERROR: D-ATIS not available at this airport" or find("atis not avail",raw) != -1 or find('"statusCode":404',raw) != -1) { me.received = 0; me.sent = 0; mcdu.mcdu_message(i,"NO D-ATIS AVAILABLE"); diff --git a/Nasal/Systems/hydraulics.nas b/Nasal/Systems/hydraulics.nas index 5d40f9fc..c3cb02c2 100644 --- a/Nasal/Systems/hydraulics.nas +++ b/Nasal/Systems/hydraulics.nas @@ -7,7 +7,7 @@ var rcont = 0; var HYD = { Brakes: { - accumPressPsi: props.globals.initNode("/systems/hydraulic/brakes/accumulator-pressure-psi", 0, "INT"), + accumPressPsi: props.globals.initNode("/systems/hydraulic/yellow-accumulator-psi-cmd", 0, "INT"), leftPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-left-psi", 0, "INT"), rightPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-right-psi", 0, "INT"), askidSw: props.globals.initNode("/systems/hydraulic/brakes/askidnwssw", 1, "BOOL"), @@ -91,9 +91,6 @@ var HYD = { } else { me.Brakes.askidSw.setBoolValue(0); #false } - if (me.Psi.yellow.getValue() > 0 and me.Brakes.accumPressPsi.getValue() < 3000 and me.Psi.yellow.getValue() > me.Brakes.accumPressPsi.getValue()) { - me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() + 50); - } # Decrease accumPressPsi when green and yellow hydraulic's aren't pressurized if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { @@ -106,13 +103,11 @@ var HYD = { } else { rcont = 0; } - if ((me.Psi.green.getValue() == 0) and (me.Psi.yellow.getValue() == 0) and (me.Brakes.accumPressPsi.getValue()) > 0) { + if (me.Psi.yellow.getValue() < me.Brakes.accumPressPsi.getValue() and me.Brakes.accumPressPsi.getValue() > 0) { if (lcont == 1) { - #me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - (35 * me.Brakes.leftbrake.getValue())); me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - 200); } if (rcont == 1) { - #me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - (35 * me.Brakes.leftbrake.getValue())); me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - 200); } if (me.Brakes.accumPressPsi.getValue() < 0) { @@ -124,52 +119,63 @@ var HYD = { if (me.Brakes.mode.getValue() == 1 or (me.Brakes.mode.getValue() == 2 and me.Psi.green.getValue() >= 2500)) { # Normal braking - Green OK if (me.Brakes.leftbrake.getValue() > 0) { - me.Brakes.leftPressPsi.setValue(props.globals.getValue("/systems/hydraulic/green-psi-ptu")); + me.Brakes.leftPressPsi.setValue(me.Psi.green.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); } else { me.Brakes.leftPressPsi.setValue(0); } if (me.Brakes.rightbrake.getValue() > 0) { - me.Brakes.rightPressPsi.setValue(props.globals.getValue("/systems/hydraulic/green-psi-ptu")); + me.Brakes.rightPressPsi.setValue(me.Psi.green.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); } else { me.Brakes.rightPressPsi.setValue(0); } } else { if ((me.Brakes.mode.getValue() == 2 and me.Psi.green.getValue() < 2500) or me.Brakes.mode.getValue() == 0) { # Alternate Braking (Yellow OK + Antiskid ON + electric OK) - missing condition: BSCU OK-KO - if (me.Psi.yellow.getValue() >= 2500 and me.Brakes.askidSw.getValue() and props.globals.getValue("/systems/electrical/serviceable")) { + if (me.Psi.yellow.getValue() >= 2500 and me.Brakes.askidSw.getValue() and (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcEss.getValue() >= 24)) { if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.leftPressPsi.setValue(props.globals.getValue("/systems/hydraulic/yellow-psi-ptu")); + me.Brakes.leftPressPsi.setValue(me.Psi.yellow.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); } else { me.Brakes.leftPressPsi.setValue(0); } if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.rightPressPsi.setValue(props.globals.getValue("/systems/hydraulic/yellow-psi-ptu")); + me.Brakes.rightPressPsi.setValue(me.Psi.yellow.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); } else { me.Brakes.rightPressPsi.setValue(0); } } else { # Alternate Braking (Yellow OK + Antiskid OFF + electric OK) - missing condition: BSCU OK-KO - if (me.Psi.yellow.getValue() >= 2500 and !me.Brakes.askidSw.getValue() and props.globals.getValue("/systems/electrical/serviceable")) { + if (me.Psi.yellow.getValue() >= 2500 and !me.Brakes.askidSw.getValue() and (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcEss.getValue() >= 24)) { if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.leftPressPsi.setValue(1000); + me.Brakes.leftPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); } else { me.Brakes.leftPressPsi.setValue(0); } if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.rightPressPsi.setValue(1000); + me.Brakes.rightPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); } else { me.Brakes.rightPressPsi.setValue(0); } } else { # Alternate Braking (Yellow KO or Antiskid KO or electric KO) - missing condition: BSCU OK-KO - if (me.Psi.yellow.getValue() < 2500 or !me.Brakes.askidSw.getValue() or !props.globals.getValue("/systems/electrical/serviceable")) { + if (me.Brakes.accumPressPsi.getValue() < 1000 and (me.Psi.yellow.getValue() < 2500 or !me.Brakes.askidSw.getValue() or (systems.ELEC.Bus.dc1.getValue() < 24 and systems.ELEC.Bus.dc2.getValue() < 24 and systems.ELEC.Bus.dcEss.getValue() < 24))) { if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.leftPressPsi.setValue(me.Brakes.accumPressPsi.getValue()); + me.Brakes.leftPressPsi.setValue(me.Brakes.accumPressPsi.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); } else { me.Brakes.leftPressPsi.setValue(0); } if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.rightPressPsi.setValue(me.Brakes.accumPressPsi.getValue()); + me.Brakes.rightPressPsi.setValue(me.Brakes.accumPressPsi.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); + } else { + me.Brakes.rightPressPsi.setValue(0); + } + } else { + if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { + me.Brakes.leftPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); + } else { + me.Brakes.leftPressPsi.setValue(0); + } + if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { + me.Brakes.rightPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); } else { me.Brakes.rightPressPsi.setValue(0); } diff --git a/Nasal/emesary/exec.nas b/Nasal/emesary/exec.nas index 3ea20548..af3ad265 100644 --- a/Nasal/emesary/exec.nas +++ b/Nasal/emesary/exec.nas @@ -43,6 +43,12 @@ input = { elapsedTime: "/sim/time/elapsed-sec", FWCPhase: "/ECAM/warning-phase", gear0Wow: "/gear/gear[0]/wow", + + # Just about everything uses these properties at some stage, lets add them here! + elecAC1: "/systems/electrical/bus/ac-1", + elecAC2: "/systems/electrical/bus/ac-2", + elecACEss: "/systems/electrical/bus/ac-ess", + elecACEssShed: "/systems/electrical/bus/ac-ess-shed", engine1State: "/engines/engine[0]/state", engine2State: "/engines/engine[1]/state", }; diff --git a/README.md b/README.md index 38206505..53eeea83 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # A320-family A very advanced simulation of the Airbus A320 Family for FlightGear. -- Flight Dyanmics: Josh Davidson (Octal450) +- Flight Dynamics: Josh Davidson (Octal450) - Systems: Josh Davidson (Octal450), Jonathan Redpath (legoboyvdlp), merspieler, Matthew Maring (mattmaring) - Displays: Josh Davidson (Octal450), Jonathan Redpath (legoboyvdlp), merspieler, Matthew Maring (mattmaring) - 3D/Textures: Thorsten Herrmann (TH-555), Semir Gebran (CaptB) diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml index 26000189..40db7e4e 100644 --- a/Sounds/A320-common-sound.xml +++ b/Sounds/A320-common-sound.xml @@ -2137,14 +2137,26 @@ - - /fdm/jsbsim/fcs/left-brake-cmd-norm - 0.95 - - - /fdm/jsbsim/fcs/right-brake-cmd-norm - 0.95 - + + + /fdm/jsbsim/fcs/left-brake-cmd-norm + 0.95 + + + /gear/gear[1]/wow + 1 + + + + + /fdm/jsbsim/fcs/right-brake-cmd-norm + 0.95 + + + /gear/gear[2]/wow + 1 + + /velocities/groundspeed-kt diff --git a/Systems/a320-fcs.xml b/Systems/a320-fcs.xml index 76bd273b..0ad34c56 100644 --- a/Systems/a320-fcs.xml +++ b/Systems/a320-fcs.xml @@ -372,12 +372,13 @@ - + /systems/failures/fctl/ths-jam eq 1 /systems/hydraulic/yellow-psi ge 1500 /systems/hydraulic/green-psi ge 1500 + /systems/acconfig/autoconfig-running eq 1 @@ -978,8 +979,13 @@ - + fbw/tiller-handle-scheduled + 0.16 + + + + fbw/tiller-handle-cmd 20 @@ -1172,11 +1178,14 @@ - - + + + /services/chocks/enable eq 1 + /systems/hydraulic/green-psi ge 2500 + /systems/hydraulic/yellow-psi ge 1000 + /systems/hydraulic/yellow-accumulator-psi gt 0 + + fcs/brake-avail diff --git a/Systems/a320-hydraulic.xml b/Systems/a320-hydraulic.xml index 89113580..097c3c47 100644 --- a/Systems/a320-hydraulic.xml +++ b/Systems/a320-hydraulic.xml @@ -386,7 +386,7 @@ - + /systems/hydraulic/yellow-psi-cmd /systems/hydraulic/sys-incr-rate @@ -397,6 +397,34 @@ /systems/hydraulic/yellow-psi 0.9 + + + + + + + /systems/hydraulic/yellow-psi + 0 + + + /systems/hydraulic/yellow-psi + /systems/hydraulic/yellow-accumulator-psi-cmd + + + + /systems/hydraulic/yellow-psi + /systems/hydraulic/yellow-accumulator-psi-cmd + + /systems/hydraulic/yellow-accumulator-psi-cmd + + + + + + /systems/hydraulic/yellow-accumulator-psi-cmd + /systems/hydraulic/sys-incr-rate + /systems/hydraulic/sys-decr-rate + @@ -510,7 +538,7 @@ /controls/gear/brake-parking ne 1 - /systems/hydraulic/brakes/accumulator-pressure-psi ge 0 + /systems/hydraulic/yellow-accumulator-psi-cmd ge 0 diff --git a/Systems/a320-misc.xml b/Systems/a320-misc.xml index 22dddba9..0d9f46b5 100644 --- a/Systems/a320-misc.xml +++ b/Systems/a320-misc.xml @@ -38,5 +38,64 @@ + + + + + + + + /accelerations/pilot-gdamped lt 0.7 + /accelerations/pilot-gdamped gt 1.4 + + /ECAM/warning-phase ge 4 + + + + + /ECAM/Lower/g-force-display-cmd + 0.5 + 0.2 + + + + + + + + + /velocities/groundspeed-kt ge 15 + + /gear/gear[0]/compression-norm gt 0 + /gear/gear[1]/compression-norm gt 0 + /gear/gear[2]/compression-norm gt 0 + + + + + + + + /engines/engine[0]/state eq 3 + /engines/engine[1]/state eq 3 + + + + + + + /velocities/groundspeed-kt ge 2 + + + + + + + /velocities/groundspeed-kt ge 2 + + + + + diff --git a/Systems/pfd.xml b/Systems/pfd.xml index c3749535..733054dc 100644 --- a/Systems/pfd.xml +++ b/Systems/pfd.xml @@ -136,9 +136,79 @@ /it-autoflight/internal/alt - /instrumentation/altimeter/indicated-altitude-ft + /instrumentation/altimeter[0]/indicated-altitude-ft - /instrumentation/pfd/alt-diff + /instrumentation/pfd/alt-diff[0] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[1]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[1] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[2]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[2] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[3]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[3] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[4]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[4] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[5]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[5] diff --git a/revision.txt b/revision.txt index ac4213d6..abc4eff6 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -43 \ No newline at end of file +46 \ No newline at end of file