1
0
Fork 0

CDU: additional lines/pages and button actions

This commit is contained in:
Gijs de Rooy 2011-01-13 19:43:16 +01:00
parent ebf1ed2844
commit 83095bf421
2 changed files with 218 additions and 3 deletions

View file

@ -1,6 +1,30 @@
var input = func(v) {
setprop("/instrumentation/cdu/input",getprop("/instrumentation/cdu/input")~v);
}
var delete = func {
var length = size(getprop("/instrumentation/cdu/input")) - 1;
setprop("/instrumentation/cdu/input",substr(getprop("/instrumentation/cdu/input"),0,length));
}
var i = 0;
var plusminus = func {
var end = size(getprop("/instrumentation/cdu/input"));
var start = end - 1;
var lastchar = substr(getprop("/instrumentation/cdu/input"),start,end);
if (lastchar == "+"){
me.delete();
me.input('-');
}
if (lastchar == "-"){
me.delete();
me.input('+');
}
if ((lastchar != "-") and (lastchar != "+")){
me.input('+');
}
}
var cdu = func{
@ -25,6 +49,10 @@ var cdu = func{
}
if (page == "APP_REF") {
title = "APPROACH REF";
line1lt = "GROSS WT";
line1rt = "FLAPS VREF";
line1l = getprop("/instrumentation/fmc/vspeeds/Vref");
line4lt = getprop("/autopilot/route-manager/destination/airport");
line6l = "<INDEX";
line6r = "THRUST LIM>";
}
@ -79,7 +107,7 @@ var cdu = func{
title = "INIT/REF INDEX";
line1l = "<IDENT";
line1r = "NAV DATA>";
line2l = "<POST";
line2l = "<POS";
line3l = "<PERF";
line4l = "<THRUST LIM";
line5l = "<TAKEOFF";
@ -104,8 +132,13 @@ var cdu = func{
title = "PERF INIT";
line1lt = "GR WT";
line1rt = "CRZ ALT";
line1r = getprop("/autopilot/route-manager/cruise/altitude-ft");
line2lt = "FUEL";
line3lt = "ZFW";
line4lt = "RESERVES";
line4rt = "CRZ CG";
line5lt = "COST INDEX";
line5rt = "STEP SIZE";
line6l = "<INDEX";
line6r = "THRUST LIM>";
if (getprop("/sim/flight-model") == "jsb") {
@ -134,6 +167,9 @@ var cdu = func{
}
if (page == "POS_REF") {
title = "POS REF";
line1lt = "FMC POST";
line1l = getprop("/position/latitude-string")~" "~getprop("/position/longitude-string");
line1rt = "GS";
line1r = sprintf("%3.0f", getprop("/velocities/groundspeed-kt"));
line5l = "<PURGE";
line5r = "INHIBIT>";
@ -148,10 +184,34 @@ var cdu = func{
line1r = getprop("/autopilot/route-manager/destination/airport");
line2lt = "RUNWAY";
line2l = getprop("/autopilot/route-manager/departure/runway");
line3rt = "FLT NO";
line3rt = "CO ROUTE";
line5l = "<RTE COPY";
line6l = "<RTE 2";
line6r = "ACTIVATE>";
}
if (page == "RTE1_2") {
title = "RTE 1";
line1lt = "VIA";
line1rt = "TO";
if (getprop("/autopilot/route-manager/route/wp[1]/id") != nil){
line1r = getprop("/autopilot/route-manager/route/wp[1]/id");
}
if (getprop("/autopilot/route-manager/route/wp[2]/id") != nil){
line2r = getprop("/autopilot/route-manager/route/wp[2]/id");
}
if (getprop("/autopilot/route-manager/route/wp[3]/id") != nil){
line3r = getprop("/autopilot/route-manager/route/wp[3]/id");
}
if (getprop("/autopilot/route-manager/route/wp[4]/id") != nil){
line4r = getprop("/autopilot/route-manager/route/wp[4]/id");
}
if (getprop("/autopilot/route-manager/route/wp[5]/id") != nil){
line5r = getprop("/autopilot/route-manager/route/wp[5]/id");
}
line6l = "<RTE 2";
line6r = "ACTIVATE>";
}
if (page == "RTE1_DEP") {
title = getprop("/autopilot/route-manager/departure/airport")~" DEPARTURES";
line1r = getprop("/autopilot/route-manager/departure/runway");
@ -164,6 +224,22 @@ var cdu = func{
line6l = "<INDEX";
line6r = "ROUTE>";
}
if (page == "THR_LIM") {
title = "THRUST LIM";
line1lt = "SEL";
line1ct = "OAT";
line1c = sprintf("%2.0f", getprop("/environment/temperature-degc"))~" °C";
line1rt = "TO 1 N1";
line2l = "<TO";
line2r = "CLB>";
line3lt = "TO 1";
line3c = "<SEL> <ARM>";
line3r = "CLB 1>";
line4lt = "TO 2";
line4r = "CLB 2>";
line6l = "<INDEX";
line6r = "TAKEOFF>";
}
if (page == "TO_REF") {
title = "TAKEOFF REF";
line1lt = "FLAP/ACCEL HT";
@ -177,8 +253,10 @@ var cdu = func{
line3rt = "REF V2";
line3r = sprintf("%3.0f", getprop("/instrumentation/fmc/vspeeds/V2"));
line4lt = "WIND/SLOPE";
line4rt = "TRIM CG";
line5rt = "POS SHIFT";
line6l = "<INDEX";
line6r = "POST INIT>";
line6r = "POS INIT>";
}
setprop("/instrumentation/cdu/output/title",title);
setprop("/instrumentation/cdu/output/line1/left",line1l);
@ -219,4 +297,4 @@ var cdu = func{
setprop("/instrumentation/cdu/output/line6/right-title",line6rt);
settimer(cdu,0.2);
}
_setlistener("/sim/signals/fdm-initialized", cdu);
_setlistener("/sim/signals/fdm-initialized", cdu);

View file

@ -1061,6 +1061,26 @@
</action>
</animation>
<animation>
<type>pick</type>
<object-name>Btn.side.l.4</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<condition>
<equals>
<property>/instrumentation/cdu/display</property>
<value>INIT_REF</value>
</equals>
</condition>
<command>property-assign</command>
<property>/instrumentation/cdu/display</property>
<value type="string">THR_LIM</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>Btn.side.l.5</object-name>
@ -1123,6 +1143,10 @@
<property>/instrumentation/cdu/display</property>
<value>POS_REF</value>
</equals>
<equals>
<property>/instrumentation/cdu/display</property>
<value>THR_LIM</value>
</equals>
<equals>
<property>/instrumentation/cdu/display</property>
<value>TO_REF</value>
@ -1142,6 +1166,17 @@
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<condition>
<equals>
<property>/instrumentation/cdu/display</property>
<value>APP_REF</value>
</equals>
</condition>
<command>property-assign</command>
<property>/instrumentation/cdu/display</property>
<value type="string">THR_LIM</value>
</binding>
<binding>
<condition>
<or>
@ -1217,6 +1252,17 @@
<property>/autopilot/route-manager/input</property>
<value type="string">@activate</value>
</binding>
<binding>
<condition>
<equals>
<property>/instrumentation/cdu/display</property>
<value>THR_LIM</value>
</equals>
</condition>
<command>property-assign</command>
<property>/instrumentation/cdu/display</property>
<value type="string">TO_REF</value>
</binding>
</action>
</animation>
@ -1290,6 +1336,45 @@
</action>
</animation>
<animation>
<type>pick</type>
<object-name>Btn.prev-page</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<condition>
<equals>
<property>/instrumentation/cdu/display</property>
<value>RTE1_2</value>
</equals>
</condition>
<command>property-assign</command>
<property>/instrumentation/cdu/display</property>
<value>RTE1_1</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>Btn.next-page</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<condition>
<equals>
<property>/instrumentation/cdu/display</property>
<value>RTE1_1</value>
</equals>
</condition>
<command>property-assign</command>
<property>/instrumentation/cdu/display</property>
<value>RTE1_2</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
@ -1772,6 +1857,58 @@
</action>
</animation>
<animation>
<type>pick</type>
<object-name>Btn.plusminus</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>cdu.plusminus();</script>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>Btn.sp</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>cdu.input(' ');</script>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>Btn.slash</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>cdu.input('/');</script>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>Btn.del</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>cdu.delete();</script>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>Btn.clr</object-name>