1
0
Fork 0

When changing the transponder code, write it to the property tree.

This commit is contained in:
Sebastian Dietrich 2016-04-10 00:05:25 +02:00
parent 4bc3619fdb
commit 671c23afdc

View file

@ -26,6 +26,18 @@
}
}
var updateTransponderCode = func {
var goodcode = 1;
var code = 0;
for (var i = 3; i >= 0 ; i -= 1)
{
goodcode = goodcode and (num(getprop("/instrumentation/transponder/inputs/digit[" ~ i ~ "]")) != nil) ;
code = code * 10 + (num(getprop("/instrumentation/transponder/inputs/digit[" ~ i ~ "]")) or 0);
}
setprop('/instrumentation/transponder/goodcode', goodcode);
setprop('/instrumentation/transponder/id-code', code);
}
]]>
</open>
</nasal>
@ -630,6 +642,14 @@
<command>dialog-apply</command>
<object-name>Tponder-1</object-name>
</binding>
<binding>
<command>nasal</command>
<script>
<![CDATA[
updateTransponderCode();
]]>
</script>
</binding>
</combo>
<!-- -->
<combo>
@ -650,6 +670,14 @@
<command>dialog-apply</command>
<object-name>Tponder-2</object-name>
</binding>
<binding>
<command>nasal</command>
<script>
<![CDATA[
updateTransponderCode();
]]>
</script>
</binding>
</combo>
<combo>
<name>Tponder-3</name>
@ -669,6 +697,14 @@
<command>dialog-apply</command>
<object-name>Tponder-3</object-name>
</binding>
<binding>
<command>nasal</command>
<script>
<![CDATA[
updateTransponderCode();
]]>
</script>
</binding>
</combo>
<combo>
<name>Tponder-4</name>
@ -688,6 +724,14 @@
<command>dialog-apply</command>
<object-name>Tponder-4</object-name>
</binding>
<binding>
<command>nasal</command>
<script>
<![CDATA[
updateTransponderCode();
]]>
</script>
</binding>
</combo>
<empty>