Add dual-fail again, cleanup messy code using default arguments
This commit is contained in:
parent
4db1094b48
commit
c8ab79c268
3 changed files with 89 additions and 91 deletions
|
@ -26,18 +26,18 @@ var rightLineIndex = 0;
|
||||||
var statusIndex = 0;
|
var statusIndex = 0;
|
||||||
|
|
||||||
var warning = {
|
var warning = {
|
||||||
new: func(msg,colour,aural,light,hasSubmsg = 0,lastSubmsg = 0) {
|
new: func(msg,colour = "g",aural = 9,light = 9,hasSubmsg = 0,lastSubmsg = 0) {
|
||||||
var t = {parents:[warning]};
|
var t = {parents:[warning]};
|
||||||
|
|
||||||
t.msg = msg;
|
t.msg = msg;
|
||||||
t.active = 0;
|
|
||||||
t.colour = colour;
|
t.colour = colour;
|
||||||
t.aural = aural;
|
t.aural = aural;
|
||||||
t.light = light;
|
t.light = light;
|
||||||
t.noRepeat = 0;
|
|
||||||
t.clearFlag = 0;
|
|
||||||
t.hasSubmsg = hasSubmsg;
|
t.hasSubmsg = hasSubmsg;
|
||||||
t.lastSubmsg = lastSubmsg;
|
t.lastSubmsg = lastSubmsg;
|
||||||
|
t.active = 0;
|
||||||
|
t.noRepeat = 0;
|
||||||
|
t.clearFlag = 0;
|
||||||
|
|
||||||
return t
|
return t
|
||||||
},
|
},
|
||||||
|
@ -77,12 +77,12 @@ var warning = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var memo = {
|
var memo = {
|
||||||
new: func(msg,colour) {
|
new: func(msg,colour = "g") {
|
||||||
var t = {parents:[memo]};
|
var t = {parents:[memo]};
|
||||||
|
|
||||||
t.msg = msg;
|
t.msg = msg;
|
||||||
t.active = 0;
|
|
||||||
t.colour = colour;
|
t.colour = colour;
|
||||||
|
t.active = 0;
|
||||||
|
|
||||||
return t
|
return t
|
||||||
},
|
},
|
||||||
|
@ -112,8 +112,8 @@ var status = {
|
||||||
var t = {parents:[status]};
|
var t = {parents:[status]};
|
||||||
|
|
||||||
t.msg = msg;
|
t.msg = msg;
|
||||||
t.active = 0;
|
|
||||||
t.colour = colour;
|
t.colour = colour;
|
||||||
|
t.active = 0;
|
||||||
|
|
||||||
return t
|
return t
|
||||||
},
|
},
|
||||||
|
@ -223,7 +223,7 @@ var ECAM_controller = {
|
||||||
clear: func() {
|
clear: func() {
|
||||||
foreach (var w; warnings.vector) {
|
foreach (var w; warnings.vector) {
|
||||||
if (w.active == 1) {
|
if (w.active == 1) {
|
||||||
# if (w.msg == "ENG DUAL FAILURE") { continue; }
|
if (w.hasSubmsg == 1) { continue; }
|
||||||
w.clearFlag = 1;
|
w.clearFlag = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,6 @@ var emerGen = props.globals.getNode("/controls/electrical/switches/emer-gen
|
||||||
var fac1Node = props.globals.getNode("/controls/fctl/fac1", 1);
|
var fac1Node = props.globals.getNode("/controls/fctl/fac1", 1);
|
||||||
var state1Node = props.globals.getNode("/engines/engine[0]/state", 1);
|
var state1Node = props.globals.getNode("/engines/engine[0]/state", 1);
|
||||||
var state2Node = props.globals.getNode("/engines/engine[1]/state", 1);
|
var state2Node = props.globals.getNode("/engines/engine[1]/state", 1);
|
||||||
var cutoff1Node = props.globals.getNode("/fdm/jsbsim/fcs/engine-cutoff[0]", 1);
|
|
||||||
var cutoff2Node = props.globals.getNode("/fdm/jsbsim/fcs/engine-cutoff[1]", 1);
|
|
||||||
var wowNode = props.globals.getNode("/fdm/jsbsim/position/wow", 1);
|
var wowNode = props.globals.getNode("/fdm/jsbsim/position/wow", 1);
|
||||||
|
|
||||||
# local variables
|
# local variables
|
||||||
|
|
|
@ -13,32 +13,32 @@ var warnings = std.Vector.new([
|
||||||
var flap_not_zero = warning.new(msg: "F/CTL FLAP LVR NOT ZERO", colour: "r", aural: 0, light: 0),
|
var flap_not_zero = warning.new(msg: "F/CTL FLAP LVR NOT ZERO", colour: "r", aural: 0, light: 0),
|
||||||
|
|
||||||
# DUAL ENG FAIL
|
# DUAL ENG FAIL
|
||||||
var dualFail = warning.new(msg: "ENG DUAL FAILURE", colour: "r", aural: 0, light: 0),
|
var dualFail = warning.new(msg: "ENG DUAL FAILURE", colour: "r", aural: 0, light: 0, hasSubmsg: 1),
|
||||||
var dualFailModeSel = warning.new(msg: " -ENG MODE SEL.......IGN", colour: "c", aural: 9, light: 9),
|
var dualFailModeSel = warning.new(msg: " -ENG MODE SEL.......IGN", colour: "c"),
|
||||||
var dualFailLevers = warning.new(msg: " -THR LEVERS........IDLE", colour: "c", aural: 9, light: 9),
|
var dualFailLevers = warning.new(msg: " -THR LEVERS........IDLE", colour: "c"),
|
||||||
var dualFailRelightSPD = warning.new(msg: " OPTIMUM RELIGHT SPD.280", colour: "c", aural: 9, light: 9),
|
var dualFailRelightSPD = warning.new(msg: " OPTIMUM RELIGHT SPD.280", colour: "c"),
|
||||||
var dualFailRelightSPDCFM = warning.new(msg: " OPTIMUM RELIGHT SPD.300", colour: "c", aural: 9, light: 9),
|
var dualFailRelightSPDCFM = warning.new(msg: " OPTIMUM RELIGHT SPD.300", colour: "c"),
|
||||||
var dualFailElec = warning.new(msg: " -EMER ELEC PWR...MAN ON", colour: "c", aural: 9, light: 9),
|
var dualFailElec = warning.new(msg: " -EMER ELEC PWR...MAN ON", colour: "c"),
|
||||||
var dualFailRadio = warning.new(msg: " -VHF1/ATC1..........USE", colour: "c", aural: 9, light: 9),
|
var dualFailRadio = warning.new(msg: " -VHF1/ATC1..........USE", colour: "c"),
|
||||||
var dualFailFAC = warning.new(msg: " -FAC 1......OFF THEN ON", colour: "c", aural: 9, light: 9),
|
var dualFailFAC = warning.new(msg: " -FAC 1......OFF THEN ON", colour: "c"),
|
||||||
var dualFailRelight = warning.new(msg: "•IF NO RELIGHT AFTER 30S", colour: "w", aural: 9, light: 9),
|
var dualFailRelight = warning.new(msg: "•IF NO RELIGHT AFTER 30S", colour: "w"),
|
||||||
var dualFailMasters = warning.new(msg: " -ENG MASTERS.OFF 30S/ON", colour: "c", aural: 9, light: 9),
|
var dualFailMasters = warning.new(msg: " -ENG MASTERS.OFF 30S/ON", colour: "c"),
|
||||||
var dualFailSuccess = warning.new(msg: " •IF UNSUCCESSFUL : ", colour: "w", aural: 9, light: 9),
|
var dualFailSuccess = warning.new(msg: " •IF UNSUCCESSFUL : ", colour: "w"),
|
||||||
var dualFailAPU = warning.new(msg: " -APU (IF AVAIL)...START", colour: "c", aural: 9, light: 9),
|
var dualFailAPU = warning.new(msg: " -APU (IF AVAIL)...START", colour: "c"),
|
||||||
var dualFailMastersAPU = warning.new(msg: " -ENG MASTERS.OFF 30S/ON", colour: "c", aural: 9, light: 9),
|
var dualFailMastersAPU = warning.new(msg: " -ENG MASTERS.OFF 30S/ON", colour: "c"),
|
||||||
var dualFailSPDGD = warning.new(msg: " OPTIMUM SPEED.....G DOT", colour: "c", aural: 9, light: 9),
|
var dualFailSPDGD = warning.new(msg: " OPTIMUM SPEED.....G DOT", colour: "c"),
|
||||||
var dualFailAPPR = warning.new(msg: " •EARLY IN APPR : ", colour: "w", aural: 9, light: 9),
|
var dualFailAPPR = warning.new(msg: " •EARLY IN APPR : ", colour: "w"),
|
||||||
var dualFailcabin = warning.new(msg: " -CAB SECURE.......ORDER", colour: "c", aural: 9, light: 9),
|
var dualFailcabin = warning.new(msg: " -CAB SECURE.......ORDER", colour: "c"),
|
||||||
var dualFailrudd = warning.new(msg: " -USE RUDDER WITH CARE ", colour: "c", aural: 9, light: 9),
|
var dualFailrudd = warning.new(msg: " -USE RUDDER WITH CARE ", colour: "c"),
|
||||||
var dualFailflap = warning.new(msg: " -FOR LDG.....USE FLAP 3", colour: "c", aural: 9, light: 9),
|
var dualFailflap = warning.new(msg: " -FOR LDG.....USE FLAP 3", colour: "c"),
|
||||||
var dualFail5000 = warning.new(msg: " •AT 5000 FT AGL : ", colour: "w", aural: 9, light: 9),
|
var dualFail5000 = warning.new(msg: " •AT 5000 FT AGL : ", colour: "w"),
|
||||||
var dualFailgear = warning.new(msg: " -L/G.........GRVTY EXTN", colour: "c", aural: 9, light: 9),
|
var dualFailgear = warning.new(msg: " -L/G.........GRVTY EXTN", colour: "c"),
|
||||||
var dualFailfinalspeed = warning.new(msg: " TARGET SPEED.....150 KT", colour: "c", aural: 9, light: 9),
|
var dualFailfinalspeed = warning.new(msg: " TARGET SPEED.....150 KT", colour: "c"),
|
||||||
var dualFailtouch = warning.new(msg: " •AT TOUCH DOWN : ", colour: "w", aural: 9, light: 9),
|
var dualFailtouch = warning.new(msg: " •AT TOUCH DOWN : ", colour: "w"),
|
||||||
var dualFailmasteroff = warning.new(msg: " -ENG MASTERS........OFF", colour: "c", aural: 9, light: 9),
|
var dualFailmasteroff = warning.new(msg: " -ENG MASTERS........OFF", colour: "c"),
|
||||||
var dualFailapuoff = warning.new(msg: " -APU MASTER SW......OFF", colour: "c", aural: 9, light: 9),
|
var dualFailapuoff = warning.new(msg: " -APU MASTER SW......OFF", colour: "c"),
|
||||||
var dualFailevac = warning.new(msg: " -EVAC..........INITIATE", colour: "c", aural: 9, light: 9),
|
var dualFailevac = warning.new(msg: " -EVAC..........INITIATE", colour: "c"),
|
||||||
var dualFailbatt = warning.new(msg: " -BAT 1+2............OFF", colour: "c", aural: 9, light: 9),
|
var dualFailbatt = warning.new(msg: " -BAT 1+2............OFF", colour: "c"),
|
||||||
|
|
||||||
# Config
|
# Config
|
||||||
var slats_config = warning.new(msg: "CONFIG", colour: "r", aural: 0, light: 0),
|
var slats_config = warning.new(msg: "CONFIG", colour: "r", aural: 0, light: 0),
|
||||||
|
@ -54,28 +54,28 @@ var warnings = std.Vector.new([
|
||||||
var park_brk_config = warning.new(msg: "CONFIG PARK BRK ON", colour: "r", aural: 0, light: 0),
|
var park_brk_config = warning.new(msg: "CONFIG PARK BRK ON", colour: "r", aural: 0, light: 0),
|
||||||
|
|
||||||
# Autopilot
|
# Autopilot
|
||||||
var ap_offw = warning.new(msg: "AUTO FLT AP OFF", colour: "r", aural: 9, light: 0),
|
var ap_offw = warning.new(msg: "AUTO FLT AP OFF", colour: "r", light: 0),
|
||||||
var athr_offw = warning.new(msg: "AUTO FLT A/THR OFF", colour: "a", aural: 1, light: 1),
|
var athr_offw = warning.new(msg: "AUTO FLT A/THR OFF", colour: "a", aural: 1, light: 1),
|
||||||
var athr_offw_1 = warning.new(msg: "-THR LEVERS........MOVE", colour: "c", aural: 9, light: 9),
|
var athr_offw_1 = warning.new(msg: "-THR LEVERS........MOVE", colour: "c"),
|
||||||
var athr_lock = warning.new(msg: "ENG THRUST LOCKED", colour: "a", aural: 1, light: 1),
|
var athr_lock = warning.new(msg: "ENG THRUST LOCKED", colour: "a", aural: 1, light: 1),
|
||||||
var athr_lock_1 = warning.new(msg: "-THR LEVERS........MOVE", colour: "c", aural: 9, light: 9),
|
var athr_lock_1 = warning.new(msg: "-THR LEVERS........MOVE", colour: "c"),
|
||||||
var athr_lim = warning.new(msg: "AUTO FLT A/THR LIMITED", colour: "a", aural: 1, light: 1),
|
var athr_lim = warning.new(msg: "AUTO FLT A/THR LIMITED", colour: "a", aural: 1, light: 1),
|
||||||
var athr_lim_1 = warning.new(msg: "-THR LEVERS........MOVE", colour: "c", aural: 9, light: 9)
|
var athr_lim_1 = warning.new(msg: "-THR LEVERS........MOVE", colour: "c")
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var leftmemos = std.Vector.new([
|
var leftmemos = std.Vector.new([
|
||||||
var company_alert = warning.new(msg: "COMPANY ALERT", colour: "g", aural: 9, light: 9), # Not yet implemented, buzzer sound
|
var company_alert = warning.new(msg: "COMPANY ALERT" ), # Not yet implemented, buzzer sound
|
||||||
var refuelg = warning.new(msg: "REFUELG", colour: "g", aural: 9, light: 9),
|
var refuelg = warning.new(msg: "REFUELG" ),
|
||||||
var irs_in_align = warning.new(msg: "IRS IN ALIGN", colour: "g", aural: 9, light: 9), # Not yet implemented
|
var irs_in_align = warning.new(msg: "IRS IN ALIGN" ), # Not yet implemented
|
||||||
var gnd_splrs = warning.new(msg: "GND SPLRS ARMED", colour: "g", aural: 9, light: 9),
|
var gnd_splrs = warning.new(msg: "GND SPLRS ARMED" ),
|
||||||
var seatbelts = warning.new(msg: "SEAT BELTS", colour: "g", aural: 9, light: 9),
|
var seatbelts = warning.new(msg: "SEAT BELTS" ),
|
||||||
var nosmoke = warning.new(msg: "NO SMOKING", colour: "g", aural: 9, light: 9),
|
var nosmoke = warning.new(msg: "NO SMOKING" ),
|
||||||
var strobe_lt_off = warning.new(msg: "STROBE LT OFF", colour: "g", aural: 9, light: 9),
|
var strobe_lt_off = warning.new(msg: "STROBE LT OFF" ),
|
||||||
var outr_tk_fuel_xfrd = warning.new(msg: "OUTR TK FUEL XFRD", colour: "g", aural: 9, light: 9), # Not yet implemented
|
var outr_tk_fuel_xfrd = warning.new(msg: "OUTR TK FUEL XFRD" ), # Not yet implemented
|
||||||
var fob_3T = warning.new(msg: "FOB BELOW 3T", colour: "g", aural: 9, light: 9),
|
var fob_3T = warning.new(msg: "FOB BELOW 3T" ),
|
||||||
var gpws_flap_mode_off = warning.new(msg: "GPWS FLAP MODE OFF", colour: "g", aural: 9, light: 9),
|
var gpws_flap_mode_off = warning.new(msg: "GPWS FLAP MODE OFF" ),
|
||||||
var atc_datalink_stby = warning.new(msg: "ATC DATALINK STBY", colour: "g", aural: 9, light: 9), # Not yet implemented
|
var atc_datalink_stby = warning.new(msg: "ATC DATALINK STBY" ), # Not yet implemented
|
||||||
var company_datalink_stby = warning.new(msg: "COMPANY DATALINK STBY", colour: "g", aural: 9, light: 9) # Not yet implemented
|
var company_datalink_stby = warning.new(msg: "COMPANY DATALINK STBY") # Not yet implemented
|
||||||
]);
|
]);
|
||||||
|
|
||||||
# Right E/WD
|
# Right E/WD
|
||||||
|
@ -103,45 +103,45 @@ var secondaryFailures = std.Vector.new([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var memos = std.Vector.new([
|
var memos = std.Vector.new([
|
||||||
var spd_brk = memo.new(msg: "SPEED BRK", colour: "g"),
|
var spd_brk = memo.new(msg: "SPEED BRK" ),
|
||||||
var park_brk = memo.new(msg: "PARK BRK", colour: "g"),
|
var park_brk = memo.new(msg: "PARK BRK" ),
|
||||||
var ptu = memo.new(msg: "HYD PTU", colour: "g"),
|
var ptu = memo.new(msg: "HYD PTU" ),
|
||||||
var rat = memo.new(msg: "RAT OUT", colour: "g"),
|
var rat = memo.new(msg: "RAT OUT" ),
|
||||||
var emer_gen = memo.new(msg: "EMER GEN", colour: "g"),
|
var emer_gen = memo.new(msg: "EMER GEN" ),
|
||||||
var ram_air = memo.new(msg: "RAM AIR ON", colour: "g"),
|
var ram_air = memo.new(msg: "RAM AIR ON" ),
|
||||||
var nw_strg_disc = memo.new(msg: "NW STRG DISC", colour: "g"),
|
var nw_strg_disc = memo.new(msg: "NW STRG DISC"),
|
||||||
var ignition = memo.new(msg: "IGNITION", colour: "g"),
|
var ignition = memo.new(msg: "IGNITION" ),
|
||||||
var cabin_ready = memo.new(msg: "CABIN READY", colour: "g"), # Not yet implemented
|
var cabin_ready = memo.new(msg: "CABIN READY" ), # Not yet implemented
|
||||||
var pred_ws_off = memo.new(msg: "PRED W/S OFF", colour: "g"), # Not yet implemented
|
var pred_ws_off = memo.new(msg: "PRED W/S OFF"), # Not yet implemented
|
||||||
var terr_stby = memo.new(msg: "TERR STBY", colour: "g"), # Not yet implemented
|
var terr_stby = memo.new(msg: "TERR STBY" ), # Not yet implemented
|
||||||
var tcas_stby = memo.new(msg: "TCAS STBY", colour: "g"), # Not yet implemented
|
var tcas_stby = memo.new(msg: "TCAS STBY" ), # Not yet implemented
|
||||||
var acars_call = memo.new(msg: "ACARS CALL", colour: "g"), # Not yet implemented
|
var acars_call = memo.new(msg: "ACARS CALL" ), # Not yet implemented
|
||||||
var company_call = memo.new(msg: "COMPANY CALL", colour: "g"), # Not yet implemented
|
var company_call = memo.new(msg: "COMPANY CALL"), # Not yet implemented
|
||||||
var satcom_alert = memo.new(msg: "SATCOM ALERT", colour: "g"), # Not yet implemented
|
var satcom_alert = memo.new(msg: "SATCOM ALERT"), # Not yet implemented
|
||||||
var acars_msg = memo.new(msg: "ACARS MSG", colour: "g"), # Not yet implemented
|
var acars_msg = memo.new(msg: "ACARS MSG" ), # Not yet implemented
|
||||||
var company_msg = memo.new(msg: "COMPANY MSG", colour: "g"), # Not yet implemented
|
var company_msg = memo.new(msg: "COMPANY MSG" ), # Not yet implemented
|
||||||
var eng_aice = memo.new(msg: "ENG A.ICE", colour: "g"),
|
var eng_aice = memo.new(msg: "ENG A.ICE" ),
|
||||||
var wing_aice = memo.new(msg: "WING A.ICE", colour: "g"),
|
var wing_aice = memo.new(msg: "WING A.ICE" ),
|
||||||
var ice_not_det = memo.new(msg: "ICE NOT DET", colour: "g"), # Not yet implemented
|
var ice_not_det = memo.new(msg: "ICE NOT DET" ), # Not yet implemented
|
||||||
var hi_alt = memo.new(msg: "HI ALT", colour: "g"), # Not yet implemented
|
var hi_alt = memo.new(msg: "HI ALT" ), # Not yet implemented
|
||||||
var apu_avail = memo.new(msg: "APU AVAIL", colour: "g"),
|
var apu_avail = memo.new(msg: "APU AVAIL" ),
|
||||||
var apu_bleed = memo.new(msg: "APU BLEED", colour: "g"),
|
var apu_bleed = memo.new(msg: "APU BLEED" ),
|
||||||
var ldg_lt = memo.new(msg: "LDG LT", colour: "g"),
|
var ldg_lt = memo.new(msg: "LDG LT" ),
|
||||||
var brk_fan = memo.new(msg: "BRK FAN", colour: "g"), # Not yet implemented
|
var brk_fan = memo.new(msg: "BRK FAN" ), # Not yet implemented
|
||||||
var audio3_xfrd = memo.new(msg: "AUDIO 3 XFRD", colour: "g"), # Not yet implemented
|
var audio3_xfrd = memo.new(msg: "AUDIO 3 XFRD"), # Not yet implemented
|
||||||
var switchg_pnl = memo.new(msg: "SWITCHG PNL", colour: "g"), # Not yet implemented
|
var switchg_pnl = memo.new(msg: "SWITCHG PNL" ), # Not yet implemented
|
||||||
var gpws_flap3 = memo.new(msg: "GPWS FLAP 3", colour: "g"),
|
var gpws_flap3 = memo.new(msg: "GPWS FLAP 3" ),
|
||||||
var hf_data_ovrd = memo.new(msg: "HF DATA OVRD", colour: "g"), # Not yet implemented
|
var hf_data_ovrd = memo.new(msg: "HF DATA OVRD"), # Not yet implemented
|
||||||
var hf_voice = memo.new(msg: "HF VOICE", colour: "g"), # Not yet implemented
|
var hf_voice = memo.new(msg: "HF VOICE" ), # Not yet implemented
|
||||||
var acars_stby = memo.new(msg: "ACARS STBY", colour: "g"), # Not yet implemented
|
var acars_stby = memo.new(msg: "ACARS STBY" ), # Not yet implemented
|
||||||
var vhf3_voice = memo.new(msg: "VHF3 VOICE", colour: "g"),
|
var vhf3_voice = memo.new(msg: "VHF3 VOICE" ),
|
||||||
var auto_brk_lo = memo.new(msg: "AUTO BRK LO", colour: "g"),
|
var auto_brk_lo = memo.new(msg: "AUTO BRK LO" ),
|
||||||
var auto_brk_med = memo.new(msg: "AUTO BRK MED", colour: "g"),
|
var auto_brk_med = memo.new(msg: "AUTO BRK MED"),
|
||||||
var auto_brk_max = memo.new(msg: "AUTO BRK MAX", colour: "g"),
|
var auto_brk_max = memo.new(msg: "AUTO BRK MAX"),
|
||||||
var auto_brk_off = memo.new(msg: "AUTO BRK OFF", colour: "g"), # Not yet implemented
|
var auto_brk_off = memo.new(msg: "AUTO BRK OFF"), # Not yet implemented
|
||||||
var man_ldg_elev = memo.new(msg: "MAN LDG ELEV", colour: "g"), # Not yet implemented
|
var man_ldg_elev = memo.new(msg: "MAN LDG ELEV"), # Not yet implemented
|
||||||
var ctr_tk_feedg = memo.new(msg: "CTR TK FEEDG", colour: "g"),
|
var ctr_tk_feedg = memo.new(msg: "CTR TK FEEDG"),
|
||||||
var fuelx = memo.new(msg: "FUEL X FEED", colour: "g")
|
var fuelx = memo.new(msg: "FUEL X FEED" )
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var clearWarnings = std.Vector.new();
|
var clearWarnings = std.Vector.new();
|
||||||
|
|
Reference in a new issue