diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-old.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-old.nas index f9a7f0ef..38a590c0 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-old.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-old.nas @@ -116,7 +116,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); +var gLoad = props.globals.getNode("", 1); # Hydraulic var blue_psi = 0; @@ -445,91 +445,13 @@ 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())); - me["SAT"].setColor(0.0509,0.7529,0.2941); - } else { - me["SAT"].setText(sprintf("%s", "XX")); - me["SAT"].setColor(0.7333,0.3803,0); - } - if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); - me["TAT"].setColor(0.0509,0.7529,0.2941); - } else { - me["TAT"].setText(sprintf("%s", "XX")); - 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-weight-unit"].setText("KG"); - } else { - me["GW-weight-unit"].setText("LBS"); - } }, }; - -var canvas_lowerECAM_apu = { - new: func(canvas_group, file) { - var m = {parents: [canvas_lowerECAM_apu, canvas_lowerECAM_base]}; - m.init(canvas_group, file); - - return m; - }, - getKeys: func() { - 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() { - - - - var apu_valve_state2 = apu_valve_state.getValue(); - if (apu_valve_state2 == 1) { - me["APUBleedValve"].setRotation(90 * D2R); - } else { - me["APUBleedValve"].setRotation(0); - } - - if (apu_valve_state2 == apu_valve_state.getValue()) { - me["APUBleedValve"].setColor(0.0509,0.7529,0.2941); - me["APUBleedOnline"].show(); - } else { - me["APUBleedValve"].setColor(0.7333,0.3803,0); - me["APUBleedOnline"].hide(); - } - - me.updateBottomStatus(); - }, -}; - var canvas_lowerECAM_bleed = { new: func(canvas_group, file) { var m = {parents: [canvas_lowerECAM_bleed, canvas_lowerECAM_base]}; diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index fcf37cf6..4ae127b9 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -30,9 +30,12 @@ var canvas_lowerECAMPage = }; canvas.parsesvg(obj.group, svg, {"font-mapper": obj.font_mapper} ); - obj.keysHash = obj.getKeys(); - foreach(var key; obj.keysHash) { + foreach(var key; obj.getKeys()) { + obj[key] = obj.group.getElementById(key); + }; + + foreach(var key; obj.getKeysBottom()) { obj[key] = obj.group.getElementById(key); }; @@ -193,15 +196,77 @@ var canvas_lowerECAMPage = } }), ]; + + obj.displayedGForce = 0; + obj.updateItemsBottom = [ + props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { + if (val) { + obj["GW-weight-unit"].setText("KG"); + } else { + obj["GW-weight-unit"].setText("LBS"); + } + }), + props.UpdateManager.FromHashValue("hour", nil, func(val) { + obj["UTCh"].setText(sprintf("%02d", val)); + }), + props.UpdateManager.FromHashValue("minute", nil, func(val) { + obj["UTCm"].setText(sprintf("%02d", val)); + }), + props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { + if (obj.displayedGForce) { + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); + } + }), + props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { + if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { + obj.displayedGForce = 1; + obj["GLoad"].show(); + } else { + obj.displayedGForce = 0; + obj["GLoad"].hide(); + } + }), + ]; return obj; }, + getKeysBottom: func() { + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit"]; + }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","APUN-needle","APUEGT-needle","APUN","APUEGT","APUAvail","APUFlapOpen","APUBleedValve","APUBleedOnline","APUBleedValveCrossBar","APUGenOnline","APUGenOff","APUGentext","APUGenLoad","APUGenbox","APUGenVolt","APUGenHz","APUBleedPSI","APUfuelLO","APU-low-oil", - "text3724","text3728","text3732"]; + return ["APUN-needle","APUEGT-needle","APUN","APUEGT","APUAvail","APUFlapOpen","APUBleedValve","APUBleedOnline","APUBleedValveCrossBar","APUGenOnline","APUGenOff","APUGentext","APUGenLoad","APUGenbox","APUGenVolt","APUGenHz","APUBleedPSI","APUfuelLO","APU-low-oil","text3724","text3728","text3732"]; }, getKeysTest: func() { return ["Test_white","Test_text"]; }, + updateTemperatures: func() { + if (dmc.DMController.DMCs[1].outputs[4] != nil) { + me["SAT"].setText(sprintf("%2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + me["SAT"].setColor(0.0509,0.7529,0.2941); + } else { + me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setColor(0.7333,0.3803,0); + } + + if (dmc.DMController.DMCs[1].outputs[5] != nil) { + me["TAT"].setText(sprintf("%2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + me["TAT"].setColor(0.0509,0.7529,0.2941); + } else { + me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setColor(0.7333,0.3803,0); + } + + 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); + } + }, update: func(notification) { me.updatePower(); @@ -217,6 +282,13 @@ var canvas_lowerECAMPage = { update_item.update(notification); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } + + me.updateTemperatures(); }, updateTest: func(notification) { if (du4_test_time.getValue() + 1 >= notification.elapsedTime) { @@ -319,6 +391,11 @@ var input = { apuLoad: "/systems/electrical/extra/apu-load", apuHertz: "/systems/electrical/sources/apu/output-hertz", apuVolt: "/systems/electrical/sources/apu/output-volt", + + gForce: "/accelerations/pilot-gdamped", + gForceDisplay: "/ECAM/Lower/g-force-display", + hour: "/sim/time/utc/hour", + minute: "/sim/time/utc/minute", }; foreach (var name; keys(input)) { diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index abe6a09b..ab8f037d 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -992,7 +992,6 @@ emesary.GlobalTransmitter.Register(A320EWD); var input = { fuelTotalLbs: "/consumables/fuel/total-fuel-lbs", - acconfigUnits: "/systems/acconfig/options/weight-kgs", slatLocked: "/fdm/jsbsim/fcs/slat-locked", # N1 parameters diff --git a/Nasal/emesary/exec.nas b/Nasal/emesary/exec.nas index eda3c5e9..c00a8579 100644 --- a/Nasal/emesary/exec.nas +++ b/Nasal/emesary/exec.nas @@ -42,6 +42,7 @@ input = { frame_rate: "/sim/frame-rate", elapsedTime: "/sim/time/elapsed-sec", FWCPhase: "/ECAM/warning-phase", + acconfigUnits: "/systems/acconfig/options/weight-kgs", # Just about everything uses these properties at some stage, lets add them here! gear0Wow: "/gear/gear[0]/wow",