System: Fix battery behavior when fully charged

This commit is contained in:
Joshua Davidson 2018-06-05 18:29:35 -04:00
parent c2cc2a73d9
commit 86499c33be
2 changed files with 5 additions and 1 deletions

View file

@ -621,6 +621,8 @@ var ELEC = {
setprop("/systems/electrical/battery1-percent", battery1_percent_calc); setprop("/systems/electrical/battery1-percent", battery1_percent_calc);
setprop("/systems/electrical/battery1-time", getprop("/sim/time/elapsed-sec")); setprop("/systems/electrical/battery1-time", getprop("/sim/time/elapsed-sec"));
} }
} else if (battery1_percent == 100 and (dc1 > 25 or dc2 > 25) and battery1_sw and !batt1_fail) {
setprop("/systems/electrical/battery1-time", getprop("/sim/time/elapsed-sec"));
} else if (battery1_amps >= 120 and battery1_sw and !batt1_fail) { } else if (battery1_amps >= 120 and battery1_sw and !batt1_fail) {
if (getprop("/systems/electrical/battery1-time") + 5 < getprop("/sim/time/elapsed-sec")) { if (getprop("/systems/electrical/battery1-time") + 5 < getprop("/sim/time/elapsed-sec")) {
battery1_percent_calc = battery1_percent - 0.25; # Roughly 90 percent every 30 mins battery1_percent_calc = battery1_percent - 0.25; # Roughly 90 percent every 30 mins
@ -643,6 +645,8 @@ var ELEC = {
setprop("/systems/electrical/battery2-percent", battery2_percent_calc); setprop("/systems/electrical/battery2-percent", battery2_percent_calc);
setprop("/systems/electrical/battery2-time", getprop("/sim/time/elapsed-sec")); setprop("/systems/electrical/battery2-time", getprop("/sim/time/elapsed-sec"));
} }
} else if (battery2_percent == 100 and (dc1 > 25 or dc2 > 25) and battery2_sw and !batt2_fail) {
setprop("/systems/electrical/battery2-time", getprop("/sim/time/elapsed-sec"));
} else if (battery2_amps >= 120 and battery2_sw and !batt2_fail) { } else if (battery2_amps >= 120 and battery2_sw and !batt2_fail) {
if (getprop("/systems/electrical/battery2-time") + 5 < getprop("/sim/time/elapsed-sec")) { if (getprop("/systems/electrical/battery2-time") + 5 < getprop("/sim/time/elapsed-sec")) {
battery2_percent_calc = battery2_percent - 0.25; # Roughly 90 percent every 30 mins battery2_percent_calc = battery2_percent - 0.25; # Roughly 90 percent every 30 mins

View file

@ -1 +1 @@
4504 4505