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