1
0
Fork 0

Push changes to fuel predict, bugfix for reserve fuel

This commit is contained in:
Matthew Maring 2020-05-05 09:52:11 -04:00
parent d4dd37c8df
commit 9e9f9f52f6
4 changed files with 33 additions and 18 deletions

View file

@ -1983,20 +1983,27 @@ var canvas_MCDU_base = {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} }
} }
me["Simple_L4"].setText(sprintf("%.1f", alt_fuel.getValue())); if (altSet.getValue() == 1) {
me["Simple_C4"].show(); me["Simple_L4"].setText(sprintf("%.1f", alt_fuel.getValue()));
if (alt_fuel_set.getValue() == 1) { me["Simple_L4"].setColor(BLUE);
if (num(alt_fuel.getValue()) > 9.9) { me["Simple_C4"].show();
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue())); if (alt_fuel_set.getValue() == 1) {
if (num(alt_fuel.getValue()) > 9.9) {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
} else {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
}
} else { } else {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue())); if (num(alt_fuel.getValue()) > 9.9) {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
} else {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
}
} }
} else { } else {
if (num(alt_fuel.getValue()) > 9.9) { me["Simple_L4"].setText("---.-/----");
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue())); me["Simple_L4"].setColor(WHITE);
} else { me["Simple_C4"].hide();
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
}
} }
me["Simple_L5"].setText(sprintf("%.1f", final_fuel.getValue())); me["Simple_L5"].setText(sprintf("%.1f", final_fuel.getValue()));
if (final_time_set.getValue() == 1 and final_fuel_set.getValue() == 1) { if (final_time_set.getValue() == 1 and final_fuel_set.getValue() == 1) {
@ -2033,7 +2040,7 @@ var canvas_MCDU_base = {
me["Simple_R5"].setText(sprintf("%4.1f/", gw.getValue()) ~ sprintf("%4.1f", cg.getValue())); me["Simple_R5"].setText(sprintf("%4.1f/", gw.getValue()) ~ sprintf("%4.1f", cg.getValue()));
me["Simple_R6"].setText(sprintf("%4.1f/" ~ extra_time.getValue(), extra_fuel.getValue())); me["Simple_R6"].setText(sprintf("%4.1f/" ~ extra_time.getValue(), extra_fuel.getValue()));
me.colorLeft("ack", "ack", "blu", "blu", "blu", "blu"); me.colorLeft("ack", "ack", "blu", "ack", "blu", "blu");
me.colorRight("ack", "ack", "blu", "grn", "grn", "grn"); me.colorRight("ack", "ack", "blu", "grn", "grn", "grn");
} }
@ -2070,7 +2077,7 @@ var canvas_MCDU_base = {
me["Simple_C3B"].setFontSize(small); me["Simple_C3B"].setFontSize(small);
} }
if (alt_fuel_set.getValue() == 1) { if (alt_fuel_set.getValue() == 1 and altSet.getValue() == 1) {
me["Simple_L4"].setFontSize(normal); me["Simple_L4"].setFontSize(normal);
} else { } else {
me["Simple_L4"].setFontSize(small); me["Simple_L4"].setFontSize(small);

View file

@ -279,7 +279,11 @@ var updateFuel = func {
if (num(getprop("/FMGC/internal/trip-fuel")) == 0.0) { if (num(getprop("/FMGC/internal/trip-fuel")) == 0.0) {
setprop("/FMGC/internal/rte-percent", 0.0); setprop("/FMGC/internal/rte-percent", 0.0);
} else { } else {
setprop("/FMGC/internal/rte-percent", num(getprop("/FMGC/internal/rte-rsv") / getprop("/FMGC/internal/trip-fuel") * 100.0)); if (num(getprop("/FMGC/internal/rte-rsv") / getprop("/FMGC/internal/trip-fuel") * 100.0) <= 15.0) {
setprop("/FMGC/internal/rte-percent", num(getprop("/FMGC/internal/rte-rsv") / getprop("/FMGC/internal/trip-fuel") * 100.0));
} else {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value
}
} }
} else if (getprop("/FMGC/internal/rte-percent-set")) { } else if (getprop("/FMGC/internal/rte-percent-set")) {
setprop("/FMGC/internal/rte-rsv", num(getprop("/FMGC/internal/trip-fuel") * getprop("/FMGC/internal/rte-percent") / 100.0)); setprop("/FMGC/internal/rte-rsv", num(getprop("/FMGC/internal/trip-fuel") * getprop("/FMGC/internal/rte-percent") / 100.0));

View file

@ -48,9 +48,13 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} }
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7 and tf / num(getprop("/FMGC/internal/trip-fuel")) <= 0.15) { } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) {
setprop("/FMGC/internal/rte-rsv", scratchpad); setprop("/FMGC/internal/rte-rsv", scratchpad);
setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100); if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) {
setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100);
} else {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value
}
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -59,7 +63,7 @@ var fuelPredInput = func(key, i) {
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { } else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and getprop("/FMGC/internal/alt-set")s) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/alt-fuel", 0.0); setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000"); setprop("/FMGC/internal/alt-time", "0000");

View file

@ -56,7 +56,7 @@ var initInputB = func(key, i) {
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) { } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) {
setprop("/FMGC/internal/rte-rsv", scratchpad); setprop("/FMGC/internal/rte-rsv", scratchpad);
setprop("/FMGC/internal/rte-rsv-set", 1); setprop("/FMGC/internal/rte-rsv-set", 1);
if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 > 15.0) { if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) {
setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100); setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100);
} else { } else {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value