1
0
Fork 0

Manual merge of work completed by inuyaksa:

- long pressing CLR button (keyboard/MCDU panel) clears scratchpad
- abort button for panel state dialog, when error occurs on state
  script, you can't close panel
- fix MCDU starting page, arrow color and REQ state
  (https://youtu.be/twwUjHXdNVU?t=57)
- PERFTO, validation on insert of V1/Vr/V2 values and type II error
  messages
- PERFTO, basic validation of THRRED/ACC
This commit is contained in:
legoboyvdlp R 2020-12-31 20:03:47 +00:00
parent b4fee1995b
commit 2298a87e4b
12 changed files with 313 additions and 82 deletions

View file

@ -1918,20 +1918,37 @@
<key n="8">
<name>Del</name>
<desc>CLR</desc>
<repeatable type="bool">true</repeatable>
<binding>
<condition>
<property>/FMGC/keyboard-left</property>
</condition>
<command>nasal</command>
<script>mcdu.button("CLR", 0);</script>
<script>mcdu.button("CLR", 0, "down");</script>
</binding>
<binding>
<condition>
<property>/FMGC/keyboard-right</property>
</condition>
<command>nasal</command>
<script>mcdu.button("CLR", 1);</script>
<script>mcdu.button("CLR", 1, "down");</script>
</binding>
<mod-up>
<binding>
<condition>
<property>/FMGC/keyboard-left</property>
</condition>
<command>nasal</command>
<script>mcdu.button("CLR", 0, "up");</script>
</binding>
<binding>
<condition>
<property>/FMGC/keyboard-right</property>
</condition>
<command>nasal</command>
<script>mcdu.button("CLR", 1, "up");</script>
</binding>
</mod-up>
</key>
<key n="11">
<name>Disable MCDU keyboard mode</name>

View file

@ -196,10 +196,10 @@ var renderingSettings = {
check: func() {
var rembrandt = getprop("/sim/rendering/rembrandt/enabled");
var ALS = getprop("/sim/rendering/shaders/skydome");
var customSettings = getprop("/sim/rendering/shaders/custom-settings") == 1;
var landmass = getprop("/sim/rendering/shaders/landmass") >= 4;
var model = getprop("/sim/rendering/shaders/model") >= 2;
if (!rembrandt and (!ALS or !customSettings or !landmass or !model)) {
if (!rembrandt and (!ALS or !landmass or !model)) {
rendering_dlg.open();
}
},
@ -255,6 +255,15 @@ var writeSettings = func {
# Panel States #
################
# Abort auto-config and close dialog
var abortPanelStates = func {
if (getprop("/systems/acconfig/autoconfig-running") == 1) {
setprop("/systems/acconfig/autoconfig-running", 0);
}
ps_load_dlg.close();
spinning.stop();
}
# Cold and Dark
var colddark = func {
if (getprop("/systems/acconfig/mismatch-code") == "0x000") {
@ -301,6 +310,7 @@ var colddark = func {
}
}
var colddark_b = func {
if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted
# Continues the Cold and Dark script, after engines fully shutdown.
setprop("/controls/apu/master", 0);
settimer(func {
@ -351,6 +361,7 @@ var beforestart = func {
}
}
var beforestart_b = func {
if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted
# Continue with engine start prep.
systems.FUEL.Switches.pumpLeft1.setValue(1);
systems.FUEL.Switches.pumpLeft2.setValue(1);
@ -438,6 +449,7 @@ var taxi = func {
}
}
var taxi_b = func {
if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted
# Continue with engine start prep, and start engines.
systems.FUEL.Switches.pumpLeft1.setValue(1);
systems.FUEL.Switches.pumpLeft2.setValue(1);
@ -491,6 +503,7 @@ var taxi_b = func {
settimer(taxi_c, 2);
}
var taxi_c = func {
if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted
setprop("/controls/engines/engine-start-switch", 2);
setprop("/controls/engines/engine[0]/cutoff-switch", 0);
setprop("/controls/engines/engine[1]/cutoff-switch", 0);
@ -499,6 +512,7 @@ var taxi_c = func {
}, 10);
}
var taxi_d = func {
if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted
# After Start items.
setprop("/controls/engines/engine-start-switch", 1);
setprop("/controls/apu/master", 0);

View file

@ -37,6 +37,16 @@
<property>/systems/acconfig/spin</property>
<live>1</live>
</text>
<button>
<halign>center</halign>
<legend>Abort</legend>
<pref-width>160</pref-width>
<key>Esc</key>
<binding>
<command>nasal</command>
<script>acconfig.abortPanelStates();</script>
</binding>
</button>
</group>

View file

@ -155,6 +155,8 @@ var pageProp = [props.globals.getNode("/MCDU[0]/page", 1), props.globals.getNode
var active = [props.globals.getNode("/MCDU[0]/active", 1), props.globals.getNode("/MCDU[1]/active", 1)];
var activeAtsu = [props.globals.getNode("/MCDU[0]/atsu-active", 1), props.globals.getNode("/MCDU[1]/atsu-active", 1)];
var reqFMGC = [0,0]; # flag = 1 when REQ is show
# Conversion factor pounds to kilogram
var LBS2KGS = 0.4535924;
@ -198,23 +200,23 @@ var canvas_MCDU_base = {
me["PERFTO_FE"].setFont(symbol);
me["PERFTO_SE"].setFont(symbol);
me["PERFTO_OE"].setFont(symbol);
me["PERFTO_FE"].setColor(0.8078,0.8039,0.8078);
me["PERFTO_SE"].setColor(0.8078,0.8039,0.8078);
me["PERFTO_OE"].setColor(0.8078,0.8039,0.8078);
me["PERFTO_FE"].setColor(BLUE);
me["PERFTO_SE"].setColor(BLUE);
me["PERFTO_OE"].setColor(BLUE);
me["PERFAPPR_FE"].setFont(symbol);
me["PERFAPPR_SE"].setFont(symbol);
me["PERFAPPR_OE"].setFont(symbol);
me["PERFAPPR_FE"].setColor(0.8078,0.8039,0.8078);
me["PERFAPPR_SE"].setColor(0.8078,0.8039,0.8078);
me["PERFAPPR_OE"].setColor(0.8078,0.8039,0.8078);
me["PERFAPPR_FE"].setColor(BLUE);
me["PERFAPPR_SE"].setColor(BLUE);
me["PERFAPPR_OE"].setColor(BLUE);
me["PERFGA_FE"].setFont(symbol);
me["PERFGA_SE"].setFont(symbol);
me["PERFGA_OE"].setFont(symbol);
me["PERFGA_FE"].setColor(0.8078,0.8039,0.8078);
me["PERFGA_SE"].setColor(0.8078,0.8039,0.8078);
me["PERFGA_OE"].setColor(0.8078,0.8039,0.8078);
me["PERFGA_FE"].setColor(BLUE);
me["PERFGA_SE"].setColor(BLUE);
me["PERFGA_OE"].setColor(BLUE);
me.page = canvas_group;
@ -280,7 +282,7 @@ var canvas_MCDU_base = {
me["PERFTO"].hide();
},
defaultPageNumbers: func() {
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me["Simple_PageNum"].setText("X/X");
me["Simple_PageNum"].hide();
me["ArrowLeft"].hide();
@ -497,29 +499,42 @@ var canvas_MCDU_base = {
me.standardFontColour();
me["Simple_L3"].setText(" AIDS");
me["Simple_L4"].setText(" CFDS");
pageSwitch[i].setBoolValue(1);
}
if (active[i].getValue() == 0) {
if (active[i].getValue() == 0 and reqFMGC[i] == 0) {
me["Simple_L1"].setText(" FMGC");
me["Simple_L1"].setColor(1,1,1);
me["Simple_L1"].setColor(GREEN);
me["Simple_L1_Arrow"].setColor(GREEN);
reqFMGC[i] = 1;
settimer(func {
if (active[i].getValue() == 0) {
me["Simple_L1"].setText(" FMGC (REQ)");
}
},1.4); #delay estimated
} else if (active[i].getValue() == 1) {
me["Simple_L1"].setText(" FMGC(SEL)");
me["Simple_L1"].setColor(0.0901,0.6039,0.7176);
me["Simple_L1"].setText(" FMGC (SEL)");
me["Simple_L1"].setColor(BLUE);
me["Simple_L1_Arrow"].setColor(BLUE);
} else if (active[i].getValue() == 2) {
me["Simple_L1"].setText(" FMGC");
me["Simple_L1"].setColor(0.0509,0.7529,0.2941);
me["Simple_L1"].setColor(GREEN);
me["Simple_L1_Arrow"].setColor(GREEN);
}
if (activeAtsu[i].getValue() == 0) {
me["Simple_L2"].setText(" ATSU");
me["Simple_L2"].setColor(1,1,1);
me["Simple_L2"].setColor(WHITE);
me["Simple_L2_Arrow"].setColor(WHITE);
} else if (activeAtsu[i].getValue() == 1) {
me["Simple_L2"].setText(" ATSU(SEL)");
me["Simple_L2"].setColor(0.0901,0.6039,0.7176);
me["Simple_L2"].setText(" ATSU (SEL)");
me["Simple_L2"].setColor(BLUE);
me["Simple_L2_Arrow"].setColor(BLUE);
} else if (activeAtsu[i].getValue() == 2) {
me["Simple_L2"].setText(" ATSU");
me["Simple_L2"].setColor(0.0509,0.7529,0.2941);
me["Simple_L2"].setColor(GREEN);
me["Simple_L2_Arrow"].setColor(GREEN);
}
} else if (page == "ATSUDLINK") {
if (!pageSwitch[i].getBoolValue()) {
@ -912,7 +927,7 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me.defaultHide();
me["Simple_Title"].setText("ATC MENU");
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me["Simple_PageNum"].setText("1/2");
me["Simple_PageNum"].show();
me["ArrowLeft"].show();
@ -958,7 +973,7 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me.defaultHideWithCenter();
me["Simple_Title"].setText("TEXT");
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me["Simple_PageNum"].setText("1/2");
me["Simple_PageNum"].show();
me["ArrowLeft"].show();
@ -1049,7 +1064,7 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me.defaultHideWithCenter();
me["Simple_Title"].setText("ATC MENU");
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me["Simple_PageNum"].setText("2/2");
me["Simple_PageNum"].show();
me["ArrowLeft"].show();
@ -1146,7 +1161,7 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me.defaultHideWithCenter();
me["Simple_Title"].setText("ATS623 ATIS MENU");
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me["Simple_PageNum"].hide();
me["ArrowLeft"].hide();
me["ArrowRight"].hide();
@ -1907,7 +1922,7 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me.defaultHide();
me["Simple_Title"].setText("DATA INDEX");
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me["Simple_PageNum"].setText("1/2");
me["Simple_PageNum"].show();
me["ArrowLeft"].show();
@ -1947,7 +1962,7 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me.defaultHide();
me["Simple_Title"].setText("DATA INDEX");
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me["Simple_PageNum"].setText("2/2");
me["Simple_PageNum"].show();
me["ArrowLeft"].show();
@ -2228,7 +2243,7 @@ var canvas_MCDU_base = {
me["PERFGA"].hide();
me["Simple_Title"].show();
me["Simple_Title"].setText("INIT");
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me["Simple_PageNum"].setText("X/X");
me["Simple_PageNum"].hide();
me["ArrowLeft"].show();
@ -2272,12 +2287,12 @@ var canvas_MCDU_base = {
if (!fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.costIndexSet) {
me["INITA_CostIndex"].hide();
me["Simple_L5"].setColor(1,1,1);
me["Simple_L5"].setColor(WHITE);
me["Simple_L5"].show();
me["Simple_L5"].setText("---");
} else if (fmgc.FMGCInternal.costIndexSet) {
me["INITA_CostIndex"].hide();
me["Simple_L5"].setColor(0.0901,0.6039,0.7176);
me["Simple_L5"].setColor(BLUE);
me["Simple_L5"].show();
me["Simple_L5"].setText(sprintf("%s", fmgc.FMGCInternal.costIndex));
} else {
@ -2286,28 +2301,40 @@ var canvas_MCDU_base = {
}
if (!fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.crzSet) {
me["INITA_CruiseFLTemp"].hide();
me["Simple_L6"].setColor(1,1,1);
me["Simple_L6"].setColor(WHITE);
me["Simple_L6"].setText("-----/---g");
} else if (fmgc.FMGCInternal.crzSet and fmgc.FMGCInternal.crzTempSet) {
me["INITA_CruiseFLTemp"].hide();
me["Simple_L6"].setColor(0.0901,0.6039,0.7176);
me["Simple_L6"].setColor(BLUE);
me["Simple_L6"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzFl) ~ sprintf("/%sg", fmgc.FMGCInternal.crzTemp));
} else if (fmgc.FMGCInternal.crzSet) {
me["INITA_CruiseFLTemp"].hide();
me["Simple_L6"].setColor(0.0901,0.6039,0.7176);
me["Simple_L6"].setColor(BLUE);
fmgc.FMGCInternal.crzTemp = 15 - (2 * fmgc.FMGCInternal.crzFl / 10);
fmgc.FMGCInternal.crzTempSet = 1;
me["Simple_L6"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzFl) ~ sprintf("/%sg", fmgc.FMGCInternal.crzTemp));
} else {
me["INITA_CruiseFLTemp"].show();
me["Simple_L6"].setColor(0.7333,0.3803,0);
me["Simple_L6"].setColor(AMBER);
me["Simple_L6"].setText(" g");
}
if (fmgc.FMGCInternal.coRouteSet) { # show coRoute when valid
me["INITA_CoRoute"].hide();
me["Simple_L1"].setText(fmgc.FMGCInternal.coRoute);
me["Simple_L1"].setColor(BLUE);
me["Simple_L1"].show();
} else {
me["Simple_L1"].hide();
me["INITA_CoRoute"].show();
me["Simple_L1"].setText("NONE");
}
if (fmgc.FMGCInternal.toFromSet) {
me["INITA_CoRoute"].hide();
me["INITA_FromTo"].hide();
me["Simple_L1"].show();
me["Simple_L2"].setColor(0.0901,0.6039,0.7176);
me["Simple_L2"].setColor(BLUE);
if (fmgc.FMGCInternal.altAirportSet) {
me["Simple_L2"].setText(fmgc.FMGCInternal.altAirport);
} else {
@ -2320,7 +2347,7 @@ var canvas_MCDU_base = {
me["INITA_CoRoute"].show();
me["INITA_FromTo"].show();
me["Simple_L1"].hide();
me["Simple_L2"].setColor(1,1,1);
me["Simple_L2"].setColor(WHITE);
me["Simple_L2"].setText("----/----------");
me.showRight(-1, 1, 0, 0, 0, 0);
me["Simple_R2S"].show();
@ -2364,7 +2391,7 @@ var canvas_MCDU_base = {
me["Simple_L3S"].setText("FLT NBR");
me["Simple_L5S"].setText("COST INDEX");
me["Simple_L6S"].setText("CRZ FL/TEMP");
me["Simple_L1"].setText("NONE");
#me["Simple_L1"].setText("NONE"); # manage before (coRoute)
me["Simple_L3"].setText(sprintf("%s", fmgc.FMGCInternal.flightNum));
me["Simple_R1S"].setText("FROM/TO ");
me["Simple_R2S"].setText("INIT ");
@ -2666,7 +2693,7 @@ var canvas_MCDU_base = {
me["Simple_R5"].setText(fmgc.FMGCInternal.tripWind);
me["Simple_R6S"].setText("EXTRA/TIME");
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
if (!fmgc.FMGCInternal.fuelRequest) {
me["Simple_L2"].setText("---.-/----");
@ -2706,7 +2733,7 @@ var canvas_MCDU_base = {
me["Simple_R6"].setText("---.-/----");
me["Simple_Title"].setText("INIT");
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me.colorLeft("ack", "wht", "wht", "wht", "wht", "wht");
me.colorRight("ack", "blu", "amb", "wht", "ack", "wht");
@ -3059,7 +3086,7 @@ var canvas_MCDU_base = {
me["PERFGA"].hide();
me["Simple_Title"].show();
me["Simple_Title"].setText("FUEL PRED");
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me["Simple_PageNum"].setText("X/X");
me["Simple_PageNum"].hide();
me["ArrowLeft"].show();
@ -3387,7 +3414,7 @@ var canvas_MCDU_base = {
}
me["Simple_Title"].show();
me["Simple_Title"].setColor(0.0509,0.7529,0.2941);
me["Simple_Title"].setColor(GREEN);
me["Simple_PageNum"].setText("X/X");
me["Simple_PageNum"].hide();
me["ArrowLeft"].hide();
@ -3570,9 +3597,9 @@ var canvas_MCDU_base = {
}
if (fmgc.FMGCInternal.phase == 1) {
me["Simple_Title"].setColor(0.0509,0.7529,0.2941);
me["Simple_Title"].setColor(GREEN);
} else {
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
}
if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) {
@ -3701,7 +3728,7 @@ var canvas_MCDU_base = {
}
if (fmgc.FMGCInternal.phase == 2) {
me["Simple_Title"].setColor(0.0509,0.7529,0.2941);
me["Simple_Title"].setColor(GREEN);
me.showLeft(0, 0, 0, 0, 1, 0);
me.showLeftS(0, 0, 0, 0, 1, 0);
me.showLeftArrow(0, 0, 0, 0, 1, 1);
@ -3742,7 +3769,7 @@ var canvas_MCDU_base = {
setprop("/FMGC/internal/activate-twice", 0);
}
} else {
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me.showLeft(0, 0, 0, 0, -1, 0);
me.showLeftS(0, 0, 0, 0, -1, 0);
me.showLeftArrow(0, 0, 0, 0, -1, 0);
@ -3776,10 +3803,10 @@ var canvas_MCDU_base = {
me["Simple_L2S"].setText(" CI");
if (fmgc.FMGCInternal.costIndexSet) {
me["Simple_L2"].setColor(0.0901,0.6039,0.7176);
me["Simple_L2"].setColor(BLUE);
me["Simple_L2"].setText(sprintf(" %s", fmgc.FMGCInternal.costIndex));
} else {
me["Simple_L2"].setColor(1,1,1);
me["Simple_L2"].setColor(WHITE);
me["Simple_L2"].setText(" ---");
}
@ -3854,7 +3881,7 @@ var canvas_MCDU_base = {
}
if (fmgc.FMGCInternal.phase == 3) {
me["Simple_Title"].setColor(0.0509,0.7529,0.2941);
me["Simple_Title"].setColor(GREEN);
if (managedSpeed.getValue() == 1) {
me.showLeft(0, 0, 0, -1, 0, 0);
@ -3889,7 +3916,7 @@ var canvas_MCDU_base = {
setprop("/FMGC/internal/activate-twice", 0);
}
} else {
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me.colorLeft("ack", "ack", "ack", "ack", "ack", "wht");
me.colorLeftS("ack", "ack", "ack", "ack", "ack", "wht");
@ -3916,10 +3943,10 @@ var canvas_MCDU_base = {
}
if (fmgc.FMGCInternal.costIndexSet) {
me["Simple_L2"].setColor(0.0901,0.6039,0.7176);
me["Simple_L2"].setColor(BLUE);
me["Simple_L2"].setText(sprintf(" %s", fmgc.FMGCInternal.costIndex));
} else {
me["Simple_L2"].setColor(1,1,1);
me["Simple_L2"].setColor(WHITE);
me["Simple_L2"].setText(" ---");
}
@ -3992,7 +4019,7 @@ var canvas_MCDU_base = {
}
if (fmgc.FMGCInternal.phase == 4) {
me["Simple_Title"].setColor(0.0509,0.7529,0.2941);
me["Simple_Title"].setColor(GREEN);
me.showLeft(0, 0, 0, 0, 1, 0);
me.showRight(0, 1, 0, 1, 0, 0);
me.showRightS(0, 0, 1, 0, 0, 0);
@ -4032,7 +4059,7 @@ var canvas_MCDU_base = {
setprop("/FMGC/internal/activate-twice", 0);
}
} else {
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
me.showLeft(0, 0, 0, 0, -1, 0);
me.showRight(0, -1, 0, -1, 0, 0);
me.showRightS(0, 0, -1, 0, 0, 0);
@ -4064,10 +4091,10 @@ var canvas_MCDU_base = {
}
if (fmgc.FMGCInternal.costIndexSet) {
me["Simple_L2"].setColor(0.0901,0.6039,0.7176);
me["Simple_L2"].setColor(BLUE);
me["Simple_L2"].setText(sprintf(" %2.0f", fmgc.FMGCInternal.costIndex));
} else {
me["Simple_L2"].setColor(1,1,1);
me["Simple_L2"].setColor(WHITE);
me["Simple_L2"].setText(" ---");
}
@ -4148,9 +4175,9 @@ var canvas_MCDU_base = {
}
if (fmgc.FMGCInternal.phase == 5) {
me["Simple_Title"].setColor(0.0509,0.7529,0.2941);
me["Simple_Title"].setColor(GREEN);
} else {
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
}
me["Simple_L0S"].setText("DEST");
@ -4331,9 +4358,9 @@ var canvas_MCDU_base = {
}
if (fmgc.FMGCInternal.phase == 6) {
me["Simple_Title"].setColor(0.0509,0.7529,0.2941);
me["Simple_Title"].setColor(GREEN);
} else {
me["Simple_Title"].setColor(1, 1, 1);
me["Simple_Title"].setColor(WHITE);
}
if (thrAccSet.getValue() == 1) {
@ -5967,6 +5994,8 @@ setlistener("sim/signals/fdm-initialized", func {
mcdu.mcdu_message(0, "SELECT DESIRED SYSTEM");
mcdu.mcdu_message(1, "SELECT DESIRED SYSTEM");
reqFMGC = [0,0]; # reset FMGC REQ status - on MCDU restart
MCDU_update.start();
});

View file

@ -1705,7 +1705,7 @@
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>mcdu.button("CLR", 0);</script>
<script>mcdu.button("CLR", 0, "down");</script>
<condition>
<and>
<greater-than-equals>
@ -1719,6 +1719,24 @@
</and>
</condition>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>mcdu.button("CLR", 0, "up");</script>
<condition>
<and>
<greater-than-equals>
<property>systems/electrical/bus/ac-1</property>
<value>110</value>
</greater-than-equals>
<greater-than>
<property>controls/lighting/DU/mcdu1</property>
<value>0.01</value>
</greater-than>
</and>
</condition>
</binding>
</mod-up>
</action>
</animation>
<animation>

View file

@ -1705,7 +1705,7 @@
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>mcdu.button("CLR", 1);</script>
<script>mcdu.button("CLR", 1, "down");</script>
<condition>
<and>
<greater-than-equals>
@ -1719,6 +1719,24 @@
</and>
</condition>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>mcdu.button("CLR", 1, "up");</script>
<condition>
<and>
<greater-than-equals>
<property>systems/electrical/bus/ac-2</property>
<value>110</value>
</greater-than-equals>
<greater-than>
<property>controls/lighting/DU/mcdu2</property>
<value>0.01</value>
</greater-than>
</and>
</condition>
</binding>
</mod-up>
</action>
</animation>
<animation>

View file

@ -169,6 +169,8 @@ var FMGCInternal = {
altAirportSet: 0,
altSelected: 0,
arrApt: "",
coRoute: "",
coRouteSet: 0,
costIndex: 0,
costIndexSet: 0,
crzFt: 10000,
@ -309,6 +311,7 @@ var updateArptLatLon = func {
updateRouteManagerAlt = func() {
setprop("autopilot/route-manager/cruise/altitude-ft", FMGCInternal.crzFt);
# TODO - update FMGCInternal.phase when DES to re-enter in CLIMB/CRUIZE
};
########

View file

@ -1,5 +1,6 @@
# A3XX Simbrief Parser
# Copyright (c) 2020 Jonathan Redpath (legoboyvdlp)
# enhanceded 12/2020 - parse TOD & TOC psedo waypoints, set computer speeds on fix wps, fake coRoute name
var LBS2KGS = 0.4535924;
@ -157,12 +158,16 @@ var SimbriefParser = {
if (ident == "TOC") {
_foundTOC = 1;
continue;
#setprop("/autopilot/route-manager/vnav/tc/latitude-deg",ofpFix.getNode("pos_lat").getValue());
#setprop("/autopilot/route-manager/vnav/tc/longitude-deg",ofpFix.getNode("pos_long").getValue());
#ident = "(T/C)";
}
if (ident == "TOD") {
_foundTOD = 1;
continue;
#setprop("/autopilot/route-manager/vnav/td/latitude-deg",ofpFix.getNode("pos_lat").getValue());
#setprop("/autopilot/route-manager/vnav/td/longitude-deg",ofpFix.getNode("pos_long").getValue());
#ident = "(T/D)";
}
coords = geo.Coord.new();
@ -189,6 +194,34 @@ var SimbriefParser = {
fmgc.flightPlanController.flightplans[3].star = _star;
}
fmgc.flightPlanController.destroyTemporaryFlightPlan(3, 1);
#var idx = 1;
#var plan = fmgc.flightPlanController.flightplans[2];
#var altitude = "";
#var speed = "";
#var wpname = "";
#foreach (var ofpFix; ofpFixes) {
# ident = ofpFix.getNode("ident").getValue();
# if (ident == "TOC") wpname = "(T/C)";
# else if (ident == "TOD") wpname = "(T/D)";
# else wpname = ident;
# wp = plan.getWP(idx); # get leg
# if (wp != nil) {
# if (wp.wp_name == wpname) {
# altitude = ofpFix.getNode("altitude_feet").getValue();
# speed = ofpFix.getNode("ind_airspeed").getValue();
# if (speed>0) wp.setSpeed(speed, "computed");
# if (altitude>0) wp.setAltitude(math.round(altitude, 10), "computed");
#
# idx = idx + 1;
# }
# }
# }
fmgc.windController.updatePlans();
fmgc.updateRouteManagerAlt();
@ -199,6 +232,8 @@ var SimbriefParser = {
if (me.buildFlightplan() == nil) {
return nil;
}
fmgc.FMGCInternal.coRoute = "SB" ~ me.OFP.getNode("origin/iata_code").getValue() ~ me.OFP.getNode("destination/iata_code").getValue() ~ "00";
fmgc.FMGCInternal.coRouteSet = 1;
fmgc.FMGCInternal.flightNum = (me.OFP.getNode("general/icao_airline").getValue() or "") ~ (me.OFP.getNode("general/flight_number").getValue() or "");
fmgc.FMGCInternal.flightNumSet = 1;
fmgc.FMGCInternal.costIndex = me.OFP.getNode("general/costindex").getValue();

View file

@ -69,6 +69,7 @@ var scratchpadController = {
sp.scratchpadColour = "wht";
sp.showTypeIMsg = 0;
sp.showTypeIIMsg = 0;
sp.clrmode = 0; # 1 = CLR mode
sp.mcdu = mcdu;
return sp;
},
@ -88,6 +89,11 @@ var scratchpadController = {
me.clearTypeI();
}
if (me.clrmode == 1) { # prevent add chars in CLR mode
me.clear();
}
else if (character == "CLR") me.clrmode = 1;
me.scratchpad = me.scratchpad ~ character;
me.scratchpadColour = "wht";
me.update();
@ -140,6 +146,7 @@ var scratchpadController = {
},
empty: func() {
me.scratchpad = "";
me.clrmode = 0;
me.update();
},
clear: func() {

View file

@ -68,9 +68,21 @@ var fplnItem = {
me.spd = me.getSpd();
me.alt = me.getAlt();
me.dist = me.getDist();
me._colour = "wht";
if (me.spd[1] != "wht" or me.alt[1] != "wht") {
me._colour = "mag";
if (me.colour != "yel") { # not temporary flightplan
me._colour = "wht";
#if (me.spd[1] != "wht" or me.alt[1] != "wht") {
if (me.spd[1] == me.alt[1]) {
me._colour = me.spd[1];
}
else if (me.spd[1] == "mag" or me.alt[1] == "mag") {
me._colour = "mag";
}
else if (me.spd[1] == "grn" or me.alt[1] == "grn") {
me._colour = "grn";
}
} else { # temporary flightplan
me._colour = "yel";
}
return [me.spd[0] ~ "/" ~ me.alt[0], " " ~ me.dist ~ "NM ", me._colour];
} else {
@ -95,23 +107,25 @@ var fplnItem = {
},
getSpd: func() {
if (me.index == 0 and left(me.wp.wp_name, 4) == fmgc.FMGCInternal.depApt and fmgc.FMGCInternal.v1set) {
return [sprintf("%3.0f", math.round(fmgc.FMGCInternal.v1)), "mag"];
} elsif (me.wp.speed_cstr != nil and me.wp.speed_cstr != 0) {
return [sprintf("%3.0f", me.wp.speed_cstr), "mag"];
return [sprintf("%3.0f", math.round(fmgc.FMGCInternal.v1)), "grn"]; # why "mag"? I think "grn"
} elsif (me.wp.speed_cstr != nil and me.wp.speed_cstr > 0) {
var tcol = (me.wp.speed_cstr_type == "computed" or me.wp.speed_cstr_type == "computed_mach") ? "grn" : "mag"; # TODO - check if only computed
return [sprintf("%3.0f", me.wp.speed_cstr), tcol];
} else {
return ["---", "wht"];
}
},
getAlt: func() {
if (me.index == 0 and left(me.wp.wp_name, 4) == fmgc.FMGCInternal.depApt and fmgc.flightPlanController.flightplans[me.plan].departure != nil) {
return [" " ~ sprintf("%-5.0f", math.round(fmgc.flightPlanController.flightplans[me.plan].departure.elevation * M2FT)), "mag"];
return [" " ~ sprintf("%5.0f", math.round(fmgc.flightPlanController.flightplans[me.plan].departure.elevation * M2FT)), "grn"]; #fixed - aligned to right
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1) and fmgc.flightPlanController.fromWptAlt != nil) {
return [" " ~ fmgc.flightPlanController.fromWptAlt, "mag"];
} elsif (me.wp.alt_cstr != nil and me.wp.alt_cstr != 0) {
} elsif (me.wp.alt_cstr != nil and me.wp.alt_cstr > 0) {
var tcol = (me.wp.alt_cstr_type == "computed" or me.wp.alt_cstr_type == "computed_mach") ? "grn" : "mag"; # TODO - check if only computed
if (me.wp.alt_cstr > fmgc.FMGCInternal.transAlt) {
return [" " ~ sprintf("%-5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)), "mag"];
return [" " ~ sprintf("%5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)), tcol]; #fixed - aligned to right
} else {
return [" " ~ sprintf("%-5.0f", me.wp.alt_cstr), "mag"];
return [" " ~ sprintf("%5.0f", me.wp.alt_cstr), tcol]; #fixed - aligned to right
}
} else {
return ["------", "wht"];
@ -337,7 +351,7 @@ var fplnPage = { # this one is only created once, and then updated - remember th
if (size(me.outputList) >= 1) {
me.L1 = me.outputList[0].updateLeftText();
me.C1 = me.outputList[0].updateCenterText();
me.C1[1] = "TIME ";
me.C1[1] = (fmgc.flightPlanController.fromWptTime != nil) ? "UTC " : "TIME "; # since TO change to UTC time (1 space left to center)
me.R1 = me.outputList[0].updateRightText();
me.R1[1] = "SPD/ALT ";
} else {

View file

@ -5,7 +5,40 @@
var initInputA = func(key, i) {
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L2") {
if (key == "L1") { #clear coRoute if set
if (scratchpad == "CLR") {
if (fmgc.FMGCInternal.coRouteSet == 1) {
fmgc.FMGCInternal.coRouteSet = 0;
fmgc.FMGCInternal.coRoute = "";
fmgc.FMGCInternal.depApt = "";
fmgc.FMGCInternal.arrApt = "";
fmgc.FMGCInternal.toFromSet = 0;
fmgc.FMGCNodes.toFromSet.setValue(0);
fmgc.windController.resetDesWinds();
setprop("/FMGC/internal/align-ref-lat", 0);
setprop("/FMGC/internal/align-ref-long", 0);
setprop("/FMGC/internal/align-ref-lat-edit", 0);
setprop("/FMGC/internal/align-ref-long-edit", 0);
if (fmgc.FMGCInternal.blockConfirmed) {
fmgc.FMGCInternal.fuelCalculating = 0;
fmgc.fuelCalculating.setValue(0);
fmgc.FMGCInternal.fuelCalculating = 1;
fmgc.fuelCalculating.setValue(1);
}
fmgc.flightPlanController.reset(2);
fmgc.flightPlanController.init();
Simbrief.SimbriefParser.inhibit = 0;
}
mcdu_scratchpad.scratchpads[i].empty();
} else {
var len = size(scratchpad);
if (fmgc.FMGCInternal.coRouteSet == 1 or len != 10) {
mcdu_message(i, "NOT ALLOWED");
} else {
mcdu_message(i, "NOT IN DATA BASE"); # fake message - TODO flightplan loader
}
}
} else if (key == "L2") {
if (scratchpad == "CLR") {
fmgc.FMGCInternal.altAirport = "";
fmgc.FMGCInternal.altAirportSet = 0;
@ -183,7 +216,10 @@ var initInputA = func(key, i) {
}
}
} else if (key == "R1") {
if (scratchpad == "CLR") {
if (fmgc.FMGCInternal.coRouteSet == 1) {
mcdu_message(i, "NOT ALLOWED");
}
else if (scratchpad == "CLR") {
fmgc.FMGCInternal.depApt = "";
fmgc.FMGCInternal.arrApt = "";
fmgc.FMGCInternal.toFromSet = 0;

View file

@ -3,6 +3,22 @@
# Copyright (c) 2020 Josh Davidson (Octal450)
# Copyright (c) 2020 Matthew Maring (mattmaring)
# VMCA 109.5 at 0ft
# VMCG 106.5 at 0ft all conf
var standard_VMCA = 109.5; # TODO calculate VMCA/VMCG on altitude (ft) of departure airport (read below)
var standard_VMCG = 106.5;
# TODO - DepArp elevation or current elevation (on ground only!!) -> math.round(fmgc.flightPlanController.flightplans[2].departure.elevation * M2FT))
var perfTOCheckVSpeeds = func(i) {
if (fmgc.FMGCInternal.v1set == 1 and fmgc.FMGCInternal.vrset == 1 and fmgc.FMGCInternal.v2set == 1) { # only when v1/vr/v2 all sets
if (fmgc.FMGCInternal.v1>fmgc.FMGCInternal.vr or fmgc.FMGCInternal.vr > fmgc.FMGCInternal.v2) mcdu_messageTypeII(i,"V1/VR/V2 DISAGREE");
else if (fmgc.FMGCInternal.v1<standard_VMCG or fmgc.FMGCInternal.vr<(standard_VMCA*1.05) or fmgc.FMGCInternal.v2<(standard_VMCA*1.10)) mcdu_messageTypeII(i,"TO SPEED TOO LOW");
#else if (Vr<KVr*VS1G or V2<KV2*VS1G) mcdu_messageTypeII(i,"TO SPEED TOO LOW"); #TODO - check to VS1G and look constant KVr KV2 on manual, not own by me :/
}
}
var perfTOInput = func(key, i) {
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") {
@ -24,6 +40,8 @@ var perfTOInput = func(key, i) {
fmgc.FMGCNodes.v1.setValue(scratchpad);
fmgc.FMGCNodes.v1set.setValue(1);
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeeds(i); # do V-speeds validation
} else {
mcdu_message(i, "NOT ALLOWED");
}
@ -47,6 +65,8 @@ var perfTOInput = func(key, i) {
fmgc.FMGCInternal.vr = scratchpad;
fmgc.FMGCInternal.vrset = 1;
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeeds(i); # do V-speeds validation
} else {
mcdu_message(i, "NOT ALLOWED");
}
@ -73,6 +93,8 @@ var perfTOInput = func(key, i) {
fmgc.updatePitchArm2();
setprop("/it-autoflight/settings/togaspd", scratchpad);
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeeds(i); # do V-speeds validation
} else {
mcdu_message(i, "NOT ALLOWED");
}
@ -112,11 +134,19 @@ var perfTOInput = func(key, i) {
var thrreds = size(thrred);
var acc = thracc[1];
var accs = size(acc);
#TODO - manual check - four digit alwway 0000 - default = runaway_elevation + 800 ft, min values runaway_elevation+400ft
if (int(thrred) != nil and (thrreds >= 3 and thrreds <= 5) and thrred >= 400 and thrred <= 39000 and int(acc) != nil and (accs == 3 or accs == 4 or accs == 5) and acc >= 400 and acc <= 39000) {
setprop("/systems/thrust/clbreduc-ft", int(thrred / 10) * 10);
setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10);
setprop("MCDUC/thracc-set", 1);
mcdu_scratchpad.scratchpads[i].empty();
if (thrred<=acc) { # validation
setprop("/systems/thrust/clbreduc-ft", int(thrred / 10) * 10);
setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10);
setprop("MCDUC/thracc-set", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (thrreds == 0 and int(acc) != nil and (accs >= 3 and accs <= 5) and acc >= 400 and acc <= 39000) {
setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10);
mcdu_scratchpad.scratchpads[i].empty();