1
0
Fork 0

Minor bug fixes: don't overwrite zfw if already set, allow reset before block-confirm

This commit is contained in:
Matthew Maring 2020-05-01 21:39:55 -04:00
parent 80c677bee3
commit 3d17d1d777
2 changed files with 11 additions and 3 deletions

View file

@ -904,7 +904,9 @@ setlistener("systems/navigation/adr/operating-3", func() {
# Calculate Block Fuel
setlistener("/FMGC/internal/block-calculating", func() {
if (timer3blockFuel.isRunning) {
timer3blockFuel.stop();
setprop("/FMGC/internal/block-fuel-time", -99);
timer3blockFuel.start();
setprop("/FMGC/internal/block-fuel-time", pts.Sim.Time.elapsedSec.getValue());
}
if (getprop("/FMGC/internal/block-fuel-time") == -99) {
@ -964,8 +966,10 @@ var timer3blockFuel = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/block-fuel-time") + 3) {
setprop("/FMGC/internal/block", sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)));
setprop("/FMGC/internal/block-set", 1);
setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round((getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs")) / 1000, 0.1)));
setprop("/FMGC/internal/zfw-set", 1);
if (!getprop("/FMGC/internal/zfw-set")) {
setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round((getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs")) / 1000, 0.1)));
setprop("/FMGC/internal/zfw-set", 1);
}
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-fuel-time", -99);
timer3blockFuel.stop();

View file

@ -10,6 +10,8 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/taxi-fuel-set", 0);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
} else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1);
}
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
@ -160,6 +162,8 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/zfw-set", 1);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
} else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1);
}
}
if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) {