Load cost index automatically if you try to enter ZFW with no cost index set
This commit is contained in:
parent
07f6036dc7
commit
1c77d670aa
6 changed files with 34 additions and 8 deletions
|
@ -1077,6 +1077,11 @@ setlistener("/FMGC/internal/fuel-calculating", func() {
|
|||
var timer30secLanding = maketimer(1, func() {
|
||||
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/landing-time") + 30) {
|
||||
setprop("/FMGC/status/phase", 7);
|
||||
if (getprop("/FMGC/internal/cost-index-set")) {
|
||||
setprop("/FMGC/internal/last-cost-index", getprop("/FMGC/internal/cost-index"));
|
||||
} else {
|
||||
setprop("/FMGC/internal/last-cost-index", 0);
|
||||
}
|
||||
setprop("/FMGC/internal/landing-time", -99);
|
||||
timer30secLanding.stop();
|
||||
}
|
||||
|
|
|
@ -109,6 +109,12 @@ var scratchpadController = {
|
|||
me.empty();
|
||||
me.update();
|
||||
},
|
||||
override: func(str) {
|
||||
if (me.scratchpad == "USING COST INDEX N") {
|
||||
me.scratchpad = "USING COST INDEX " ~ str;
|
||||
me.update();
|
||||
}
|
||||
},
|
||||
empty: func() {
|
||||
me.scratchpad = "";
|
||||
me.update();
|
||||
|
@ -136,12 +142,11 @@ var scratchpadController = {
|
|||
|
||||
var MessageController = {
|
||||
typeIMessages: std.Vector.new([
|
||||
TypeIMessage.new("AOC DISABLED"),TypeIMessage.new("AWY/WPT MISMATCH"),TypeIMessage.new("DEST/ALTN MISMATCH"),
|
||||
TypeIMessage.new("DIR TO IN PROGRESS"),TypeIMessage.new("ENTRY OUT OF RANGE"),TypeIMessage.new("FORMAT ERROR"),
|
||||
TypeIMessage.new("INSERT/ERASE TMPY FIRST"),TypeIMessage.new("LIST OF 20 IN USE"),TypeIMessage.new("PILOT ELEMENT RETAINED"),
|
||||
TypeIMessage.new("NOT ALLOWED"),TypeIMessage.new("NOT IN DATA BASE"),TypeIMessage.new("ONLY SPD ENTRY ALLOWED"),
|
||||
TypeIMessage.new("REVISION IN PROGRESS"),TypeIMessage.new("TMPY F-PLN EXISTS"),
|
||||
TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"),
|
||||
TypeIMessage.new("AOC DISABLED"),TypeIMessage.new("AWY/WPT MISMATCH"),TypeIMessage.new("DIR TO IN PROGRESS"),
|
||||
TypeIMessage.new("ENTRY OUT OF RANGE"),TypeIMessage.new("FORMAT ERROR"),TypeIMessage.new("INSERT/ERASE TMPY FIRST"),
|
||||
TypeIMessage.new("LIST OF 20 IN USE"),TypeIMessage.new("PILOT ELEMENT RETAINED"),TypeIMessage.new("NOT ALLOWED"),
|
||||
TypeIMessage.new("NOT IN DATA BASE"),TypeIMessage.new("ONLY SPD ENTRY ALLOWED"),TypeIMessage.new("REVISION IN PROGRESS"),
|
||||
TypeIMessage.new("TMPY F-PLN EXISTS"),TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"),
|
||||
TypeIMessage.new("USING COST INDEX N"),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),
|
||||
]),
|
||||
typeIIMessages: std.Vector.new([
|
||||
|
|
|
@ -142,6 +142,12 @@ var fuelPredInput = func(key, i) {
|
|||
if (scratchpad == "CLR") {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
} else {
|
||||
if (!getprop("/FMGC/internal/cost-index-set")) {
|
||||
mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index"));
|
||||
setprop("/FMGC/internal/cost-index-set", 1);
|
||||
setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index"));
|
||||
}
|
||||
|
||||
var tfs = size(scratchpad);
|
||||
if (tfs == 0) {
|
||||
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
|
||||
|
|
|
@ -148,6 +148,12 @@ var initInputB = func(key, i) {
|
|||
if (scratchpad == "CLR") {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
} else {
|
||||
if (!getprop("/FMGC/internal/cost-index-set")) {
|
||||
mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index"));
|
||||
setprop("/FMGC/internal/cost-index-set", 1);
|
||||
setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index"));
|
||||
}
|
||||
|
||||
var tfs = size(scratchpad);
|
||||
if (tfs == 0) {
|
||||
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
|
||||
|
|
|
@ -59,6 +59,7 @@ var MCDU_reset = func(i) {
|
|||
setprop("/FMGC/internal/alt-set", 0);
|
||||
setprop("/FMGC/internal/cost-index", "0");
|
||||
setprop("/FMGC/internal/cost-index-set", 0);
|
||||
setprop("/FMGC/internal/last-cost-index", 0);
|
||||
setprop("/FMGC/internal/cruise-ft", 10000);
|
||||
setprop("/FMGC/internal/cruise-fl", 100);
|
||||
setprop("/FMGC/internal/cruise-lvl-set", 0);
|
||||
|
@ -810,8 +811,9 @@ var button = func(btn, i) {
|
|||
}
|
||||
}
|
||||
|
||||
var mcdu_message = func(i, string) {
|
||||
var mcdu_message = func(i, string, overrideStr = "") {
|
||||
mcdu_scratchpad.scratchpads[i].showTypeI(mcdu_scratchpad.MessageController.getTypeIMsgByText(string));
|
||||
mcdu_scratchpad.scratchpads[i].override(overrideStr);
|
||||
}
|
||||
|
||||
var screenFlash = func(time, i) {
|
||||
|
|
|
@ -47,7 +47,9 @@ var default = [
|
|||
"/controls/gear/brake-parking",
|
||||
# electrics
|
||||
"/systems/electrical/sources/bat-1/percent-calc",
|
||||
"/systems/electrical/sources/bat-2/percent-calc"
|
||||
"/systems/electrical/sources/bat-2/percent-calc",
|
||||
# FMGC
|
||||
"/FMGC/internal/last-cost-index",
|
||||
];
|
||||
|
||||
var save = func (saved_props, file) {
|
||||
|
|
Loading…
Reference in a new issue