diff --git a/Models/Instruments/MCDU/MCDU1.xml b/Models/Instruments/MCDU/MCDU1.xml
index 2133e61a..54116e98 100644
--- a/Models/Instruments/MCDU/MCDU1.xml
+++ b/Models/Instruments/MCDU/MCDU1.xml
@@ -1678,7 +1678,7 @@
overfly
- true
+ false
nasal
@@ -1703,11 +1703,23 @@
true
+
+ property-adjust
+ /MCDU[0]/clrbtn-timeout
+ 1
+ 0
+ 6
+ false
+
nasal
-
+
+
+ /MCDU[0]/clrbtn-timeout
+ 5
+
systems/electrical/bus/ac-1
110
@@ -1718,17 +1730,21 @@
-
+
nasal
-
+
+
+ /MCDU[0]/clrbtn-timeout
+ 5
+
systems/electrical/bus/ac-1
110
-
+
controls/lighting/DU/mcdu1
0.01
@@ -1736,6 +1752,11 @@
+
+ property-assign
+ /MCDU[0]/clrbtn-timeout
+ 0
+
diff --git a/Models/Instruments/MCDU/MCDU2.xml b/Models/Instruments/MCDU/MCDU2.xml
index d49c0a8d..6da38c5c 100644
--- a/Models/Instruments/MCDU/MCDU2.xml
+++ b/Models/Instruments/MCDU/MCDU2.xml
@@ -1678,7 +1678,7 @@
overfly
- true
+ false
nasal
@@ -1703,32 +1703,48 @@
true
+
+ property-adjust
+ /MCDU[1]/clrbtn-timeout
+ 1
+ 0
+ 6
+ false
+
nasal
-
+
+
+ /MCDU[1]/clrbtn-timeout
+ 5
+
systems/electrical/bus/ac-2
110
-
+
controls/lighting/DU/mcdu2
0.01
-
+
nasal
-
+
+
+ /MCDU[1]/clrbtn-timeout
+ 5
+
systems/electrical/bus/ac-2
110
-
+
controls/lighting/DU/mcdu2
0.01
@@ -1736,6 +1752,11 @@
+
+ property-assign
+ /MCDU[1]/clrbtn-timeout
+ 0
+
diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas
index 2ecd3c93..160b8831 100644
--- a/Nasal/MCDU/MCDU.nas
+++ b/Nasal/MCDU/MCDU.nas
@@ -1499,8 +1499,6 @@ var pagebutton = func(btn, i) {
}
}
-var buttonCLRDown = [0,0]; # counter for down event
-
var button = func(btn, i, event = "") {
page = pageNode[i].getValue();
if (page != "MCDU") {
@@ -1510,41 +1508,32 @@ var button = func(btn, i, event = "") {
} else if (btn == "SP") {
mcdu_scratchpad.scratchpads[i].addChar(" ");
} else if (btn == "CLR") {
- if (event == "down") {
- if (size(scratchpad) > 0) {
- if (buttonCLRDown[i] > 4) {
- mcdu_scratchpad.scratchpads[i].empty();
- }
- buttonCLRDown[i] = buttonCLRDown[i] + 1;
- }
- }
- else if (event == "" or buttonCLRDown[i]<=4) {
- buttonCLRDown[i] = 0;
- #var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; <- useless??
- if (size(scratchpad) == 0) {
- mcdu_scratchpad.scratchpads[i].addChar("CLR");
- } else {
- mcdu_scratchpad.scratchpads[i].clear();
- }
- } else { # up with buttonCLRDown[i]>4
- buttonCLRDown[i] = 0;
+ if (size(scratchpad) == 0) {
+ mcdu_scratchpad.scratchpads[i].addChar("CLR");
+ } else {
+ mcdu_scratchpad.scratchpads[i].clear();
}
} else if (btn == "LONGCLR") {
mcdu_scratchpad.scratchpads[i].empty();
} else if (btn == "DOT") {
mcdu_scratchpad.scratchpads[i].addChar(".");
} else if (btn == "PLUSMINUS") {
- if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "-") {
- mcdu_scratchpad.scratchpads[i].clear();
- mcdu_scratchpad.scratchpads[i].addChar("+");
- } else if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "+") {
- mcdu_scratchpad.scratchpads[i].clear();
+ if (size(scratchpad)==0) {
+ mcdu_message(i, "NOT ALLOWED");
+ } else if (isint(scratchpad)==1) {
mcdu_scratchpad.scratchpads[i].addChar("-");
} else {
- mcdu_scratchpad.scratchpads[i].addChar("-");
+ var _toggle = right(scratchpad,1);
+ if (find(_toggle,"-+")!=-1) {
+ _toggle = (_toggle == "-") ? "+" : "-";
+ mcdu_scratchpad.scratchpads[i].clear();
+ mcdu_scratchpad.scratchpads[i].addChar(_toggle);
+ } else {
+ mcdu_message(i, "NOT ALLOWED");
+ }
}
} else if (btn == "OVFY") {
- if (mcdu_scratchpad.scratchpads[i].scratchpad == "") {
+ if (size(scratchpad)==0) {
mcdu_scratchpad.scratchpads[i].addChar("@");
} else {
mcdu_message(i, "NOT ALLOWED");