Add autothrottle warning. AP warning there too, not tested. Need to make single chime with ctrl + d key though.

This commit is contained in:
Jonathan Redpath 2018-12-05 15:27:42 +00:00
parent 3062c8f7cc
commit 6666d941ab
11 changed files with 167 additions and 64 deletions

View file

@ -10,7 +10,7 @@
<sim>
<author>it0uchpods Design Group: Joshua Davidson (it0uchpods), Jonathan Redpath (legoboyvdlp), Thorsten Herrmann (TH-555)</author>
<author></author>
<status>Pre V1.0</status>
@ -1070,9 +1070,13 @@
<script>
if (getprop("/it-autoflight/output/athr") == 1) {
setprop("/it-autoflight/input/athr", 0);
}
if (libraries.athr_active == 1) {
libraries.athr_active = 0;
libraries.athrOff("soft");
} else {
if (getprop("/it-autoflight/output/athr-warning") == 1) {
setprop("/it-autoflight/output/athr-warning", 0);
}
setprop("/ECAM/warnings/master-caution-light", 1);
}
</script>
</binding>
@ -1314,17 +1318,16 @@
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/output/ap1") == 1) {
setprop("/it-autoflight/input/ap1", 0);
}
if (getprop("/it-autoflight/output/ap2") == 1) {
setprop("/it-autoflight/input/ap2", 0);
}
if (libraries.ap1_active == 1) {
libraries.ap1_active = 0;
}
if (libraries.ap2_active == 1) {
libraries.ap2_active = 0;
if (getprop("/it-autoflight/output/ap1") == 1 or getprop("/it-autoflight/output/ap2") == 1) {
if (getprop("/it-autoflight/output/ap1") == 1) {
setprop("/it-autoflight/input/ap1", 0);
}
if (getprop("/it-autoflight/output/ap2") == 1) {
setprop("/it-autoflight/input/ap2", 0);
}
libraries.apOff("soft","B");
} else {
setprop("/it-autoflight/output/ap-warning", 0);
}
</script>
</binding>

View file

@ -4053,6 +4053,10 @@
<command>nasal</command>
<script>setprop("/sim/sounde/btn1", 1);</script>
</binding>
<binding>
<command>nasal</command>
<script>libraries.apOff("hard","L");</script>
</binding>
</action>
</animation>
<animation>
@ -4086,6 +4090,10 @@
<command>nasal</command>
<script>setprop("/sim/sounde/btn1", 1);</script>
</binding>
<binding>
<command>nasal</command>
<script>libraries.apOff("hard","R");</script>
</binding>
</action>
</animation>
<animation>
@ -4119,6 +4127,10 @@
<command>nasal</command>
<script>setprop("/sim/sounde/btn1", 1);</script>
</binding>
<binding>
<command>nasal</command>
<script>libraries.athrOff("hard");</script>
</binding>
</action>
</animation>
<animation>
@ -5099,6 +5111,20 @@
<property>ECAM/warnings/master-caution-light</property>
<value>0</value>
</binding>
<binding>
<condition>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
</condition>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/output/athr-warning") == 1) {
setprop("/it-autoflight/output/athr-warning", 0);
}
</script>
</binding>
</action>
</animation>

View file

@ -42,8 +42,7 @@ var ENGCounting = 0;
var flapLever = 0;
var CRZTime = 0;
var CRZCondition = 0;
var ap1_active = 0;
var ap2_active = 0;
var ap_active = 0;
var athr_active = 0;
setprop("/ECAM/left-msg", "NONE");
setprop("/position/gear-agl-ft", 0);
@ -79,11 +78,11 @@ var ECAM = {
setprop("/ECAM/Lower/light/clr", 0);
setprop("/ECAM/warning-phase", 1);
setprop("/ECAM/warning-phase-10-time", 0);
setprop("/ECAM/ap1-off-time", 0);
setprop("/ECAM/ap2-off-time", 0);
setprop("/ECAM/ap-off-time", 0);
setprop("/ECAM/athr-off-time", 0);
var ap1_off_time = getprop("/ECAM/ap1-off-time");
var ap2_off_time = getprop("/ECAM/ap2-off-time");
setprop("/it-autoflight/output/ap-warning", 0);
setprop("/it-autoflight/output/athr-warning", 0);
var ap_off_time = getprop("/ECAM/ap-off-time");
var athr_off_time = getprop("/ECAM/athr-off-time");
LowerECAM.reset();
},
@ -198,18 +197,31 @@ var ECAM = {
}
# AP / ATHR warnings
if (ap1_active == 1 and getprop("/it-autoflight/input/ap1") == 0 and (getprop("/ECAM/ap1-off-time") + 9 < getprop("/sim/time/elapsed-sec"))) {
ap1_active = 0;
# No evidence found that re-engagement disconnects warnings - if anyone has any evidence to the contrary let me know
if (ap_active == 1 and getprop("/it-autoflight/output/ap-warning") == 0) {
ap_active = 0;
} elsif (ap_active == 1 and getprop("/it-autoflight/output/ap-warning") == 1 and getprop("/sim/time/elapsed-sec") > (getprop("/ECAM/ap-off-time") + 9)) {
ap_active = 0;
setprop("/it-autoflight/output/ap-warning", 0);
} elsif (ap_active == 0 and getprop("/it-autoflight/output/ap-warning") != 0) {
ap_active = 1;
}
if (ap2_active == 1 and getprop("/it-autoflight/input/ap2") == 0 and (getprop("/ECAM/ap2-off-time") + 9 < getprop("/sim/time/elapsed-sec"))) {
ap2_active = 0;
}
if (athr_active == 1 and getprop("/it-autoflight/input/athr") == 0 and (getprop("/ECAM/athr-off-time") + 9 < getprop("/sim/time/elapsed-sec"))) {
if (athr_active == 1 and getprop("/it-autoflight/output/athr-warning") == 0) {
athr_active = 0;
} elsif (athr_active == 1 and getprop("/it-autoflight/output/athr-warning") == 1 and getprop("/sim/time/elapsed-sec") > (getprop("/ECAM/athr-off-time") + 9)) {
athr_active = 0;
setprop("/it-autoflight/output/athr-warning", 0);
} elsif (athr_active == 0 and getprop("/it-autoflight/output/athr-warning") != 0) {
athr_active = 1;
}
if (athr_active == 1 and getprop("/it-autoflight/output/athr-warning") == 1 and getprop("/sim/time/elapsed-sec") > (getprop("/ECAM/athr-off-time") + 3) and getprop("/ECAM/warnings/master-caution-light") == 1) {
setprop("/ECAM/warnings/master-caution-light", 0);
}
# Warning Phases
if (getprop("/systems/electrical/bus/ac1") < 110 and getprop("/systems/electrical/bus/ac2") < 110 and getprop("/systems/electrical/bus/ac-ess") < 110) { # Reset warning phases
if (getprop("/ECAM/warning-phase") != 1) {
@ -269,6 +281,12 @@ ECAM.MSGclr();
var LowerECAM = {
button: func(b) {
man_sel = getprop("/ECAM/Lower/man-select");
if (b == "clr" and getprop("/it-autoflight/output/athr-warning") == 2) {
setprop("/it-autoflight/output/athr-warning", 0);
setprop("/ECAM/Lower/light/clr", 0);
setprop("/ECAM/warnings/master-caution-light", 0);
#call status
}
if (getprop("/ECAM/Lower/fault-select") == 0) {
if (b != "clr") {
@ -481,29 +499,7 @@ var LowerECAM = {
setprop("/ECAM/Lower/page", page);
setprop("/ECAM/Lower/light/clr", 1);
},
};
# Logic for autopilot disconnect warning
setlistener("/it-autoflight/input/ap1", func {
if (getprop("/it-autoflight/input/ap1") == 0) {
ap1_active = 1;
setprop("/ECAM/ap1-off-time", getprop("/sim/time/elapsed-sec"));
clrLight: func() {
setprop("/ECAM/Lower/light/clr", 1);
}
}, 0, 0);
setlistener("/it-autoflight/input/ap2", func {
if (getprop("/it-autoflight/input/ap2") == 0) {
ap2_active = 1;
setprop("/ECAM/ap2-off-time", getprop("/sim/time/elapsed-sec"));
}
}, 0, 0);
setlistener("/it-autoflight/input/athr", func {
if (getprop("/it-autoflight/input/athr") == 0) {
if (getprop("/position/gear-agl-ft") > 50) {
athr_active = 1;
setprop("/ECAM/athr-off-time", getprop("/sim/time/elapsed-sec"));
}
}
}, 0, 0);
};

View file

@ -138,7 +138,7 @@ var ECAM_controller = {
# check active messages
# config_warnings();
# messages_priority_3();
# messages_priority_2();
messages_priority_2();
# messages_priority_1();
# messages_priority_0();
messages_memo();
@ -157,14 +157,16 @@ var ECAM_controller = {
# write to ECAM
# foreach (var w; warnings.vector) {
# w.write();
# w.warnlight();
# w.sound();
# }
foreach (var w; warnings.vector) {
w.write();
w.warnlight();
w.sound();
}
foreach (var l; leftmemos.vector) {
l.write();
if (getprop("/ECAM/msg/line1") == "") { # disable left memos if a warning exists. Warnings are processed first, so this stops leftmemos if line1 is not empty
foreach (var l; leftmemos.vector) {
l.write();
}
}
foreach (var sL; specialLines.vector) {

View file

@ -15,7 +15,30 @@ var messages_priority_3 = func {
setprop("/systems/gear/landing-gear-warning-light", 0);
}
}
var messages_priority_2 = func {
if ((getprop("/ECAM/warning-phase") >= 5 and getprop("/ECAM/warning-phase") <= 7) and getprop("/it-autoflight/thr-locked") == 1) {
athr_lock.active = 1;
athr_lock_1.active = 1;
} else {
athr_lock.active = 0;
athr_lock_1.active = 0;
athr_lock.noRepeat = 0;
athr_lock_1.noRepeat = 0;
}
if (getprop("/it-autoflight/output/athr-warning") == 2 and getprop("/ECAM/warning-phase") != 4 and getprop("/ECAM/warning-phase") != 8 and getprop("/ECAM/warning-phase") != 10) {
athr_offw.active = 1;
athr_offw_1.active = 1;
} else {
athr_offw.active = 0;
athr_offw_1.active = 0;
athr_offw.noRepeat = 0;
athr_offw_1.noRepeat = 0;
}
}
var messages_priority_2_old = func {
if ((((getprop("/ECAM/warning-phase") >= 1 and getprop("/ECAM/warning-phase") <= 2) or (getprop("/ECAM/warning-phase") >= 9 and getprop("/ECAM/warning-phase") <= 10) and (wow and getprop("/engines/engine[0]/state") == 3)) or getprop("/ECAM/warning-phase") == 6) and getprop("/systems/failures/pack1") == 1) {
pack1_fault.active = 1;
} else {
@ -132,7 +155,7 @@ var messages_right_memo = func {
land_asap_a.active = 0;
}
if (libraries.ap1_active == 1 or libraries.ap2_active == 1) {
if (libraries.ap_active == 1) {
ap_off.active = 1;
} else {
ap_off.active = 0;

View file

@ -8,7 +8,7 @@
# messages stored in vectors
# Left E/WD
var warnings = std.Vector.new([
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),
@ -17,6 +17,13 @@ var warnings = std.Vector.new([
var park_brk_on = warning.new(msg: "PARK BRK ON", active: 0, colour: "a", aural: "chime", light: "caution", noRepeat: 0)
]);
var warnings = std.Vector.new([
var athr_lock = warning.new(msg: "ENG THRUST LOCKED", active: 0, colour: "a", aural: "chime", light: "caution", noRepeat: 0),var athr_off_1 = warning.new(msg: "-THR LEVERS........MOVE", active: 0, colour: "c", aural: "none", light: "none", noRepeat: 0),
var athr_lock_1 = warning.new(msg: "-THR LEVERS........MOVE", active: 0, colour: "b", aural: "none", light: "none", 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 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),

View file

@ -170,7 +170,7 @@ setlistener("/it-autoflight/input/athr", func {
var atmas = getprop("/it-autoflight/input/athr");
if (atmas == 0) {
setprop("/it-autoflight/output/athr", 0);
if (getprop("/it-autoflight/sound/enableathrsound") == 1 and getprop("/it-autoflight/output/athr") == 0 and getprop("/position/gear-agl-ft") > 50) {
if (getprop("/it-autoflight/sound/enableathrsound") == 1 and getprop("/it-autoflight/output/athr-warning") == 1 and getprop("/it-autoflight/output/athr") == 0 and getprop("/position/gear-agl-ft") > 50) {
setprop("/it-autoflight/sound/athrsound", 1);
setprop("/it-autoflight/sound/enableathrsound", 0);
}
@ -640,6 +640,7 @@ var ap_various = func {
if (getprop("/controls/flight/aileron") > 0.2 or getprop("/controls/flight/aileron") < -0.2 or getprop("/controls/flight/elevator") > 0.2 or getprop("/controls/flight/elevator") < -0.2) {
setprop("/it-autoflight/input/ap1", 0);
setprop("/it-autoflight/input/ap2", 0);
libraries.apOff("hard", "B");
}
}
}

View file

@ -251,3 +251,32 @@ var decreaseManVS = func {
setprop("/systems/pressurization/outflowpos-man", manvs - 0.001);
}
}
var apOff = func(type, side) {
if ((side == "L" and getprop("/it-autoflight/input/ap1") == 1) or (side == "R" and getprop("/it-autoflight/input/ap2") == 1)) {
setprop("/it-autoflight/output/ap-warning", 0);
return;
}
if (type == "soft") {
setprop("/ECAM/ap-off-time", getprop("/sim/time/elapsed-sec"));
setprop("/it-autoflight/output/ap-warning", 1);
} else {
setprop("/it-autoflight/output/ap-warning", 2);
}
}
var athrOff = func(type) {
if (getprop("it-autoflight/input/athr") == 1) {
setprop("/it-autoflight/output/athr-warning", 0);
return;
}
if (type == "soft") {
setprop("/ECAM/athr-off-time", getprop("/sim/time/elapsed-sec"));
setprop("/it-autoflight/output/athr-warning", 1);
} else {
libraries.LowerECAM.clrLight();
setprop("/it-autoflight/output/athr-warning", 2);
}
setprop("/ECAM/warnings/master-caution-light", 1);
}

View file

@ -197,6 +197,9 @@ var atoff_request = func {
state2 = getprop("/systems/thrust/state2");
if ((state1 == "IDLE") and (state2 == "IDLE") and (getprop("/systems/thrust/alpha-floor") == 0) and (getprop("/systems/thrust/toga-lk") == 0)) {
setprop("/it-autoflight/input/athr", 0);
if (getprop("/it-autoflight/output/athr") == 0 and getprop("/position/gear-agl-ft") > 50) {
libraries.athrOff("soft");
}
}
}

View file

@ -216,6 +216,7 @@ var update_loop = func {
if (getprop("/it-autoflight/output/ap2") == 1) {
setprop("/it-autoflight/input/ap2", 0);
}
libraries.apOff("hard", "B");
} else {
if (getprop("/it-fbw/protections/overspeed") != 0) {
setprop("/it-fbw/protections/overspeed", 0);

View file

@ -44,6 +44,10 @@
<command>property-toggle</command>
<property>/it-autoflight/input/athr</property>
</binding>
<binding>
<command>nasal</command>
<script>libraries.athrOff("hard");</script>
</binding>
</button>
<button>
<legend>AP1</legend>
@ -52,6 +56,10 @@
<command>property-toggle</command>
<property>/it-autoflight/input/ap1</property>
</binding>
<binding>
<command>nasal</command>
<script>libraries.apOff("hard","L");</script>
</binding>
</button>
<button>
<legend>AP2</legend>
@ -60,6 +68,10 @@
<command>property-toggle</command>
<property>/it-autoflight/input/ap2</property>
</binding>
<binding>
<command>nasal</command>
<script>libraries.apOff("hard","R");</script>
</binding>
</button>
<button>
<legend>FD1</legend>