Better long pressed CLR and check numeric format on plus/minus
This commit is contained in:
parent
15221a3e20
commit
871c645fba
3 changed files with 69 additions and 38 deletions
|
@ -1678,7 +1678,7 @@
|
||||||
<object-name>overfly</object-name>
|
<object-name>overfly</object-name>
|
||||||
<action>
|
<action>
|
||||||
<button>0</button>
|
<button>0</button>
|
||||||
<repeatable>true</repeatable>
|
<repeatable>false</repeatable>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>mcdu.button("OVFY", 0);</script>
|
<script>mcdu.button("OVFY", 0);</script>
|
||||||
|
@ -1703,11 +1703,23 @@
|
||||||
<action>
|
<action>
|
||||||
<button>0</button>
|
<button>0</button>
|
||||||
<repeatable>true</repeatable>
|
<repeatable>true</repeatable>
|
||||||
|
<binding>
|
||||||
|
<command>property-adjust</command>
|
||||||
|
<property>/MCDU[0]/clrbtn-timeout</property>
|
||||||
|
<step>1</step>
|
||||||
|
<min>0</min>
|
||||||
|
<max>6</max>
|
||||||
|
<wrap>false</wrap>
|
||||||
|
</binding>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>mcdu.button("CLR", 0, "down");</script>
|
<script>mcdu.button("LONGCLR", 0);</script>
|
||||||
<condition>
|
<condition>
|
||||||
<and>
|
<and>
|
||||||
|
<equals>
|
||||||
|
<property>/MCDU[0]/clrbtn-timeout</property>
|
||||||
|
<value>5</value>
|
||||||
|
</equals>
|
||||||
<greater-than-equals>
|
<greater-than-equals>
|
||||||
<property>systems/electrical/bus/ac-1</property>
|
<property>systems/electrical/bus/ac-1</property>
|
||||||
<value>110</value>
|
<value>110</value>
|
||||||
|
@ -1718,17 +1730,21 @@
|
||||||
</greater-than>
|
</greater-than>
|
||||||
</and>
|
</and>
|
||||||
</condition>
|
</condition>
|
||||||
</binding>
|
</binding>
|
||||||
<mod-up>
|
<mod-up>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>mcdu.button("CLR", 0, "up");</script>
|
<script>mcdu.button("CLR", 0);</script>
|
||||||
<condition>
|
<condition>
|
||||||
<and>
|
<and>
|
||||||
|
<less-than>
|
||||||
|
<property>/MCDU[0]/clrbtn-timeout</property>
|
||||||
|
<value>5</value>
|
||||||
|
</less-than>
|
||||||
<greater-than-equals>
|
<greater-than-equals>
|
||||||
<property>systems/electrical/bus/ac-1</property>
|
<property>systems/electrical/bus/ac-1</property>
|
||||||
<value>110</value>
|
<value>110</value>
|
||||||
</greater-than-equals>
|
</greater-than-equals>
|
||||||
<greater-than>
|
<greater-than>
|
||||||
<property>controls/lighting/DU/mcdu1</property>
|
<property>controls/lighting/DU/mcdu1</property>
|
||||||
<value>0.01</value>
|
<value>0.01</value>
|
||||||
|
@ -1736,6 +1752,11 @@
|
||||||
</and>
|
</and>
|
||||||
</condition>
|
</condition>
|
||||||
</binding>
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<command>property-assign</command>
|
||||||
|
<property>/MCDU[0]/clrbtn-timeout</property>
|
||||||
|
<value>0</value>
|
||||||
|
</binding>
|
||||||
</mod-up>
|
</mod-up>
|
||||||
</action>
|
</action>
|
||||||
</animation>
|
</animation>
|
||||||
|
|
|
@ -1678,7 +1678,7 @@
|
||||||
<object-name>overfly</object-name>
|
<object-name>overfly</object-name>
|
||||||
<action>
|
<action>
|
||||||
<button>0</button>
|
<button>0</button>
|
||||||
<repeatable>true</repeatable>
|
<repeatable>false</repeatable>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>mcdu.button("OVFY", 1);</script>
|
<script>mcdu.button("OVFY", 1);</script>
|
||||||
|
@ -1703,32 +1703,48 @@
|
||||||
<action>
|
<action>
|
||||||
<button>0</button>
|
<button>0</button>
|
||||||
<repeatable>true</repeatable>
|
<repeatable>true</repeatable>
|
||||||
|
<binding>
|
||||||
|
<command>property-adjust</command>
|
||||||
|
<property>/MCDU[1]/clrbtn-timeout</property>
|
||||||
|
<step>1</step>
|
||||||
|
<min>0</min>
|
||||||
|
<max>6</max>
|
||||||
|
<wrap>false</wrap>
|
||||||
|
</binding>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>mcdu.button("CLR", 1, "down");</script>
|
<script>mcdu.button("LONGCLR", 1);</script>
|
||||||
<condition>
|
<condition>
|
||||||
<and>
|
<and>
|
||||||
|
<equals>
|
||||||
|
<property>/MCDU[1]/clrbtn-timeout</property>
|
||||||
|
<value>5</value>
|
||||||
|
</equals>
|
||||||
<greater-than-equals>
|
<greater-than-equals>
|
||||||
<property>systems/electrical/bus/ac-2</property>
|
<property>systems/electrical/bus/ac-2</property>
|
||||||
<value>110</value>
|
<value>110</value>
|
||||||
</greater-than-equals>
|
</greater-than-equals>
|
||||||
<greater-than>
|
<greater-than>
|
||||||
<property>controls/lighting/DU/mcdu2</property>
|
<property>controls/lighting/DU/mcdu2</property>
|
||||||
<value>0.01</value>
|
<value>0.01</value>
|
||||||
</greater-than>
|
</greater-than>
|
||||||
</and>
|
</and>
|
||||||
</condition>
|
</condition>
|
||||||
</binding>
|
</binding>
|
||||||
<mod-up>
|
<mod-up>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>mcdu.button("CLR", 1, "up");</script>
|
<script>mcdu.button("CLR", 1);</script>
|
||||||
<condition>
|
<condition>
|
||||||
<and>
|
<and>
|
||||||
|
<less-than>
|
||||||
|
<property>/MCDU[1]/clrbtn-timeout</property>
|
||||||
|
<value>5</value>
|
||||||
|
</less-than>
|
||||||
<greater-than-equals>
|
<greater-than-equals>
|
||||||
<property>systems/electrical/bus/ac-2</property>
|
<property>systems/electrical/bus/ac-2</property>
|
||||||
<value>110</value>
|
<value>110</value>
|
||||||
</greater-than-equals>
|
</greater-than-equals>
|
||||||
<greater-than>
|
<greater-than>
|
||||||
<property>controls/lighting/DU/mcdu2</property>
|
<property>controls/lighting/DU/mcdu2</property>
|
||||||
<value>0.01</value>
|
<value>0.01</value>
|
||||||
|
@ -1736,6 +1752,11 @@
|
||||||
</and>
|
</and>
|
||||||
</condition>
|
</condition>
|
||||||
</binding>
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<command>property-assign</command>
|
||||||
|
<property>/MCDU[1]/clrbtn-timeout</property>
|
||||||
|
<value>0</value>
|
||||||
|
</binding>
|
||||||
</mod-up>
|
</mod-up>
|
||||||
</action>
|
</action>
|
||||||
</animation>
|
</animation>
|
||||||
|
|
|
@ -1499,8 +1499,6 @@ var pagebutton = func(btn, i) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var buttonCLRDown = [0,0]; # counter for down event
|
|
||||||
|
|
||||||
var button = func(btn, i, event = "") {
|
var button = func(btn, i, event = "") {
|
||||||
page = pageNode[i].getValue();
|
page = pageNode[i].getValue();
|
||||||
if (page != "MCDU") {
|
if (page != "MCDU") {
|
||||||
|
@ -1510,41 +1508,32 @@ var button = func(btn, i, event = "") {
|
||||||
} else if (btn == "SP") {
|
} else if (btn == "SP") {
|
||||||
mcdu_scratchpad.scratchpads[i].addChar(" ");
|
mcdu_scratchpad.scratchpads[i].addChar(" ");
|
||||||
} else if (btn == "CLR") {
|
} else if (btn == "CLR") {
|
||||||
if (event == "down") {
|
if (size(scratchpad) == 0) {
|
||||||
if (size(scratchpad) > 0) {
|
mcdu_scratchpad.scratchpads[i].addChar("CLR");
|
||||||
if (buttonCLRDown[i] > 4) {
|
} else {
|
||||||
mcdu_scratchpad.scratchpads[i].empty();
|
mcdu_scratchpad.scratchpads[i].clear();
|
||||||
}
|
|
||||||
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") {
|
} else if (btn == "LONGCLR") {
|
||||||
mcdu_scratchpad.scratchpads[i].empty();
|
mcdu_scratchpad.scratchpads[i].empty();
|
||||||
} else if (btn == "DOT") {
|
} else if (btn == "DOT") {
|
||||||
mcdu_scratchpad.scratchpads[i].addChar(".");
|
mcdu_scratchpad.scratchpads[i].addChar(".");
|
||||||
} else if (btn == "PLUSMINUS") {
|
} else if (btn == "PLUSMINUS") {
|
||||||
if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "-") {
|
if (size(scratchpad)==0) {
|
||||||
mcdu_scratchpad.scratchpads[i].clear();
|
mcdu_message(i, "NOT ALLOWED");
|
||||||
mcdu_scratchpad.scratchpads[i].addChar("+");
|
} else if (isint(scratchpad)==1) {
|
||||||
} else if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "+") {
|
|
||||||
mcdu_scratchpad.scratchpads[i].clear();
|
|
||||||
mcdu_scratchpad.scratchpads[i].addChar("-");
|
mcdu_scratchpad.scratchpads[i].addChar("-");
|
||||||
} else {
|
} 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") {
|
} else if (btn == "OVFY") {
|
||||||
if (mcdu_scratchpad.scratchpads[i].scratchpad == "") {
|
if (size(scratchpad)==0) {
|
||||||
mcdu_scratchpad.scratchpads[i].addChar("@");
|
mcdu_scratchpad.scratchpads[i].addChar("@");
|
||||||
} else {
|
} else {
|
||||||
mcdu_message(i, "NOT ALLOWED");
|
mcdu_message(i, "NOT ALLOWED");
|
||||||
|
|
Loading…
Reference in a new issue