bugfix, overflow

This commit is contained in:
Jonathan Redpath 2018-11-22 12:56:28 +00:00
parent eb0cd03926
commit 1265546766

View file

@ -16,6 +16,8 @@ setprop("/ECAM/show-right-msg", 1);
setprop("/ECAM/warnings/master-warning-light", 0); setprop("/ECAM/warnings/master-warning-light", 0);
setprop("/ECAM/warnings/master-caution-light", 0); setprop("/ECAM/warnings/master-caution-light", 0);
setprop("/ECAM/warnings/overflow", 0); setprop("/ECAM/warnings/overflow", 0);
setprop("/ECAM/warnings/overflow-left", 0);
setprop("/ECAM/warnings/overflow-right", 0);
var warning = { var warning = {
msg: "", msg: "",
@ -43,10 +45,12 @@ var warning = {
} }
if (line > 8) { if (line > 8) {
setprop("/ECAM/warnings/overflow", 1); setprop("/ECAM/warnings/overflow-left", 1);
} elsif (getprop("/ECAM/warnings/overflow-left") == 1) {
setprop("/ECAM/warnings/overflow-left", 0);
} }
if (getprop("/ECAM/msg/line" ~ line) == "" and me.active == 1 and me.msg != "") { # at empty line. Also checks if message is not blank to allow for some warnings with no displayed msg, eg stall 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/line" ~ line, me.msg);
setprop("/ECAM/msg/linec" ~ line, me.colour); setprop("/ECAM/msg/linec" ~ line, me.colour);
} }
@ -88,10 +92,12 @@ var memo = {
} }
if (right_line > 8) { if (right_line > 8) {
setprop("/ECAM/warnings/overflow", 1); setprop("/ECAM/warnings/overflow-right", 1);
} elsif (getprop("/ECAM/warnings/overflow-right") == 1) {
setprop("/ECAM/warnings/overflow-right", 0);
} }
if (getprop("/ECAM/rightmsg/line" ~ right_line) == "" and me.active == 1) { # at empty line if (getprop("/ECAM/rightmsg/line" ~ right_line) == "" and me.active == 1 and right_line <= 8) { # at empty line
setprop("/ECAM/rightmsg/line" ~ right_line, me.msg); setprop("/ECAM/rightmsg/line" ~ right_line, me.msg);
setprop("/ECAM/rightmsg/linec" ~ right_line, me.colour); setprop("/ECAM/rightmsg/linec" ~ right_line, me.colour);
} }
@ -146,6 +152,12 @@ var ECAM_controller = {
foreach (var m; memos.vector) { foreach (var m; memos.vector) {
m.write(); m.write();
} }
if (getprop("/ECAM/warnings/overflow-left") == 1 or getprop("/ECAM/warnings/overflow-right") == 1) {
setprop("/ECAM/warnings/overflow", 1);
} elsif (getprop("/ECAM/warnings/overflow-left") == 0 and getprop("/ECAM/warnings/overflow-right") == 0) {
setprop("/ECAM/warnings/overflow", 0);
}
}, },
}; };