cost index works

This commit is contained in:
Joshua Davidson 2017-05-18 16:39:14 -04:00
parent 55e46817dd
commit a306b8e0ab
8 changed files with 153 additions and 15 deletions

View file

@ -343,6 +343,9 @@
</apu>
<FMGC n="0">
<internal>
<cost-index type="int">0</cost-index>
</internal>
<status>
<to-state type="bool">1</to-state>
</status>

View file

@ -381,7 +381,7 @@
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.045</y-m>
<z-m>0.0275</z-m>
<z-m>0.0285</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
@ -399,6 +399,44 @@
<height type="int">64</height>
</font-resolution>
</text>
<text>
<name>costindex3</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.045</y-m>
<z-m>0.0285</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">%s</format>
<truncate type="bool">false</truncate>
<font type="string">BoeingCDU-Large.ttf</font>
<property>/FMGC/internal/cost-index</property>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.0050</character-size>
<font-resolution>
<width type="int">64</width>
<height type="int">64</height>
</font-resolution>
</text>
<animation>
<type>select</type>
<object-name>costindex2</object-name>
<condition>
<not><property>/FMGC/internal/cost-index-set</property></not>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>costindex3</object-name>
<condition>
<property>/FMGC/internal/cost-index-set</property>
</condition>
</animation>
<text>
<name>wind</name>
@ -498,12 +536,12 @@
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.045</y-m>
<z-m>0.0170</z-m>
<z-m>0.0180</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">----- /---</format>
<format type="string">-----/---</format>
<truncate type="bool">false</truncate>
<font type="string">BoeingCDU-Large.ttf</font>
<property>autopilot/serviceable</property>
@ -521,7 +559,7 @@
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.045</y-m>
<z-m>0.0170</z-m>
<z-m>0.0180</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
@ -801,6 +839,7 @@
<object-name>tropovalue</object-name>
<object-name>LONG-val</object-name>
<object-name>LAT-val</object-name>
<object-name>costindex3</object-name>
<object-name>crzfltemp3</object-name>
<diffuse>
<red>0</red>

View file

@ -289,7 +289,7 @@
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.045</y-m>
<z-m>0.0275</z-m>
<z-m>0.0280</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
@ -360,7 +360,7 @@
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.045</y-m>
<z-m>0.0170</z-m>
<z-m>0.0180</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>

View file

@ -381,7 +381,7 @@
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.045</y-m>
<z-m>0.0275</z-m>
<z-m>0.0285</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
@ -399,6 +399,44 @@
<height type="int">64</height>
</font-resolution>
</text>
<text>
<name>costindex3</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.045</y-m>
<z-m>0.0285</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">%s</format>
<truncate type="bool">false</truncate>
<font type="string">BoeingCDU-Large.ttf</font>
<property>/FMGC/internal/cost-index</property>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.0050</character-size>
<font-resolution>
<width type="int">64</width>
<height type="int">64</height>
</font-resolution>
</text>
<animation>
<type>select</type>
<object-name>costindex2</object-name>
<condition>
<not><property>/FMGC/internal/cost-index-set</property></not>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>costindex3</object-name>
<condition>
<property>/FMGC/internal/cost-index-set</property>
</condition>
</animation>
<text>
<name>wind</name>
@ -498,12 +536,12 @@
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.045</y-m>
<z-m>0.0170</z-m>
<z-m>0.0180</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">----- /---</format>
<format type="string">-----/---</format>
<truncate type="bool">false</truncate>
<font type="string">BoeingCDU-Large.ttf</font>
<property>autopilot/serviceable</property>
@ -521,7 +559,7 @@
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.045</y-m>
<z-m>0.0170</z-m>
<z-m>0.0180</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>

View file

@ -289,7 +289,7 @@
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.045</y-m>
<z-m>0.0275</z-m>
<z-m>0.0280</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
@ -360,7 +360,7 @@
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.045</y-m>
<z-m>0.0170</z-m>
<z-m>0.0180</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>

View file

@ -13,7 +13,7 @@ var FMGCinit = func {
setprop("/FMGC/internal/cruise-ft", 10000);
setprop("/FMGC/internal/cruise-fl", 100);
setprop("/FMGC/internal/tropo", 36090);
setprop("/FMGC/internal/cost", " ");
setprop("/FMGC/internal/cost-index", "0");
setprop("/FMGC/internal/greendot-kts", 0);
phasecheck.start();
greendott.start();

View file

@ -12,6 +12,7 @@ var MCDU_reset = func {
setprop("/MCDU[0]/cost-index", 0);
setprop("/MCDU[0]/flight-num", 0);
setprop("/MCDU[0]/scratchpad", "");
setprop("/FMGC/internal/cost-index-set", 0);
setprop("/FMGC/internal/cruise-lvl-set", 0);
}
@ -23,6 +24,10 @@ var lskbutton = func(btn) {
setprop("/MCDU[0]/page", "STATUS");
}, 0.2);
}
} else if (btn == "5") {
if (getprop("/MCDU[0]/page") == "INITA") {
initInputA("L5");
}
} else if (btn == "6") {
if (getprop("/MCDU[0]/page") == "INITA") {
initInputA("L6");
@ -32,7 +37,31 @@ var lskbutton = func(btn) {
var initInputA = func(key) {
var scratchpad = getprop("/MCDU[0]/scratchpad");
if (key == "L6") {
if (key == "L5") {
if (scratchpad == "CLR") {
screenFlash(0.2);
setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0);
setprop("/MCDU[0]/scratchpad", "");
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (cis >= 0 and cis <= 120) {
screenFlash(0.2);
setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1);
setprop("/MCDU[0]/scratchpad", "");
} else {
screenFlash(0.2);
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
screenFlash(0.2);
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L6") {
if (scratchpad == "CLR") {
screenFlash(0.2);
setprop("/FMGC/internal/cruise-ft", 10000);

View file

@ -12,6 +12,7 @@ var MCDU_reset = func {
setprop("/MCDU[1]/cost-index", 0);
setprop("/MCDU[1]/flight-num", 0);
setprop("/MCDU[1]/scratchpad", "");
setprop("/FMGC/internal/cost-index-set", 0);
setprop("/FMGC/internal/cruise-lvl-set", 0);
}
@ -23,6 +24,10 @@ var lskbutton = func(btn) {
setprop("/MCDU[1]/page", "STATUS");
}, 0.2);
}
} else if (btn == "5") {
if (getprop("/MCDU[0]/page") == "INITA") {
initInputA("L5");
}
} else if (btn == "6") {
if (getprop("/MCDU[1]/page") == "INITA") {
initInputA("L6");
@ -32,7 +37,31 @@ var lskbutton = func(btn) {
var initInputA = func(key) {
var scratchpad = getprop("/MCDU[1]/scratchpad");
if (key == "L6") {
if (key == "L5") {
if (scratchpad == "CLR") {
screenFlash(0.2);
setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0);
setprop("/MCDU[1]/scratchpad", "");
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (cis >= 0 and cis <= 120) {
screenFlash(0.2);
setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1);
setprop("/MCDU[1]/scratchpad", "");
} else {
screenFlash(0.2);
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else {
screenFlash(0.2);
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L6") {
if (scratchpad == "CLR") {
screenFlash(0.2);
setprop("/FMGC/internal/cruise-ft", 10000);