props.nas
This commit is contained in:
parent
66c2f98218
commit
dc8e719b4b
2 changed files with 105 additions and 79 deletions
|
@ -15,9 +15,15 @@ setprop("/ECAM/show-right-msg", 1);
|
|||
setprop("/ECAM/warnings/master-warning-light", 0);
|
||||
setprop("/ECAM/warnings/master-warning-flash", 0);
|
||||
setprop("/ECAM/warnings/master-caution-light", 0);
|
||||
setprop("/ECAM/warnings/overflow", 0);
|
||||
setprop("/ECAM/warnings/overflow-left", 0);
|
||||
setprop("/ECAM/warnings/overflow-right", 0);
|
||||
|
||||
var lines = [props.globals.getNode("/ECAM/msg/line1", 1), props.globals.getNode("/ECAM/msg/line2", 1), props.globals.getNode("/ECAM/msg/line3", 1), props.globals.getNode("/ECAM/msg/line4", 1), props.globals.getNode("/ECAM/msg/line5", 1), props.globals.getNode("/ECAM/msg/line6", 1), props.globals.getNode("/ECAM/msg/line7", 1), props.globals.getNode("/ECAM/msg/line8", 1)];
|
||||
var linesCol = [props.globals.getNode("/ECAM/msg/linec1", 1), props.globals.getNode("/ECAM/msg/linec2", 1), props.globals.getNode("/ECAM/msg/linec3", 1), props.globals.getNode("/ECAM/msg/linec4", 1), props.globals.getNode("/ECAM/msg/linec5", 1), props.globals.getNode("/ECAM/msg/linec6", 1), props.globals.getNode("/ECAM/msg/linec7", 1), props.globals.getNode("/ECAM/msg/linec8", 1)];
|
||||
var leftOverflow = props.globals.initNode("/ECAM/warnings/overflow-left", "BOOL", 0);
|
||||
var rightOverflow = props.globals.initNode("/ECAM/warnings/overflow-right", "BOOL", 0);
|
||||
var overflow = props.globals.initNode("/ECAM/warnings/overflow", "BOOL", 0);
|
||||
|
||||
var lights = [props.globals.initNode("/ECAM/warnings/master-warning-light", "BOOL", 0), props.globals.initNode("/ECAM/warnings/master-caution-light", "BOOL", 0)];
|
||||
var aural = [props.globals.initNode("/sim/sound/warnings/crc", "BOOL", 0), props.globals.initNode("/sim/sound/warnings/chime", "BOOL", 0)];
|
||||
|
||||
var warning = {
|
||||
msg: "",
|
||||
|
@ -26,7 +32,8 @@ var warning = {
|
|||
aural: "",
|
||||
light: "",
|
||||
noRepeat: 0,
|
||||
new: func(msg,active,colour,aural,light,noRepeat) {
|
||||
clearFlag: 0,
|
||||
new: func(msg,active,colour,aural,light,noRepeat,clearFlag) {
|
||||
var t = {parents:[warning]};
|
||||
|
||||
t.msg = msg;
|
||||
|
@ -35,40 +42,42 @@ var warning = {
|
|||
t.aural = aural;
|
||||
t.light = light;
|
||||
t.noRepeat = noRepeat;
|
||||
t.clearFlag = clearFlag;
|
||||
|
||||
return t
|
||||
},
|
||||
write: func() {
|
||||
if (me.active == 0) {return;}
|
||||
line = 1;
|
||||
while (getprop("/ECAM/msg/line" ~ line) != "" and line <= 8) {
|
||||
while (lines[line].getValue()) != "" and line <= 8) {
|
||||
line = line + 1; # go to next line until empty line
|
||||
}
|
||||
|
||||
if (line > 8) {
|
||||
setprop("/ECAM/warnings/overflow-left", 1);
|
||||
} elsif (getprop("/ECAM/warnings/overflow-left") == 1) {
|
||||
setprop("/ECAM/warnings/overflow-left", 0);
|
||||
leftOverflow.setBoolValue(1);
|
||||
} elsif (leftOverflow.getBoolValue() == 1) {
|
||||
leftOverflow.setBoolValue(0);
|
||||
}
|
||||
|
||||
if (getprop("/ECAM/msg/line" ~ line) == "" and me.active == 1 and me.msg != "" and line <= 8) { # at empty line. Also checks if message is not blank to allow for some warnings with no displayed msg, eg stall
|
||||
setprop("/ECAM/msg/line" ~ line, me.msg);
|
||||
setprop("/ECAM/msg/linec" ~ line, me.colour);
|
||||
if (lines[line].getValue() == "" and me.msg != "" and line <= 8) { # at empty line. Also checks if message is not blank to allow for some warnings with no displayed msg, eg stall
|
||||
lines[line].setValue(me.msg);
|
||||
linesCol[line].setValue(me.colour);
|
||||
}
|
||||
},
|
||||
warnlight: func() {
|
||||
if ((me.light != "none" or me.light != "") and me.noRepeat == 0 and me.active == 1) { # only toggle light once per message, allows canceling
|
||||
setprop("/ECAM/warnings/master-"~me.light~"-light", 1);
|
||||
if (me.active == 0 or me.light >= 1) {return;}
|
||||
|
||||
if (me.noRepeat == 0 and lights[me.light].getBoolValue() == 0) { # only toggle light once per message, allows canceling
|
||||
lights[me.light].setBoolValue(1);
|
||||
me.noRepeat = 1;
|
||||
}
|
||||
},
|
||||
sound: func() {
|
||||
if (me.active and (me.aural != "none" or me.aural != "") and getprop("/sim/sound/warnings/"~me.aural) != 1) {
|
||||
setprop("/sim/sound/warnings/"~me.aural, 1);
|
||||
} else if (!me.active or me.aural == "none") {
|
||||
if (getprop("/sim/sound/warnings/"~me.aural) == 1) {
|
||||
setprop("/sim/sound/warnings/"~me.aural, 0);
|
||||
}
|
||||
if (me.active == 0 or me.aural >= 1) {return;}
|
||||
if (aural[me.aural].getBoolValue() != 1) {
|
||||
aural[me.aural].setBoolValue(1);
|
||||
}
|
||||
# have to cancel it anyway, I think it does not go out even if failure is removed
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -86,6 +95,7 @@ var memo = {
|
|||
return t
|
||||
},
|
||||
write: func() {
|
||||
if (me.active == 1) {
|
||||
right_line = 1;
|
||||
while (getprop("/ECAM/rightmsg/line" ~ right_line) != "" and right_line <= 8) {
|
||||
right_line = right_line + 1; # go to next line until empty line
|
||||
|
@ -97,10 +107,11 @@ var memo = {
|
|||
setprop("/ECAM/warnings/overflow-right", 0);
|
||||
}
|
||||
|
||||
if (getprop("/ECAM/rightmsg/line" ~ right_line) == "" and me.active == 1 and right_line <= 8) { # at empty line
|
||||
if (getprop("/ECAM/rightmsg/line" ~ right_line) == "" and right_line <= 8) { # at empty line
|
||||
setprop("/ECAM/rightmsg/line" ~ right_line, me.msg);
|
||||
setprop("/ECAM/rightmsg/linec" ~ right_line, me.colour);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -118,15 +129,17 @@ var status = {
|
|||
return t
|
||||
},
|
||||
write: func() {
|
||||
if (me.active == 1) {
|
||||
status_line = 1;
|
||||
while (getprop("/ECAM/status/line" ~ status_line) != "" and status_line <= 8) {
|
||||
status_line = status_line + 1; # go to next line until empty line
|
||||
}
|
||||
|
||||
if (getprop("/ECAM/status/line" ~ status_line) == "" and me.active == 1 and status_line <= 8) { # at empty line
|
||||
if (getprop("/ECAM/status/line" ~ status_line) == "" and status_line <= 8) { # at empty line
|
||||
setprop("/ECAM/status/line" ~ status_line, me.msg);
|
||||
setprop("/ECAM/status/linec" ~ status_line, me.colour);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -137,7 +150,6 @@ var ECAM_controller = {
|
|||
},
|
||||
loop: func() {
|
||||
# check active messages
|
||||
# config_warnings();
|
||||
messages_priority_3();
|
||||
messages_priority_2();
|
||||
messages_priority_1();
|
||||
|
@ -224,6 +236,17 @@ var ECAM_controller = {
|
|||
if (w.active == 1) {
|
||||
w.active = 0; # todo: need to hit CLR to clear condition, not automatic
|
||||
w.noRepeat = 0; # should warning only clear if condition is not true?
|
||||
w.clearFlag = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
recall: func() {
|
||||
foreach (var w; warnings.vector) {
|
||||
if (w.clearFlag == 1) {
|
||||
w.active = 1;
|
||||
w.noRepeat = 1;
|
||||
w.clearFlag = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,55 +4,58 @@
|
|||
|
||||
# messages stored in vectors
|
||||
|
||||
# Lights: 0 = red, 1 = yellow, 9 = none
|
||||
# Sounds: 0 = master warn, 1 = chime, 9 = other
|
||||
|
||||
# Left E/WD
|
||||
var warningsOld = std.Vector.new([
|
||||
var lg_not_dn = warning.new(msg: "L/G GEAR NOT DOWN", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var pack1_fault = warning.new(msg: "AIR PACK 1 FAULT ", active: 0, colour: "a", aural: "chime", light: "caution", noRepeat: 0),
|
||||
var pack1_fault_subwarn_1 = warning.new(msg: "-PACK 1.............OFF ", active: 0, colour: "b", aural: "none", light: "none", noRepeat: 0),
|
||||
var pack2_fault = warning.new(msg: "AIR PACK 2 FAULT ", active: 0, colour: "a", aural: "chime", light: "caution", noRepeat: 0),
|
||||
var pack2_fault_subwarn_1 = warning.new(msg: "-PACK 2.............OFF ", active: 0, colour: "b", aural: "none", light: "none", noRepeat: 0),
|
||||
var park_brk_on = warning.new(msg: "PARK BRK ON", active: 0, colour: "a", aural: "chime", light: "caution", noRepeat: 0)
|
||||
var lg_not_dn = warning.new(msg: "L/G GEAR NOT DOWN", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
var pack1_fault = warning.new(msg: "AIR PACK 1 FAULT ", active: 0, colour: "a", aural: 1, light: 1, noRepeat: 0, clearFlag: 0),
|
||||
var pack1_fault_subwarn_1 = warning.new(msg: "-PACK 1.............OFF ", active: 0, colour: "b", aural: 9, light: 9, noRepeat: 0, clearFlag: 0),
|
||||
var pack2_fault = warning.new(msg: "AIR PACK 2 FAULT ", active: 0, colour: "a", aural: 1, light: 1, noRepeat: 0, clearFlag: 0),
|
||||
var pack2_fault_subwarn_1 = warning.new(msg: "-PACK 2.............OFF ", active: 0, colour: "b", aural: 9, light: 9, noRepeat: 0, clearFlag: 0),
|
||||
var park_brk_on = warning.new(msg: "PARK BRK ON", active: 0, colour: "a", aural: 1, light: 1, noRepeat: 0, clearFlag: 0)
|
||||
]);
|
||||
|
||||
var warnings = std.Vector.new([
|
||||
var flap_not_zero = warning.new(msg: "F/CTL FLAP LVR NOT ZERO", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var flap_not_zero = warning.new(msg: "F/CTL FLAP LVR NOT ZERO", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
|
||||
# Config
|
||||
var slats_config = warning.new(msg: "CONFIG", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var slats_config_1 = warning.new(msg: "SLATS NOT IN T.O. CONFIG", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var flaps_config = warning.new(msg: "CONFIG", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var flaps_config_1 = warning.new(msg: "FLAPS NOT IN T.O. CONFIG", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var spd_brk_config = warning.new(msg: "CONFIG", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var spd_brk_config_1 = warning.new(msg: "SPD BRK NOT RETRACTED", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var pitch_trim_config = warning.new(msg: "CONFIG PITCH TRIM", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var pitch_trim_config_1 = warning.new(msg: " NOT IN T.O. RANGE", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var rud_trim_config = warning.new(msg: "CONFIG RUD TRIM", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var rud_trim_config_1 = warning.new(msg: " NOT IN T.O. RANGE", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var park_brk_config = warning.new(msg: "CONFIG PARK BRK ON", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0),
|
||||
var slats_config = warning.new(msg: "CONFIG", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
var slats_config_1 = warning.new(msg: "SLATS NOT IN T.O. CONFIG", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
var flaps_config = warning.new(msg: "CONFIG", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
var flaps_config_1 = warning.new(msg: "FLAPS NOT IN T.O. CONFIG", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
var spd_brk_config = warning.new(msg: "CONFIG", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
var spd_brk_config_1 = warning.new(msg: "SPD BRK NOT RETRACTED", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
var pitch_trim_config = warning.new(msg: "CONFIG PITCH TRIM", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
var pitch_trim_config_1 = warning.new(msg: " NOT IN T.O. RANGE", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
var rud_trim_config = warning.new(msg: "CONFIG RUD TRIM", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
var rud_trim_config_1 = warning.new(msg: " NOT IN T.O. RANGE", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
var park_brk_config = warning.new(msg: "CONFIG PARK BRK ON", active: 0, colour: "r", aural: 0, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
|
||||
# Autopilot
|
||||
var ap_offw = warning.new(msg: "AUTO FLT AP OFF", active: 0, colour: "r", aural: "calv", light: "warning", noRepeat: 0),
|
||||
var athr_offw = warning.new(msg: "AUTO FLT A/THR OFF", active: 0, colour: "a", aural: "chime", light: "caution", noRepeat: 0),
|
||||
var athr_offw_1 = warning.new(msg: "-THR LEVERS........MOVE", active: 0, colour: "b", aural: "none", light: "none", noRepeat: 0),
|
||||
var athr_lock = warning.new(msg: "ENG THRUST LOCKED", active: 0, colour: "a", aural: "chime", light: "caution", noRepeat: 0),
|
||||
var athr_lock_1 = warning.new(msg: "-THR LEVERS........MOVE", active: 0, colour: "b", aural: "none", light: "none", noRepeat: 0),
|
||||
var athr_lim = warning.new(msg: "AUTO FLT A/THR LIMITED", active: 0, colour: "a", aural: "chime", light: "caution", noRepeat: 0),
|
||||
var athr_lim_1 = warning.new(msg: "-THR LEVERS........MOVE", active: 0, colour: "b", aural: "none", light: "none", noRepeat: 0)
|
||||
var ap_offw = warning.new(msg: "AUTO FLT AP OFF", active: 0, colour: "r", aural: 9, light: 0, noRepeat: 0, clearFlag: 0),
|
||||
var athr_offw = warning.new(msg: "AUTO FLT A/THR OFF", active: 0, colour: "a", aural: 1, light: 1, noRepeat: 0, clearFlag: 0),
|
||||
var athr_offw_1 = warning.new(msg: "-THR LEVERS........MOVE", active: 0, colour: "b", aural: 9, light: 9, noRepeat: 0, clearFlag: 0),
|
||||
var athr_lock = warning.new(msg: "ENG THRUST LOCKED", active: 0, colour: "a", aural: 1, light: 1, noRepeat: 0, clearFlag: 0),
|
||||
var athr_lock_1 = warning.new(msg: "-THR LEVERS........MOVE", active: 0, colour: "b", aural: 9, light: 9, noRepeat: 0, clearFlag: 0),
|
||||
var athr_lim = warning.new(msg: "AUTO FLT A/THR LIMITED", active: 0, colour: "a", aural: 1, light: 1, noRepeat: 0, clearFlag: 0),
|
||||
var athr_lim_1 = warning.new(msg: "-THR LEVERS........MOVE", active: 0, colour: "b", aural: 9, light: 9, noRepeat: 0, clearFlag: 0)
|
||||
]);
|
||||
|
||||
var leftmemos = std.Vector.new([
|
||||
var company_alert = warning.new(msg: "COMPANY ALERT", active: 0, colour: "g", aural: "buzz", light: "none", noRepeat: 0), # Not yet implemented, buzzer sound
|
||||
var refuelg = warning.new(msg: "REFUELG", active: 0, colour: "g", aural: "none", light: "none", noRepeat: 0),
|
||||
var irs_in_align = warning.new(msg: "IRS IN ALIGN", active: 0, colour: "g", aural: "none", light: "none", noRepeat: 0), # Not yet implemented
|
||||
var gnd_splrs = warning.new(msg: "GND SPLRS ARMED", active: 0, colour: "g", aural: "none", light: "none", noRepeat: 0),
|
||||
var seatbelts = warning.new(msg: "SEAT BELTS", active: 0, colour: "g", aural: "none", light: "none", noRepeat: 0),
|
||||
var nosmoke = warning.new(msg: "NO SMOKING", active: 0, colour: "g", aural: "none", light: "none", noRepeat: 0),
|
||||
var strobe_lt_off = warning.new(msg: "STROBE LT OFF", active: 0, colour: "g", aural: "none", light: "none", noRepeat: 0),
|
||||
var outr_tk_fuel_xfrd = warning.new(msg: "OUTR TK FUEL XFRD", active: 0, colour: "g", aural: "none", light: "none", noRepeat: 0), # Not yet implemented
|
||||
var fob_3T = warning.new(msg: "FOB BELOW 3T", active: 0, colour: "g", aural: "none", light: "none", noRepeat: 0),
|
||||
var gpws_flap_mode_off = warning.new(msg: "GPWS FLAP MODE OFF", active: 0, colour: "g", aural: "none", light: "none", noRepeat: 0),
|
||||
var atc_datalink_stby = warning.new(msg: "ATC DATALINK STBY", active: 0, colour: "g", aural: "none", light: "none", noRepeat: 0), # Not yet implemented
|
||||
var company_datalink_stby = warning.new(msg: "COMPANY DATALINK STBY", active: 0, colour: "g", aural: "none", light: "none", noRepeat: 0) # Not yet implemented
|
||||
var company_alert = warning.new(msg: "COMPANY ALERT", active: 0, colour: "g", aural: 9, light: 9, noRepeat: 0, clearFlag: 0), # Not yet implemented, buzzer sound
|
||||
var refuelg = warning.new(msg: "REFUELG", active: 0, colour: "g", aural: 9, light: 9, noRepeat: 0, clearFlag: 0),
|
||||
var irs_in_align = warning.new(msg: "IRS IN ALIGN", active: 0, colour: "g", aural: 9, light: 9, noRepeat: 0, clearFlag: 0), # Not yet implemented
|
||||
var gnd_splrs = warning.new(msg: "GND SPLRS ARMED", active: 0, colour: "g", aural: 9, light: 9, noRepeat: 0, clearFlag: 0),
|
||||
var seatbelts = warning.new(msg: "SEAT BELTS", active: 0, colour: "g", aural: 9, light: 9, noRepeat: 0, clearFlag: 0),
|
||||
var nosmoke = warning.new(msg: "NO SMOKING", active: 0, colour: "g", aural: 9, light: 9, noRepeat: 0, clearFlag: 0),
|
||||
var strobe_lt_off = warning.new(msg: "STROBE LT OFF", active: 0, colour: "g", aural: 9, light: 9, noRepeat: 0, clearFlag: 0),
|
||||
var outr_tk_fuel_xfrd = warning.new(msg: "OUTR TK FUEL XFRD", active: 0, colour: "g", aural: 9, light: 9, noRepeat: 0, clearFlag: 0), # Not yet implemented
|
||||
var fob_3T = warning.new(msg: "FOB BELOW 3T", active: 0, colour: "g", aural: 9, light: 9, noRepeat: 0, clearFlag: 0),
|
||||
var gpws_flap_mode_off = warning.new(msg: "GPWS FLAP MODE OFF", active: 0, colour: "g", aural: 9, light: 9, noRepeat: 0, clearFlag: 0),
|
||||
var atc_datalink_stby = warning.new(msg: "ATC DATALINK STBY", active: 0, colour: "g", aural: 9, light: 9, noRepeat: 0, clearFlag: 0), # Not yet implemented
|
||||
var company_datalink_stby = warning.new(msg: "COMPANY DATALINK STBY", active: 0, colour: "g", aural: 9, light: 9, noRepeat: 0, clearFlag: 0) # Not yet implemented
|
||||
]);
|
||||
|
||||
# Right E/WD
|
||||
|
|
Reference in a new issue