WinWingFCUSync/WinWingFCU.xml

478 lines
13 KiB
XML
Raw Normal View History

<?xml version="1.0"?>
<PropertyList>
<name type="string">Winwing WINWING FCU-320</name>
<debug-events type="bool">true</debug-events>
<nasal>
<open>
<![CDATA[
setprop("/winwing/spd", "100");
setprop("/winwing/hdg", "360");
setprop("/winwing/alt", "10000");
setprop("/winwing/vs", "----");
var updateWinwingFCUDisplay = func() {
if (getprop("/it-autoflight/input/spd-managed")) {
setprop("/winwing/spd", "---");
} else if (getprop("/controls/switches/annun-test")) {
setprop("/winwing/spd", "888");
} else if (getprop("/it-autoflight/input/kts-mach")) {
setprop("/winwing/spd", getprop("/it-autoflight/input/mach") * 1000);
} else {
setprop("/winwing/spd", getprop("/it-autoflight/input/kts"));
}
if (getprop("/it-autoflight/custom/show-hdg") != true and getprop("/it-autoflight/output/lat") != 0) {
setprop("/winwing/hdg", "---");
} else if (getprop("/controls/switches/annun-test")) {
setprop("/winwing/hdg", "888");
} else {
setprop("/winwing/hdg", sprintf("%03.0f", getprop("/it-autoflight/input/hdg")));
}
if (getprop("/controls/switches/annun-test")) {
setprop("/winwing/alt", "88888");
} else {
setprop("/winwing/alt", sprintf("%05.0f", getprop("/it-autoflight/input/alt")));
}
if (getprop("/controls/switches/annun-test")) {
setprop("/winwing/vs", "8888");
} else if (getprop("/it-autoflight/output/vert") != 1 and getprop("/it-autoflight/output/vert") != 5) {
setprop("/winwing/vs", "----");
} else {
if (getprop("/it-autoflight/input/trk")) {
setprop("/winwing/vs", sprintf("%02.0f", math.abs(getprop("/it-autoflight/input/fpa")) * 10));
} else {
setprop("/winwing/vs", sprintf("%04.0f", getprop("/it-autoflight/input/vs-abs")));
}
}
var flags = "";
if (getprop("/controls/switches/annun-test") or getprop("/it-autoflight/input/kts-mach") == false) {
flags = flags ~ ",spd";
}
if (getprop("/controls/switches/annun-test") or getprop("/it-autoflight/input/kts-mach")) {
flags = flags ~ ",mach";
}
if (getprop("/controls/switches/annun-test") or getprop("/it-autoflight/input/spd-managed")) {
flags = flags ~ ",spd-mgt";
}
if (getprop("/controls/switches/annun-test") or getprop("/it-autoflight/output/lat") == 1 or getprop("/it-autoflight/output/lnav-armed")) {
flags = flags ~ ",lat";
}
if (getprop("/controls/switches/annun-test") or getprop("/it-autoflight/custom/trk-fpa") == false) {
flags = flags ~ ",hdg-vs";
}
if (getprop("/controls/switches/annun-test") or getprop("/it-autoflight/custom/trk-fpa")) {
flags = flags ~ ",trk-fpa";
}
if (getprop("/controls/switches/annun-test") or (((getprop("/it-autoflight/input/vs") >= 0 and getprop("/it-autoflight/custom/trk-fpa") == false) or (getprop("/it-autoflight/input/fpa") >= 0 and getprop("/it-autoflight/custom/trk-fpa"))) and (getprop("/it-autoflight/output/vert") == 1 or getprop("/it-autoflight/output/vert") == 5))) {
flags = flags ~ ",plus";
}
if (getprop("/controls/switches/annun-test") or getprop("/it-autoflight/output/ap1")) {
flags = flags ~ ",ap1";
}
if (getprop("/controls/switches/annun-test") or getprop("/it-autoflight/output/ap2")) {
flags = flags ~ ",ap2";
}
if (getprop("/controls/switches/annun-test") or getprop("/it-autoflight/output/athr")) {
flags = flags ~ ",athr";
}
if (getprop("/controls/switches/annun-test") or ((getprop("/it-autoflight/output/lat") == 2 or getprop("/it-autoflight/output/loc-arm") == 1) and getprop("/it-autoflight/output/gs-arm") == false and getprop("/it-autoflight/output/vert") != 2 and getprop("/it-autoflight/output/vert") != 6)) {
flags = flags ~ ",loc";
}
if (getprop("/controls/switches/annun-test") or getprop("/it-autoflight/output/gs-arm") or getprop("/it-autoflight/output/vert") == 2 or getprop("/it-autoflight/output/vert") == 6) {
flags = flags ~ ",appr";
}
setprop("/winwing/flags", flags);
return [0x00]; # dummy return so log doesn't get spammed anymore
};
var getButtonBrightnessReport = func(item, value) {
var r = [0x10, 0xBB, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
r[6] = item;
r[7] = int(value);
return r;
};
var updateWinwingFCUIntegLT = func() {
var value = getprop("/controls/lighting/fcu-panel-norm") * 255;
# debug.dump(getButtonBrightnessReport(0x00, value));
return getButtonBrightnessReport(0x00, value);
};
]]>
</open>
</nasal>
<hid-descriptor>
<report>
<type>input</type>
<id>1</id>
<button-1>
<size type="int">1</size>
<count type="int">128</count>
</button-1>
<unused-bits><size type="int">176</size></unused-bits>
</report>
<report>
<type>input</type>
<id>2</id>
<dummy-1>
<size type="int">8</size>
<count type="int">13</count>
</dummy-1>
<unused-bits><size type="int">0</size></unused-bits>
</report>
<report>
<type>output</type>
<id>2</id>
<display-0>
<size type="int">104</size>
<count type="int">1</count>
</display-0>
<unused-bits><size type="int">0</size></unused-bits>
</report>
<report>
<type>input</type>
<id>240</id>
<dummy2-1>
<size type="int">8</size>
<count type="int">63</count>
</dummy2-1>
<unused-bits><size type="int">0</size></unused-bits>
</report>
<report>
<type>output</type>
<id>240</id>
<display2-0>
<size type="int">8</size>
<count type="int">63</count>
</display2-0>
<unused-bits><size type="int">0</size></unused-bits>
</report>
</hid-descriptor>
<report>
<report-id type="int">2</report-id>
<type>output</type>
<watch>/controls/lighting/fcu-panel-norm</watch>
<nasal-function>updateWinwingFCUIntegLT</nasal-function>
</report>
<report>
<report-id type="int">2</report-id>
<type>output</type>
<watch>/it-autoflight/input/kts-mach</watch>
<watch>/it-autoflight/input/kts</watch>
<watch>/it-autoflight/input/mach</watch>
<watch>/it-autoflight/input/hdg</watch>
<watch>/it-autoflight/input/alt</watch>
<watch>/it-autoflight/output/vs-fcu-display</watch>
<watch>/controls/switches/annun-test</watch>
<nasal-function>updateWinwingFCUDisplay</nasal-function>
</report>
<!--report>
<type>feature</type>
<watch>/controls/lighting/fcu-digit-norm</watch>
<nasal-function>updateWinwingFCUDisplayBrightness</nasal-function>
</report-->
<event>
<name>button-1</name>
<desc type="string">IAS/Mach</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.IASMach();
</script>
</binding>
</event>
<event>
<name>button-2</name>
<desc type="string">LOC</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.LOCButton();
</script>
</binding>
</event>
<event>
<name>button-3</name>
<desc type="string">Track/Fligtht Path Angle</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.TRKFPA();
</script>
</binding>
</event>
<event>
<name>button-4</name>
<desc type="string">Autopilot 1</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.AP1();
</script>
</binding>
</event>
<event>
<name>button-5</name>
<desc type="string">Autopilot 2</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.AP2();
</script>
</binding>
</event>
<event>
<name>button-6</name>
<desc type="string">Autothrust</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.ATHR();
</script>
</binding>
</event>
<event>
<name>button-7</name>
<desc type="string">Expedite</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
</script>
</binding>
</event>
<event>
<name>button-8</name>
<desc type="string">Metric ALT</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.MetricAlt();
</script>
</binding>
</event>
<event>
<name>button-9</name>
<desc type="string">Approach</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.APPRButton();
</script>
</binding>
</event>
<event>
<name>button-10</name>
<desc type="string">Speed decrease</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.SPDAdjust(-1);
</script>
</binding>
</event>
<event>
<name>button-11</name>
<desc type="string">Speed increase</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.SPDAdjust(1);
</script>
</binding>
</event>
<event>
<name>button-12</name>
<desc type="string">Speed Push</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.SPDPush();
</script>
</binding>
</event>
<event>
<name>button-13</name>
<desc type="string">Speed Pull</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.SPDPull();
</script>
</binding>
</event>
<event>
<name>button-14</name>
<desc type="string">Heading decrease</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.HDGAdjust(-1);
</script>
</binding>
</event>
<event>
<name>button-15</name>
<desc type="string">Heading increase</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.HDGAdjust(1);
</script>
</binding>
</event>
<event>
<name>button-16</name>
<desc type="string">Heading push</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.HDGPush();
</script>
</binding>
</event>
<event>
<name>button-17</name>
<desc type="string">Heading pull</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.HDGPull();
</script>
</binding>
</event>
<event>
<name>button-18</name>
<desc type="string">Altitude decrease</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.ALTAdjust(-1);
</script>
</binding>
</event>
<event>
<name>button-19</name>
<desc type="string">Altitude increase</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.ALTAdjust(1);
</script>
</binding>
</event>
<event>
<name>button-20</name>
<desc type="string">Altitude Push</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.ALTPush();
</script>
</binding>
</event>
<event>
<name>button-21</name>
<desc type="string">Altitude pull</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.ALTPull();
</script>
</binding>
</event>
<event>
<name>button-22</name>
<desc type="string">Vertical Speed decrease</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.VSAdjust(-1);
</script>
</binding>
</event>
<event>
<name>button-23</name>
<desc type="string">Vertical Speed increase</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.VSAdjust(1);
</script>
</binding>
</event>
<event>
<name>button-24</name>
<desc type="string">Vertical Speed push</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.VSPush();
</script>
</binding>
</event>
<event>
<name>button-25</name>
<desc type="string">Vertical Speed pull</desc>
<repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
fcu.FCUController.VSPull();
</script>
</binding>
</event>
<event>
<name>button-26</name>
<desc type="string">Altitude mode 100</desc>
<repeatable type="string">false</repeatable>
<binding>
<command>property-assign</command>
<property>it-autoflight/config/altitude-dial-mode</property>
<value>0</value>
</binding>
</event>
<event>
<name>button-27</name>
<desc type="string">Altitude mode 1000</desc>
<repeatable type="string">false</repeatable>
<binding>
<command>property-assign</command>
<property>it-autoflight/config/altitude-dial-mode</property>
<value>1</value>
</binding>
</event>
</PropertyList>