GoFlight MCP and EFIS input configs
This commit is contained in:
parent
4d402914b1
commit
363dc4cea5
3 changed files with 792 additions and 460 deletions
|
@ -1,23 +1,70 @@
|
||||||
<PropertyList>
|
<PropertyList>
|
||||||
|
|
||||||
<name>GoFlight GF EFIS</name>
|
<name>GoFlight GF EFIS</name>
|
||||||
<debug-events type="bool">true</debug-events>
|
<debug-events type="bool">false</debug-events>
|
||||||
|
|
||||||
<nasal>
|
<nasal>
|
||||||
<open>
|
<open>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
||||||
|
var basePath = "/instrumentation/efis[0]/";
|
||||||
|
|
||||||
|
# value is 0..8 for the konb on 738, GF only goes to 10
|
||||||
|
var efisRangeKnobNode = props.globals.getNode(basePath ~ "inputs/range-knob");
|
||||||
|
efisRangeKnobNode.setIntValue(0);
|
||||||
|
|
||||||
|
# value is absolute integer for each click, hmmmm
|
||||||
|
var efisBaroKnobNode = props.globals.getNode(basePath ~ "inputs/baro-knob");
|
||||||
|
|
||||||
|
var setRangeBit = func(bit) {
|
||||||
|
var b = efisRangeKnobNode.getValue() - 1;
|
||||||
|
efisRangeKnobNode.setIntValue(bits.set(b, bit) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var clearRangeBit = func(bit) {
|
||||||
|
var b = efisRangeKnobNode.getValue() - 1;
|
||||||
|
efisRangeKnobNode.setIntValue(bits.clear(b, bit) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var efisNDModeNode = props.globals.getNode(basePath ~ "mfd/mode-num");
|
||||||
|
var setModeBit = func(bit) {
|
||||||
|
var mode = efisNDModeNode.getValue();
|
||||||
|
efisNDModeNode.setIntValue(bits.set(mode, bit));
|
||||||
|
}
|
||||||
|
|
||||||
|
var clearModeBit = func(bit) {
|
||||||
|
var mode = efisNDModeNode.getValue();
|
||||||
|
efisNDModeNode.setIntValue(bits.clear(mode, bit));
|
||||||
|
}
|
||||||
]]>
|
]]>
|
||||||
</open>
|
</open>
|
||||||
</nasal>
|
</nasal>
|
||||||
|
|
||||||
|
<hid-descriptor>
|
||||||
|
<report>
|
||||||
|
<type>input</type>
|
||||||
|
<id>1</id>
|
||||||
|
<unused-bits><size type="int">16</size></unused-bits>
|
||||||
|
<rel-dial-0>
|
||||||
|
<size type="int">8</size>
|
||||||
|
<count type="int">2</count>
|
||||||
|
<is-signed type="bool">true</is-signed>
|
||||||
|
</rel-dial-0>
|
||||||
|
<button-0>
|
||||||
|
<count type="int">24</count>
|
||||||
|
</button-0>
|
||||||
|
</report>
|
||||||
|
</hid-descriptor>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<name>rel-dial-4</name>
|
<name>rel-dial-0</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-adjust</command>
|
<command>property-adjust</command>
|
||||||
<property>/input/goflight/efis/height</property>
|
<property>/input/goflight/efis/height</property>
|
||||||
<min type="double">0.0</min>
|
<min type="double">0.0</min>
|
||||||
</binding>
|
</binding>
|
||||||
<interpolater>
|
<interpolater>
|
||||||
|
<mirrored type="bool">true</mirrored>
|
||||||
<entry><ind>0</ind><dep>0</dep></entry>
|
<entry><ind>0</ind><dep>0</dep></entry>
|
||||||
<entry><ind>1</ind><dep>1</dep></entry>
|
<entry><ind>1</ind><dep>1</dep></entry>
|
||||||
<entry><ind>2</ind><dep>2</dep></entry>
|
<entry><ind>2</ind><dep>2</dep></entry>
|
||||||
|
@ -26,146 +73,17 @@
|
||||||
</interpolater>
|
</interpolater>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
|
||||||
<name>rel-dial-5</name>
|
|
||||||
<binding>
|
|
||||||
<command>property-adjust</command>
|
|
||||||
<property>/input/goflight/efis/baro</property>
|
|
||||||
<min type="double">108.0</min>
|
|
||||||
<max type="double">117.95</max>
|
|
||||||
<wrap type="bool">true</wrap>
|
|
||||||
</binding>
|
|
||||||
<interpolater>
|
|
||||||
<entry><ind>0</ind><dep>0</dep></entry>
|
|
||||||
<entry><ind>1</ind><dep>1</dep></entry>
|
|
||||||
<entry><ind>2</ind><dep>2</dep></entry>
|
|
||||||
<entry><ind>3</ind><dep>4</dep></entry>
|
|
||||||
<entry><ind>4</ind><dep>8</dep></entry>
|
|
||||||
</interpolater>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<event>
|
<event>
|
||||||
<name>led-misc</name>
|
<name>rel-dial-1</name>
|
||||||
<setting>
|
|
||||||
<value>4</value>
|
|
||||||
<condition>
|
|
||||||
<equals>
|
|
||||||
<property>/input/goflight/mfr/active</property>
|
|
||||||
<value>0</value>
|
|
||||||
</equals>
|
|
||||||
</condition>
|
|
||||||
</setting>
|
|
||||||
<setting>
|
|
||||||
<value>7</value>
|
|
||||||
<condition>
|
|
||||||
<not-equals>
|
|
||||||
<property>/input/goflight/mfr/active</property>
|
|
||||||
<value>0</value>
|
|
||||||
</not-equals>
|
|
||||||
</condition>
|
|
||||||
</setting>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event>
|
|
||||||
<name>led-misc-1</name>
|
|
||||||
<setting>
|
|
||||||
<value>7</value>
|
|
||||||
<condition>
|
|
||||||
<equals>
|
|
||||||
<property>/input/goflight/mfr/active</property>
|
|
||||||
<value>1</value>
|
|
||||||
</equals>
|
|
||||||
</condition>
|
|
||||||
</setting>
|
|
||||||
<setting>
|
|
||||||
<value>0</value>
|
|
||||||
<condition>
|
|
||||||
<not-equals>
|
|
||||||
<property>/input/goflight/mfr/active</property>
|
|
||||||
<value>1</value>
|
|
||||||
</not-equals>
|
|
||||||
</condition>
|
|
||||||
</setting>
|
|
||||||
</event>
|
|
||||||
-->
|
|
||||||
<event>
|
|
||||||
<desc>STA Button</desc>
|
|
||||||
<name>button-1</name>
|
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-toggle</command>
|
<command>property-adjust</command>
|
||||||
<property>/instrumentation/efis/inputs/sta</property>
|
<property>/instrumentation/efis[0]/inputs/baro-knob</property>
|
||||||
</binding>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event>
|
|
||||||
<desc>WXR Button</desc>
|
|
||||||
<name>button-2</name>
|
|
||||||
<binding>
|
|
||||||
<command>property-toggle</command>
|
|
||||||
<property>/instrumentation/efis/inputs/wxr</property>
|
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>TERR Button</desc>
|
<desc>TERR Button</desc>
|
||||||
<name>button-3</name>
|
<name>button-0</name>
|
||||||
<binding>
|
|
||||||
<command>nasal</command>
|
|
||||||
<script>debug.dump("Button 3");</script>
|
|
||||||
</binding>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event>
|
|
||||||
<desc>ARPT Button</desc>
|
|
||||||
<name>button-4</name>
|
|
||||||
<binding>
|
|
||||||
<command>property-toggle</command>
|
|
||||||
<property>/instrumentation/efis/inputs/arpt</property>
|
|
||||||
</binding>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event>
|
|
||||||
<desc>ARPT Button</desc>
|
|
||||||
<name>button-5</name>
|
|
||||||
<binding>
|
|
||||||
<command>nasal</command>
|
|
||||||
<script>debug.dump("Button 5");</script>
|
|
||||||
</binding>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event>
|
|
||||||
<desc>ARPT Button</desc>
|
|
||||||
<name>button-6</name>
|
|
||||||
<binding>
|
|
||||||
<command>nasal</command>
|
|
||||||
<script>debug.dump("Button 6");</script>
|
|
||||||
</binding>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event>
|
|
||||||
<desc>ARPT Button</desc>
|
|
||||||
<name>button-7</name>
|
|
||||||
<binding>
|
|
||||||
<command>nasal</command>
|
|
||||||
<script>debug.dump("Button 7");</script>
|
|
||||||
</binding>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event>
|
|
||||||
<desc>ARPT Button</desc>
|
|
||||||
<name>button-8</name>
|
|
||||||
<binding>
|
|
||||||
<command>nasal</command>
|
|
||||||
<script>debug.dump("Button 8");</script>
|
|
||||||
</binding>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event>
|
|
||||||
<desc>TERR Button</desc>
|
|
||||||
<name>button-9</name>
|
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-toggle</command>
|
<command>property-toggle</command>
|
||||||
<property>/instrumentation/efis/inputs/terr</property>
|
<property>/instrumentation/efis/inputs/terr</property>
|
||||||
|
@ -174,7 +92,7 @@
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>POS Button</desc>
|
<desc>POS Button</desc>
|
||||||
<name>button-10</name>
|
<name>button-1</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-toggle</command>
|
<command>property-toggle</command>
|
||||||
<property>/instrumentation/efis/inputs/pos</property>
|
<property>/instrumentation/efis/inputs/pos</property>
|
||||||
|
@ -183,7 +101,7 @@
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>DATA Button</desc>
|
<desc>DATA Button</desc>
|
||||||
<name>button-11</name>
|
<name>button-2</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-toggle</command>
|
<command>property-toggle</command>
|
||||||
<property>/instrumentation/efis/inputs/data</property>
|
<property>/instrumentation/efis/inputs/data</property>
|
||||||
|
@ -192,7 +110,7 @@
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>ARPT Button</desc>
|
<desc>ARPT Button</desc>
|
||||||
<name>button-12</name>
|
<name>button-3</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-toggle</command>
|
<command>property-toggle</command>
|
||||||
<property>/instrumentation/efis/inputs/arpt</property>
|
<property>/instrumentation/efis/inputs/arpt</property>
|
||||||
|
@ -201,7 +119,7 @@
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>WPT Button</desc>
|
<desc>WPT Button</desc>
|
||||||
<name>button-13</name>
|
<name>button-4</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-toggle</command>
|
<command>property-toggle</command>
|
||||||
<property>/instrumentation/efis/inputs/wpt</property>
|
<property>/instrumentation/efis/inputs/wpt</property>
|
||||||
|
@ -210,7 +128,7 @@
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>STA Button</desc>
|
<desc>STA Button</desc>
|
||||||
<name>button-14</name>
|
<name>button-5</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-toggle</command>
|
<command>property-toggle</command>
|
||||||
<property>/instrumentation/efis/inputs/sta</property>
|
<property>/instrumentation/efis/inputs/sta</property>
|
||||||
|
@ -219,7 +137,7 @@
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>WXR Button</desc>
|
<desc>WXR Button</desc>
|
||||||
<name>button-15</name>
|
<name>button-6</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-toggle</command>
|
<command>property-toggle</command>
|
||||||
<property>/instrumentation/efis/inputs/wxr</property>
|
<property>/instrumentation/efis/inputs/wxr</property>
|
||||||
|
@ -227,44 +145,56 @@
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>ARPT Button</desc>
|
<desc></desc>
|
||||||
<name>button-16</name>
|
<name>button-7</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>debug.dump("Button 16");</script>
|
<script>debug.dump("Button 7");</script>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>ARPT Button</desc>
|
<desc></desc>
|
||||||
<name>button-17</name>
|
<name>button-8</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>debug.dump("Button 17");</script>
|
<script>setModeBit(0)</script>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>clearModeBit(0)</script>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>ARPT Button</desc>
|
<desc></desc>
|
||||||
<name>button-18</name>
|
<name>button-9</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>debug.dump("Button 18");</script>
|
<script>setModeBit(1)</script>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>clearModeBit(1)</script>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>ARPT Button</desc>
|
<desc></desc>
|
||||||
<name>button-19</name>
|
<name>button-10</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>debug.dump("Button 19");</script>
|
<script>debug.dump("Button 10");</script>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>in/HPA toggle</desc>
|
<desc>in/HPA toggle</desc>
|
||||||
<name>button-20</name>
|
<name>button-11</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-toggle</command>
|
<command>property-toggle</command>
|
||||||
<property>/instrumentation/efis/inputs/kpa-mode</property>
|
<property>/instrumentation/efis/inputs/kpa-mode</property>
|
||||||
|
@ -272,48 +202,71 @@
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>ARPT Button</desc>
|
<desc>DH/MCA knob push</desc>
|
||||||
<name>button-21</name>
|
<name>button-12</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>debug.dump("Button 21");</script>
|
<script>debug.dump("DH/MCA toggle");</script>
|
||||||
|
</binding>
|
||||||
|
|
||||||
|
<binding>
|
||||||
|
<command>property-toggle</command>
|
||||||
|
<property>/instrumentation/efis/inputs/minimums-mode</property>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>ARPT Button</desc>
|
<desc></desc>
|
||||||
<name>button-22</name>
|
<name>button-13</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>debug.dump("Button 22");</script>
|
<script>setRangeBit(0)</script>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>clearRangeBit(0)</script>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>ARPT Button</desc>
|
<desc></desc>
|
||||||
<name>button-23</name>
|
<name>button-14</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>debug.dump("Button 23");</script>
|
<script>setRangeBit(1)</script>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>clearRangeBit(1)</script>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>ARPT Button</desc>
|
<desc></desc>
|
||||||
<name>button-24</name>
|
<name>button-15</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>debug.dump("Button 24");</script>
|
<script>setRangeBit(2)</script>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>clearRangeBit(2)</script>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>ADF-L switch</desc>
|
<desc>ADF-L switch</desc>
|
||||||
<name>button-25</name>
|
<name>button-16</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-assign</command>
|
<command>property-assign</command>
|
||||||
<property>/instrumentation/efis/inputs/lh-vor-adf</property>
|
<property>/instrumentation/efis/inputs/lh-vor-adf</property>
|
||||||
<value>2</value>
|
<value>-1</value>
|
||||||
</binding>
|
</binding>
|
||||||
<mod-up>
|
<mod-up>
|
||||||
<binding>
|
<binding>
|
||||||
|
@ -327,7 +280,7 @@
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>VOR-L switch</desc>
|
<desc>VOR-L switch</desc>
|
||||||
<name>button-26</name>
|
<name>button-17</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-assign</command>
|
<command>property-assign</command>
|
||||||
<property>/instrumentation/efis/inputs/lh-vor-adf</property>
|
<property>/instrumentation/efis/inputs/lh-vor-adf</property>
|
||||||
|
@ -344,11 +297,11 @@
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>ADF-R switch</desc>
|
<desc>ADF-R switch</desc>
|
||||||
<name>button-27</name>
|
<name>button-18</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-assign</command>
|
<command>property-assign</command>
|
||||||
<property>/instrumentation/efis/inputs/rh-vor-adf</property>
|
<property>/instrumentation/efis/inputs/rh-vor-adf</property>
|
||||||
<value>2</value>
|
<value>-1</value>
|
||||||
</binding>
|
</binding>
|
||||||
<mod-up>
|
<mod-up>
|
||||||
<binding>
|
<binding>
|
||||||
|
@ -361,7 +314,7 @@
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>VOR-R switch</desc>
|
<desc>VOR-R switch</desc>
|
||||||
<name>button-28</name>
|
<name>button-19</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-assign</command>
|
<command>property-assign</command>
|
||||||
<property>/instrumentation/efis/inputs/rh-vor-adf</property>
|
<property>/instrumentation/efis/inputs/rh-vor-adf</property>
|
||||||
|
@ -378,7 +331,7 @@
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>MTRS Button</desc>
|
<desc>MTRS Button</desc>
|
||||||
<name>button-29</name>
|
<name>button-20</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>debug.dump("Button MTRS");</script>
|
<script>debug.dump("Button MTRS");</script>
|
||||||
|
@ -391,8 +344,8 @@
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<desc>MTRS Button</desc>
|
<desc>FPV Button</desc>
|
||||||
<name>button-30</name>
|
<name>button-21</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>debug.dump("Button FPV");</script>
|
<script>debug.dump("Button FPV");</script>
|
||||||
|
@ -404,17 +357,4 @@
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
|
||||||
<desc>DH/MCA knob push</desc>
|
|
||||||
<name>button-21</name>
|
|
||||||
<binding>
|
|
||||||
<command>nasal</command>
|
|
||||||
<script>debug.dump("DH/MCA toggle");</script>
|
|
||||||
</binding>
|
|
||||||
|
|
||||||
<binding>
|
|
||||||
<command>property-toggle</command>
|
|
||||||
<property>/instrumentation/efis/inputs/minimums-mode</property>
|
|
||||||
</binding>
|
|
||||||
</event>
|
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
|
@ -1,257 +1,303 @@
|
||||||
<PropertyList>
|
<PropertyList>
|
||||||
|
|
||||||
<name>GoFlight MCP Pro</name>
|
<name>GoFlight MCP Pro</name>
|
||||||
<debug-events type="bool">true</debug-events>
|
<name>MCP Pro</name>
|
||||||
|
<debug-events type="bool">false</debug-events>
|
||||||
|
|
||||||
<nasal>
|
<nasal>
|
||||||
<open>
|
<open>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
# map decimal digits 0..9 to standard 7-segment LCD pattern
|
|
||||||
# 2 should be 5b
|
|
||||||
# 3 should be 4f
|
|
||||||
var translateDigitToSevenSegment = [0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x67];
|
|
||||||
|
|
||||||
var encodeString = func(s, fieldWidth, padChar = nil)
|
var altitudeAlphanumeric = func() { return goflight.mcp.altitudeData(); }
|
||||||
{
|
var headingAlphanumeric = func() { return goflight.mcp.headingData(); }
|
||||||
var padCount = fieldWidth - size(s);
|
var courseAlphanumeric = func() { return goflight.mcp.course1Data(); }
|
||||||
var r = "";
|
var course2Alphanumeric = func() { return goflight.mcp.course2Data(); }
|
||||||
if (padChar == nil) padChar = chr(0);
|
var speedAlphanumeric = func() { return goflight.mcp.speedData(); }
|
||||||
|
var vspeedAlphanumeric = func() { return goflight.mcp.vsData(); }
|
||||||
|
|
||||||
while (padCount > 0) {
|
|
||||||
r ~= padChar;
|
|
||||||
padCount -=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i=0; i < size(s); i += 1) {
|
|
||||||
if (s[i] == `.`) {
|
|
||||||
# set the high bit to correspond to the decimal
|
|
||||||
var lastIndex = size(r) - 1;
|
|
||||||
r[lastIndex] = r[lastIndex] + 0x80;
|
|
||||||
} elsif (s[i] == `-`) {
|
|
||||||
r ~= chr(0x40);
|
|
||||||
} else {
|
|
||||||
var digitCode = s[i] - `0`;
|
|
||||||
r ~= chr(translateDigitToSevenSegment[digitCode]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
var altitudeAlphanumeric = func() {
|
|
||||||
var alt = getprop("/autopilot/settings/target-altitude-ft");
|
|
||||||
var altStr = sprintf("%d", alt);
|
|
||||||
return encodeString(altStr, 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
var headingAlphanumeric = func() {
|
|
||||||
var hdg = getprop("/autopilot/settings/heading-bug-deg");
|
|
||||||
return encodeString(sprintf("%d", hdg), 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
var courseAlphanumeric = func() {
|
|
||||||
var crs = getprop("/instrumentation/nav[0]/radials/selected-deg");
|
|
||||||
return encodeString(sprintf("%d", crs), 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
var course2Alphanumeric = func() {
|
|
||||||
var crs = getprop("/instrumentation/nav[1]/radials/selected-deg");
|
|
||||||
return encodeString(sprintf("%d", crs), 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
var speedAlphanumeric = func() {
|
|
||||||
var spd = getprop("/autopilot/settings/target-speed-kt");
|
|
||||||
return encodeString(sprintf("%d", spd), 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
var vspeedAlphanumeric = func() {
|
|
||||||
var vs = getprop("/autopilot/settings/vertical-speed-fpm");
|
|
||||||
return encodeString(sprintf("%d", vs), 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
var ledState = func()
|
|
||||||
{
|
|
||||||
if (activeChannel == 1) return chr(0x04);
|
|
||||||
return chr(0x2);
|
|
||||||
}
|
|
||||||
]]>
|
]]>
|
||||||
</open>
|
</open>
|
||||||
</nasal>
|
</nasal>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<name>rel-dial</name>
|
<name>display-brightness</name>
|
||||||
<interpolater>
|
<setting>
|
||||||
<mirrored type="bool">true</mirrored>
|
<property>/input/goflight/mcp/brightness</property>
|
||||||
<entry><ind>0</ind><dep>0</dep></entry>
|
</setting>
|
||||||
<entry><ind>1</ind><dep>1</dep></entry>
|
</event>
|
||||||
<entry><ind>2</ind><dep>5</dep></entry>
|
|
||||||
<entry><ind>3</ind><dep>10</dep></entry>
|
|
||||||
<entry><ind>4</ind><dep>20</dep></entry>
|
<event>
|
||||||
</interpolater>
|
<name>rel-dial-0</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-adjust</command>
|
<command>property-adjust</command>
|
||||||
<property>/autopilot/settings/target-altitude-ft</property>
|
<property>/autopilot/settings/heading-bug-deg</property>
|
||||||
<factor type="double">100</factor>
|
<wrap type="bool">true</wrap>
|
||||||
<min>0</min>
|
<min>0</min>
|
||||||
|
<max>359</max>
|
||||||
|
</binding>
|
||||||
|
<interpolater>
|
||||||
|
<mirrored type="bool">true</mirrored>
|
||||||
|
<entry>
|
||||||
|
<ind>0</ind>
|
||||||
|
<dep>0</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>1</ind>
|
||||||
|
<dep>1</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>2</ind>
|
||||||
|
<dep>5</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>3</ind>
|
||||||
|
<dep>10</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>4</ind>
|
||||||
|
<dep>30</dep>
|
||||||
|
</entry>
|
||||||
|
</interpolater>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event>
|
||||||
|
<name>rel-dial-1</name>
|
||||||
|
<binding>
|
||||||
|
<command>property-adjust</command>
|
||||||
|
<property>/instrumentation/nav[0]/radials/selected-deg</property>
|
||||||
|
<wrap type="bool">true</wrap>
|
||||||
|
<min>0</min>
|
||||||
|
<max>359</max>
|
||||||
|
</binding>
|
||||||
|
<interpolater>
|
||||||
|
<mirrored type="bool">true</mirrored>
|
||||||
|
<entry>
|
||||||
|
<ind>0</ind>
|
||||||
|
<dep>0</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>1</ind>
|
||||||
|
<dep>1</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>2</ind>
|
||||||
|
<dep>5</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>3</ind>
|
||||||
|
<dep>10</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>4</ind>
|
||||||
|
<dep>30</dep>
|
||||||
|
</entry>
|
||||||
|
</interpolater>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event>
|
||||||
|
<name>rel-dial-2</name>
|
||||||
|
<binding>
|
||||||
|
<command>property-adjust</command>
|
||||||
|
<property>/autopilot/settings/vertical-speed-fpm</property>
|
||||||
|
<factor type="double">-50</factor>
|
||||||
|
<min>-8000</min>
|
||||||
|
<max>12000</max>
|
||||||
|
</binding>
|
||||||
|
<interpolater>
|
||||||
|
<mirrored type="bool">true</mirrored>
|
||||||
|
|
||||||
|
<entry>
|
||||||
|
<ind>0</ind>
|
||||||
|
<dep>0</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>1</ind>
|
||||||
|
<dep>1</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>2</ind>
|
||||||
|
<dep>2</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>3</ind>
|
||||||
|
<dep>4</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>4</ind>
|
||||||
|
<dep>10</dep>
|
||||||
|
</entry>
|
||||||
|
</interpolater>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event>
|
||||||
|
<name>rel-dial-3</name>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>goflight.mcp.adjustSpeed(cmdarg().getNode("offset").getValue())</script>
|
||||||
|
</binding>
|
||||||
|
<interpolater>
|
||||||
|
<mirrored type="bool">true</mirrored>
|
||||||
|
|
||||||
|
<entry>
|
||||||
|
<ind>0</ind>
|
||||||
|
<dep>0</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>1</ind>
|
||||||
|
<dep>1</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>2</ind>
|
||||||
|
<dep>5</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>3</ind>
|
||||||
|
<dep>10</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>4</ind>
|
||||||
|
<dep>20</dep>
|
||||||
|
</entry>
|
||||||
|
</interpolater>
|
||||||
|
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event>
|
||||||
|
<name>rel-dial-4</name>
|
||||||
|
<binding>
|
||||||
|
<command>property-adjust</command>
|
||||||
|
<property>/instrumentation/nav[1]/radials/selected-deg</property>
|
||||||
|
<wrap type="bool">true</wrap>
|
||||||
|
<min>0</min>
|
||||||
|
<max>359</max>
|
||||||
|
</binding>
|
||||||
|
<interpolater>
|
||||||
|
<mirrored type="bool">true</mirrored>
|
||||||
|
|
||||||
|
<entry>
|
||||||
|
<ind>0</ind>
|
||||||
|
<dep>0</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>1</ind>
|
||||||
|
<dep>1</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>2</ind>
|
||||||
|
<dep>5</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>3</ind>
|
||||||
|
<dep>10</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>4</ind>
|
||||||
|
<dep>30</dep>
|
||||||
|
</entry>
|
||||||
|
</interpolater>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event>
|
||||||
|
<name>rel-dial-5</name>
|
||||||
|
<interpolater>
|
||||||
|
<mirrored type="bool">true</mirrored>
|
||||||
|
|
||||||
|
<entry>
|
||||||
|
<ind>0</ind>
|
||||||
|
<dep>0</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>1</ind>
|
||||||
|
<dep>1</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>2</ind>
|
||||||
|
<dep>10</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>3</ind>
|
||||||
|
<dep>50</dep>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<ind>4</ind>
|
||||||
|
<dep>100</dep>
|
||||||
|
</entry>
|
||||||
|
</interpolater>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>
|
||||||
|
var x = cmdarg().getNode("offset").getValue();
|
||||||
|
goflight.mcp.adjustAltitude(x * 50);
|
||||||
|
</script>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<report>
|
||||||
<name>rel-dial-1</name>
|
<report-id type="int">9</report-id>
|
||||||
<binding>
|
<watch>/input/goflight/mcp/refresh</watch>
|
||||||
<command>property-adjust</command>
|
<nasal-function>altitudeAlphanumeric</nasal-function>
|
||||||
<property>/autopilot/settings/heading-bug-deg</property>
|
</report>
|
||||||
<wrap type="bool">true</wrap>
|
|
||||||
<min>0</min>
|
|
||||||
<max>359</max>
|
|
||||||
</binding>
|
|
||||||
<interpolater>
|
|
||||||
<mirrored type="bool">true</mirrored>
|
|
||||||
<entry><ind>0</ind><dep>0</dep></entry>
|
|
||||||
<entry><ind>1</ind><dep>1</dep></entry>
|
|
||||||
<entry><ind>2</ind><dep>5</dep></entry>
|
|
||||||
<entry><ind>3</ind><dep>10</dep></entry>
|
|
||||||
<entry><ind>4</ind><dep>20</dep></entry>
|
|
||||||
</interpolater>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event>
|
<report>
|
||||||
<name>rel-dial-2</name>
|
<report-id type="int">7</report-id>
|
||||||
<binding>
|
<watch>/input/goflight/mcp/refresh-headings</watch>
|
||||||
<command>property-adjust</command>
|
<nasal-function>headingAlphanumeric</nasal-function>
|
||||||
<property>/instrumentation/nav[0]/radials/selected-deg</property>
|
</report>
|
||||||
<wrap type="bool">true</wrap>
|
|
||||||
<min>0</min>
|
|
||||||
<max>359</max>
|
|
||||||
</binding>
|
|
||||||
<interpolater>
|
|
||||||
<mirrored type="bool">true</mirrored>
|
|
||||||
<entry><ind>0</ind><dep>0</dep></entry>
|
|
||||||
<entry><ind>1</ind><dep>1</dep></entry>
|
|
||||||
<entry><ind>2</ind><dep>5</dep></entry>
|
|
||||||
<entry><ind>3</ind><dep>10</dep></entry>
|
|
||||||
<entry><ind>4</ind><dep>20</dep></entry>
|
|
||||||
</interpolater>
|
|
||||||
</event>
|
|
||||||
<event>
|
|
||||||
<name>rel-dial-3</name>
|
|
||||||
<binding>
|
|
||||||
<command>property-adjust</command>
|
|
||||||
<property>/autopilot/settings/vertical-speed-fpm</property>
|
|
||||||
<factor type="double">10</factor>
|
|
||||||
</binding>
|
|
||||||
<interpolater>
|
|
||||||
<mirrored type="bool">true</mirrored>
|
|
||||||
<entry><ind>0</ind><dep>0</dep></entry>
|
|
||||||
<entry><ind>1</ind><dep>1</dep></entry>
|
|
||||||
<entry><ind>2</ind><dep>5</dep></entry>
|
|
||||||
<entry><ind>3</ind><dep>10</dep></entry>
|
|
||||||
<entry><ind>4</ind><dep>20</dep></entry>
|
|
||||||
</interpolater>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event>
|
<report>
|
||||||
<name>rel-dial-4</name>
|
<report-id type="int">3</report-id>
|
||||||
<binding>
|
<watch>/input/goflight/mcp/refresh-headings</watch>
|
||||||
<command>property-adjust</command>
|
<nasal-function>courseAlphanumeric</nasal-function>
|
||||||
<property>/autopilot/settings/target-speed-kt</property>
|
</report>
|
||||||
<min>0</min>
|
|
||||||
</binding>
|
|
||||||
<interpolater>
|
|
||||||
<mirrored type="bool">true</mirrored>
|
|
||||||
<entry><ind>0</ind><dep>0</dep></entry>
|
|
||||||
<entry><ind>1</ind><dep>1</dep></entry>
|
|
||||||
<entry><ind>2</ind><dep>5</dep></entry>
|
|
||||||
<entry><ind>3</ind><dep>10</dep></entry>
|
|
||||||
<entry><ind>4</ind><dep>20</dep></entry>
|
|
||||||
</interpolater>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event>
|
<report>
|
||||||
<name>rel-dial-5</name>
|
<report-id type="int">11</report-id>
|
||||||
<binding>
|
<watch>/input/goflight/mcp/refresh</watch>
|
||||||
<command>property-adjust</command>
|
<nasal-function>vspeedAlphanumeric</nasal-function>
|
||||||
<property>/instrumentation/nav[1]/radials/selected-deg</property>
|
</report>
|
||||||
<wrap type="bool">true</wrap>
|
|
||||||
<min>0</min>
|
|
||||||
<max>359</max>
|
|
||||||
</binding>
|
|
||||||
<interpolater>
|
|
||||||
<mirrored type="bool">true</mirrored>
|
|
||||||
<entry><ind>0</ind><dep>0</dep></entry>
|
|
||||||
<entry><ind>1</ind><dep>1</dep></entry>
|
|
||||||
<entry><ind>2</ind><dep>5</dep></entry>
|
|
||||||
<entry><ind>3</ind><dep>10</dep></entry>
|
|
||||||
<entry><ind>4</ind><dep>20</dep></entry>
|
|
||||||
</interpolater>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
|
<report>
|
||||||
|
<report-id type="int">5</report-id>
|
||||||
|
<watch>/input/goflight/mcp/refresh</watch>
|
||||||
|
<nasal-function>speedAlphanumeric</nasal-function>
|
||||||
|
</report>
|
||||||
|
|
||||||
<report>
|
<report>
|
||||||
<report-id type="int">9</report-id>
|
<report-id type="int">13</report-id>
|
||||||
<watch>/autopilot/settings/target-altitude-ft</watch>
|
<watch>/input/goflight/mcp/refresh-headings</watch>
|
||||||
<nasal-function>altitudeAlphanumeric</nasal-function>
|
<nasal-function>course2Alphanumeric</nasal-function>
|
||||||
</report>
|
</report>
|
||||||
|
|
||||||
<report>
|
<!-- LED driver properties - these are generated from individual
|
||||||
<report-id type="int">7</report-id>
|
bool properties by the LEDWatcher helper class above -->
|
||||||
<watch>/autopilot/settings/heading-bug-deg</watch>
|
|
||||||
<nasal-function>headingAlphanumeric</nasal-function>
|
|
||||||
</report>
|
|
||||||
|
|
||||||
<report>
|
|
||||||
<report-id type="int">3</report-id>
|
|
||||||
<watch>/instrumentation/nav[0]/radials/selected-deg</watch>
|
|
||||||
<nasal-function>courseAlphanumeric</nasal-function>
|
|
||||||
</report>
|
|
||||||
|
|
||||||
<report>
|
|
||||||
<report-id type="int">11</report-id>
|
|
||||||
<watch>/autopilot/settings/vertical-speed-fpm</watch>
|
|
||||||
<nasal-function>vspeedAlphanumeric</nasal-function>
|
|
||||||
</report>
|
|
||||||
|
|
||||||
<report>
|
|
||||||
<report-id type="int">5</report-id>
|
|
||||||
<watch>/autopilot/settings/target-speed-kt</watch>
|
|
||||||
<nasal-function>speedAlphanumeric</nasal-function>
|
|
||||||
</report>
|
|
||||||
|
|
||||||
<report>
|
|
||||||
<report-id type="int">13</report-id>
|
|
||||||
<watch>/instrumentation/nav[1]/radials/selected-deg</watch>
|
|
||||||
<nasal-function>course2Alphanumeric</nasal-function>
|
|
||||||
</report>
|
|
||||||
|
|
||||||
<!-- set LED from nose gear indicator -->
|
|
||||||
<event>
|
<event>
|
||||||
<name>led-misc</name>
|
<name>led-misc-0</name>
|
||||||
<setting>
|
<setting>
|
||||||
<value>1</value>
|
<property>/input/goflight/mcp/led[0]</property>
|
||||||
<condition>
|
|
||||||
<property>/gear/gear[0]/indicator-servicable</property>
|
|
||||||
<greater-than>
|
|
||||||
<property>/gear/gear[0]/position-norm</property>
|
|
||||||
<value>0.9</value>
|
|
||||||
</greater-than>
|
|
||||||
</condition>
|
|
||||||
</setting>
|
|
||||||
<setting>
|
|
||||||
<value>0</value>
|
|
||||||
<condition>
|
|
||||||
<not>
|
|
||||||
<and>
|
|
||||||
<property>/gear/gear[0]/indicator-servicable</property>
|
|
||||||
<greater-than>
|
|
||||||
<property>/gear/gear[0]/position-norm</property>
|
|
||||||
<value>0.9</value>
|
|
||||||
</greater-than>
|
|
||||||
</and>
|
|
||||||
</not>
|
|
||||||
</condition>
|
|
||||||
</setting>
|
</setting>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
<event>
|
||||||
|
<name>led-misc-1</name>
|
||||||
|
<setting>
|
||||||
|
<property>/input/goflight/mcp/led[1]</property>
|
||||||
|
</setting>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event>
|
||||||
|
<name>led-misc-2</name>
|
||||||
|
<setting>
|
||||||
|
<property>/input/goflight/mcp/led[2]</property>
|
||||||
|
</setting>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event>
|
||||||
|
<name>led-misc-3</name>
|
||||||
|
<setting>
|
||||||
|
<property>/input/goflight/mcp/led[3]</property>
|
||||||
|
</setting>
|
||||||
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<name>button-1</name>
|
<name>button-1</name>
|
||||||
|
@ -266,7 +312,7 @@
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>print("Button 2")</script>
|
<script>print("Button 2")</script>
|
||||||
</binding>
|
</binding>enable
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
|
@ -321,8 +367,8 @@
|
||||||
<desc>Speed</desc>
|
<desc>Speed</desc>
|
||||||
<name>button-9</name>
|
<name>button-9</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("SPD")</script>
|
<button>speed</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -330,8 +376,8 @@
|
||||||
<name>button-10</name>
|
<name>button-10</name>
|
||||||
<desc>Level Change</desc>
|
<desc>Level Change</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("LVL CHG")</script>
|
<button>level-change</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -339,8 +385,8 @@
|
||||||
<name>button-11</name>
|
<name>button-11</name>
|
||||||
<desc>Heading</desc>
|
<desc>Heading</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("HDG")</script>
|
<button>heading</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -348,8 +394,8 @@
|
||||||
<name>button-12</name>
|
<name>button-12</name>
|
||||||
<desc>Approach</desc>
|
<desc>Approach</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("APP")</script>
|
<button>approach</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -357,8 +403,8 @@
|
||||||
<name>button-13</name>
|
<name>button-13</name>
|
||||||
<desc>Altitude</desc>
|
<desc>Altitude</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("ALT")</script>
|
<button>altitude-hold</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -366,8 +412,8 @@
|
||||||
<name>button-14</name>
|
<name>button-14</name>
|
||||||
<desc>Vertical Speed</desc>
|
<desc>Vertical Speed</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("VS")</script>
|
<button>vs</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -375,9 +421,17 @@
|
||||||
<name>button-15</name>
|
<name>button-15</name>
|
||||||
<desc>Disengage Bar</desc>
|
<desc>Disengage Bar</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>property-assign</command>
|
||||||
<script>print("Disengage")</script>
|
<property>/input/goflight/mcp/ap-disengage</property>
|
||||||
|
<value>1</value>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>property-assign</command>
|
||||||
|
<property>/input/goflight/mcp/ap-disengage</property>
|
||||||
|
<value>0</value>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
|
||||||
|
@ -385,17 +439,25 @@
|
||||||
<name>button-16</name>
|
<name>button-16</name>
|
||||||
<desc>F/O FD Enable</desc>
|
<desc>F/O FD Enable</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>property-assign</command>
|
||||||
<script>print("F/O FD")</script>
|
<property>/input/goflight/mcp/fo-fd-enabled</property>
|
||||||
|
<value>1</value>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>property-assign</command>
|
||||||
|
<property>/input/goflight/mcp/fo-fd-enabled</property>
|
||||||
|
<value>0</value>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<name>button-17</name>
|
<name>button-17</name>
|
||||||
<desc>Altitude Intervention</desc>
|
<desc>Altitude Intervention</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("ALT INTV")</script>
|
<button>altitude-intervention</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -403,8 +465,8 @@
|
||||||
<name>button-18</name>
|
<name>button-18</name>
|
||||||
<desc>CWS-A</desc>
|
<desc>CWS-A</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("CWS-A")</script>
|
<button>cws-a</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -412,8 +474,8 @@
|
||||||
<name>button-19</name>
|
<name>button-19</name>
|
||||||
<desc>CWS-B</desc>
|
<desc>CWS-B</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("CWS-B")</script>
|
<button>cws-b</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -421,8 +483,8 @@
|
||||||
<name>button-20</name>
|
<name>button-20</name>
|
||||||
<desc>IAS knob push</desc>
|
<desc>IAS knob push</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("IAS push")</script>
|
<button>speed-push</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -430,8 +492,8 @@
|
||||||
<name>button-21</name>
|
<name>button-21</name>
|
||||||
<desc>HDG knob push</desc>
|
<desc>HDG knob push</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("HDG push")</script>
|
<button>heading-push</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -439,8 +501,8 @@
|
||||||
<name>button-22</name>
|
<name>button-22</name>
|
||||||
<desc>Altitude Knob Push</desc>
|
<desc>Altitude Knob Push</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("ALT SEL")</script>
|
<button>altitude-select</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -448,17 +510,25 @@
|
||||||
<name>button-23</name>
|
<name>button-23</name>
|
||||||
<desc>Captain's FD Enable</desc>
|
<desc>Captain's FD Enable</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>property-assign</command>
|
||||||
<script>print("CAP FD")</script>
|
<property>/input/goflight/mcp/captain-fd-enabled</property>
|
||||||
|
<value>1</value>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>property-assign</command>
|
||||||
|
<property>/input/goflight/mcp/captain-fd-enabled</property>
|
||||||
|
<value>0</value>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<name>button-24</name>
|
<name>button-24</name>
|
||||||
<desc>N1 select</desc>
|
<desc>N1 select</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("N1")</script>
|
<button>n1</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -466,8 +536,8 @@
|
||||||
<name>button-25</name>
|
<name>button-25</name>
|
||||||
<desc>VNAV</desc>
|
<desc>VNAV</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("VNAV")</script>
|
<button>vnav</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -475,8 +545,8 @@
|
||||||
<name>button-26</name>
|
<name>button-26</name>
|
||||||
<desc>LNAV</desc>
|
<desc>LNAV</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("LNAV")</script>
|
<button>lnav</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -484,8 +554,8 @@
|
||||||
<name>button-27</name>
|
<name>button-27</name>
|
||||||
<desc>CMD A</desc>
|
<desc>CMD A</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("CMD A")</script>
|
<button>command-a</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -493,8 +563,8 @@
|
||||||
<name>button-28</name>
|
<name>button-28</name>
|
||||||
<desc>CMD B</desc>
|
<desc>CMD B</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("CMD B")</script>
|
<button>command-b</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -502,17 +572,25 @@
|
||||||
<name>button-29</name>
|
<name>button-29</name>
|
||||||
<desc>AT arm</desc>
|
<desc>AT arm</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>property-assign</command>
|
||||||
<script>print("A/T ARM")</script>
|
<property>/input/goflight/mcp/autothrottle-armed</property>
|
||||||
|
<value>1</value>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>property-assign</command>
|
||||||
|
<property>/input/goflight/mcp/autothrottle-armed</property>
|
||||||
|
<value>0</value>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event>
|
<event>
|
||||||
<name>button-30</name>
|
<name>button-30</name>
|
||||||
<desc>Soeed crossover</desc>
|
<desc>Soeed crossover</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("SPD C/O")</script>
|
<button>speed-crossover</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -520,8 +598,8 @@
|
||||||
<name>button-31</name>
|
<name>button-31</name>
|
||||||
<desc>Speed intervention</desc>
|
<desc>Speed intervention</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("SPD INTV")</script>
|
<button>speed-intervention</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
@ -529,8 +607,8 @@
|
||||||
<name>button-32</name>
|
<name>button-32</name>
|
||||||
<desc>VOR / Localizer</desc>
|
<desc>VOR / Localizer</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>goflight-mcp-button</command>
|
||||||
<script>print("VOR/LOC")</script>
|
<button>vor</button>
|
||||||
</binding>
|
</binding>
|
||||||
</event>
|
</event>
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
314
Nasal/goflight.nas
Normal file
314
Nasal/goflight.nas
Normal file
|
@ -0,0 +1,314 @@
|
||||||
|
# helpers for working with GoFlight input devices
|
||||||
|
|
||||||
|
# map decimal digits 0..9 to standard 7-segment LCD pattern
|
||||||
|
var translateDigitToSevenSegment = [0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x67];
|
||||||
|
|
||||||
|
var formatFrequencyMHz = func(freqMhz, fieldWidth)
|
||||||
|
{
|
||||||
|
return bytesForString(sprintf("%.3f", freqMhz), fieldWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
var formatFrequencyKHz = func(freqKhz, fieldWidth)
|
||||||
|
{
|
||||||
|
return bytesForString(sprintf("%6.2f", freqKhz), fieldWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
var bytesForString = func(s, fieldWidth)
|
||||||
|
{
|
||||||
|
var padCount = fieldWidth - size(s);
|
||||||
|
var r = "";
|
||||||
|
|
||||||
|
while (padCount > 0) {
|
||||||
|
r ~= chr(0);
|
||||||
|
padCount -=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i=0; i < size(s); i += 1) {
|
||||||
|
if (s[i] == `.`) {
|
||||||
|
# set the high bit to correspond to the decimal
|
||||||
|
var lastIndex = size(r) - 1;
|
||||||
|
r[lastIndex] = r[lastIndex] + 0x80;
|
||||||
|
} else if (s[i] == ` `) { # spaces
|
||||||
|
r ~= chr(0);
|
||||||
|
} else if (s[i] == `-`) { # negative
|
||||||
|
r ~= chr(0x40);
|
||||||
|
} else {
|
||||||
|
var digitCode = s[i] - `0`;
|
||||||
|
r ~= chr(translateDigitToSevenSegment[digitCode]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
# TEST
|
||||||
|
# STBY
|
||||||
|
# OFF
|
||||||
|
# XPDR
|
||||||
|
# TA
|
||||||
|
# TA/RA
|
||||||
|
|
||||||
|
|
||||||
|
var translateTo14Segment = {
|
||||||
|
32: [0x0, 0x0], # space
|
||||||
|
65: [0x22, 0x37], # A
|
||||||
|
66: [0x0A, 0x8f],
|
||||||
|
67: [0x00, 0x39],
|
||||||
|
68: [0x08, 0x8f], # uppercase D
|
||||||
|
69: [0x22, 0x39],
|
||||||
|
70: [0x20, 0x31], # F
|
||||||
|
77: [0x00, 0x00], # upper M
|
||||||
|
78: [0x00, 0x00], # upper N
|
||||||
|
79: [0x00, 0x3f], # upper O
|
||||||
|
80: [0x22, 0x33], # upper P
|
||||||
|
82: [0x26, 0x33], # upper R
|
||||||
|
83: [0x22, 0x2d], # upper S
|
||||||
|
84: [0x08, 0x81], # T
|
||||||
|
88: [0x15, 0x40], # X
|
||||||
|
89: [0x09, 0x40] # Y
|
||||||
|
};
|
||||||
|
|
||||||
|
var formatFourteenSegment = func(s, fieldWidth)
|
||||||
|
{
|
||||||
|
var r = [];
|
||||||
|
for (var i=0; i < size(s); i += 1) {
|
||||||
|
var ch = s[i];
|
||||||
|
if (!contains(translateTo14Segment, ch)) {
|
||||||
|
debug.dump('No 14 segment mapping for:', ch);
|
||||||
|
} else {
|
||||||
|
var t = translateTo14Segment[s[i]];
|
||||||
|
append(r, t[0]);
|
||||||
|
append(r, t[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
var reverseBytes = func(bytes)
|
||||||
|
{
|
||||||
|
var r=[];
|
||||||
|
for (var i = size(bytes) - 1; i >=0; i -=1) {
|
||||||
|
append(r, bytes[i]);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
var MFRController = {
|
||||||
|
|
||||||
|
new: func(prefix)
|
||||||
|
{
|
||||||
|
var m = {
|
||||||
|
parents: [MFRController]
|
||||||
|
};
|
||||||
|
|
||||||
|
# m._hideTimer = maketimer(m.DELAY, m, Tooltip._hideTimeout);
|
||||||
|
# m._hideTimer.singleShot = 1;
|
||||||
|
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var mcp = {
|
||||||
|
init: func()
|
||||||
|
{
|
||||||
|
me._speedKnotsProp = props.globals.getNode("/autopilot/settings/target-speed-kt", 1);
|
||||||
|
me._speedMachProp = props.globals.getNode("/autopilot/settings/target-speed-mach", 1);
|
||||||
|
me._altitudeFtProp = props.globals.getNode("/autopilot/settings/target-altitude-ft", 1);
|
||||||
|
me._vsFPMProp = props.globals.getNode("/autopilot/settings/vertical-speed-fpm", 1);
|
||||||
|
me._headingProp = props.globals.getNode("/autopilot/settings/heading-bug-deg", 1);
|
||||||
|
me._course1Prop = props.globals.getNode("/instrumentation/nav[0]/radials/selected-deg", 1);
|
||||||
|
me._course2Prop = props.globals.getNode("/instrumentation/nav[1]/radials/selected-deg", 1);
|
||||||
|
|
||||||
|
me._useMach = 0;
|
||||||
|
me._refreshProp = props.globals.getNode("/input/goflight/mcp/refresh", 1);
|
||||||
|
me._refreshHeadingProp = props.globals.getNode("/input/goflight/mcp/refresh-headings", 1);
|
||||||
|
|
||||||
|
me._blankVSWindow = props.globals.getNode("/input/goflight/mcp/blank-vs-window", 1);
|
||||||
|
|
||||||
|
me._ledProps = [];
|
||||||
|
for (var l=0; l<4; l+=1) {
|
||||||
|
var node = props.globals.getNode("/input/goflight/mcp/led[" ~ l ~ "]", 1);
|
||||||
|
node.setIntValue(0);
|
||||||
|
append(me._ledProps, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
setlistener(me._speedKnotsProp, func { me.doRefresh(); } );
|
||||||
|
setlistener(me._speedMachProp, func { me.doRefresh(); });
|
||||||
|
setlistener(me._altitudeFtProp, func { me.doRefresh(); });
|
||||||
|
setlistener(me._vsFPMProp, func { me.doRefresh(); });
|
||||||
|
setlistener(me._blankVSWindow, func { me.doRefresh(); });
|
||||||
|
|
||||||
|
setlistener(me._headingProp, func { me.doRefreshHeading(); });
|
||||||
|
setlistener(me._course1Prop, func { me.doRefreshHeading(); });
|
||||||
|
setlistener(me._course2Prop, func { me.doRefreshHeading(); });
|
||||||
|
|
||||||
|
me.doRefresh();
|
||||||
|
me.doRefreshHeading();
|
||||||
|
|
||||||
|
print("GoFlight MCP init done");
|
||||||
|
},
|
||||||
|
|
||||||
|
setAltitudeFtProp: func(path)
|
||||||
|
{
|
||||||
|
me._altitudeFtProp = props.globals.getNode(path, 1);
|
||||||
|
setlistener(me._altitudeFtProp, func { me.doRefresh(); });
|
||||||
|
me.doRefresh();
|
||||||
|
},
|
||||||
|
|
||||||
|
doRefresh: func()
|
||||||
|
{
|
||||||
|
me._refreshProp.setIntValue(0);
|
||||||
|
},
|
||||||
|
|
||||||
|
doRefreshHeading: func()
|
||||||
|
{
|
||||||
|
me._refreshHeadingProp.setIntValue(0);
|
||||||
|
},
|
||||||
|
|
||||||
|
setMachMode: func(useMach)
|
||||||
|
{
|
||||||
|
me._useMach = useMach;
|
||||||
|
me.doRefresh();
|
||||||
|
},
|
||||||
|
|
||||||
|
altitudeData: func()
|
||||||
|
{
|
||||||
|
# if window is blanked, return empty data
|
||||||
|
var alt = me._altitudeFtProp.getValue();
|
||||||
|
return bytesForString(sprintf("%d", alt), 5);
|
||||||
|
},
|
||||||
|
|
||||||
|
vsData: func()
|
||||||
|
{
|
||||||
|
# if window is blanked, return empty data
|
||||||
|
if (me._blankVSWindow.getValue()) {
|
||||||
|
return bytesForString(" ", 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
var vs = me._vsFPMProp.getValue();
|
||||||
|
return bytesForString(sprintf("%d", vs), 5);
|
||||||
|
},
|
||||||
|
|
||||||
|
speedData: func()
|
||||||
|
{
|
||||||
|
if (me._useMach) {
|
||||||
|
var mach = me._speedMachProp.getValue();
|
||||||
|
return bytesForString(sprintf("%0.3f ", mach), 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
var spd = me._speedKnotsProp.getValue();
|
||||||
|
return bytesForString(sprintf("%d", spd), 5);
|
||||||
|
},
|
||||||
|
|
||||||
|
adjustSpeed: func(val)
|
||||||
|
{
|
||||||
|
if (me._useMach) {
|
||||||
|
var mach = me._speedMachProp.getValue();
|
||||||
|
me._speedMachProp.setDoubleValue(mach + (val * 0.01));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var spd = me._speedKnotsProp.getValue();
|
||||||
|
me._speedKnotsProp.setIntValue(spd + val);
|
||||||
|
},
|
||||||
|
|
||||||
|
adjustAltitude: func(val)
|
||||||
|
{
|
||||||
|
var alt = me._altitudeFtProp.getValue();
|
||||||
|
me._altitudeFtProp.setIntValue(alt + val);
|
||||||
|
},
|
||||||
|
|
||||||
|
headingData: func()
|
||||||
|
{
|
||||||
|
var h = me._headingProp.getValue();
|
||||||
|
return bytesForString(sprintf("%0d", h), 3);
|
||||||
|
},
|
||||||
|
|
||||||
|
course1Data: func()
|
||||||
|
{
|
||||||
|
var h = me._course1Prop.getValue();
|
||||||
|
return bytesForString(sprintf("%0d", h), 3);
|
||||||
|
},
|
||||||
|
|
||||||
|
course2Data: func()
|
||||||
|
{
|
||||||
|
var h = me._course2Prop.getValue();
|
||||||
|
return bytesForString(sprintf("%0d", h), 3);
|
||||||
|
},
|
||||||
|
|
||||||
|
_ledNames: {
|
||||||
|
'SPEED': [1, 0],
|
||||||
|
'LVL-CHG': [1, 1],
|
||||||
|
'HDG-SEL': [1, 2],
|
||||||
|
'APP': [1,3],
|
||||||
|
'ALT-HLD': [1,4],
|
||||||
|
'V/S': [1,5],
|
||||||
|
'F/O F/D': [1,7],
|
||||||
|
# bank 2
|
||||||
|
'CWS A': [2,1],
|
||||||
|
'CWS B': [2,2],
|
||||||
|
'CAP F/D': [2,6],
|
||||||
|
'N1': [2, 7],
|
||||||
|
# bank 3
|
||||||
|
'VNAV': [3,0],
|
||||||
|
'LNAV': [3,1],
|
||||||
|
'CMD A': [3,2],
|
||||||
|
'CMD B': [3,3],
|
||||||
|
'A/T ARM': [3,4],
|
||||||
|
'VOR-LOC': [3,7],
|
||||||
|
},
|
||||||
|
|
||||||
|
watchPropertyForLED: func(prop, ledName)
|
||||||
|
{
|
||||||
|
if (!contains(me._ledNames, ledName)) {
|
||||||
|
printlog('warn', 'Unknown GoFlight MCP LED:' ~ ledName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ledData = me._ledNames[ledName];
|
||||||
|
setlistener(prop, func(n) { me.setLED(ledData, n.getValue()); });
|
||||||
|
},
|
||||||
|
|
||||||
|
setLED: func(data, b)
|
||||||
|
{
|
||||||
|
# data is a pair of ints; the LED node and the bit within
|
||||||
|
var node = me._ledProps[data[0]];
|
||||||
|
var ledBits = node.getValue();
|
||||||
|
node.setIntValue(bits.switch(ledBits, data[1], b));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var flapPositions = [];
|
||||||
|
var flapsNode = nil;
|
||||||
|
|
||||||
|
_setlistener("/sim/signals/nasal-dir-initialized", func {
|
||||||
|
mcp.init();
|
||||||
|
|
||||||
|
# build flap axis quantisation data
|
||||||
|
flapsNode = props.globals.getNode("/controls/flight/flaps");
|
||||||
|
|
||||||
|
foreach (var c; props.globals.getNode("/sim/flaps").getChildren("setting")) {
|
||||||
|
var step = c.getValue();
|
||||||
|
append(flapPositions, step);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
var flapsAxisQuantized = func(val)
|
||||||
|
{
|
||||||
|
var normVal = (val + 1) * 0.5;
|
||||||
|
var numSteps = size(flapPositions);
|
||||||
|
for (var i=1; i<numSteps; i+=1) {
|
||||||
|
var midPoint = (flapPositions[i-1] + flapPositions[i]) * 0.5;
|
||||||
|
if (normVal < midPoint) {
|
||||||
|
#print('flap Q:' ~ normVal ~ " to " ~ flapPositions[i-1]);
|
||||||
|
flapsNode.setDoubleValue(flapPositions[i-1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#print('flap Q:' ~ normVal ~ " to " ~ flapPositions[numSteps-1]);
|
||||||
|
# if we fall off the end, we're at the final value
|
||||||
|
flapsNode.setDoubleValue(flapPositions[numSteps-1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
print("GoFlight Nasal module load done");
|
Loading…
Reference in a new issue