A3XX: Fix electrical bug

This commit is contained in:
Joshua Davidson 2017-08-11 12:32:27 -04:00
parent 970689cf66
commit 77338c1b2e

View file

@ -403,7 +403,7 @@ var master_elec = func {
setprop("/systems/electrical/battery2-amps", 0); setprop("/systems/electrical/battery2-amps", 0);
} }
if ((dc1 > 0) or (dc2 > 0)) { if ((getprop("/systems/electrical/battery1-amps") > 120) or (getprop("/systems/electrical/battery2-amps") > 120)) {
setprop("/systems/electrical/bus/dcbat", dc_volt_std); setprop("/systems/electrical/bus/dcbat", dc_volt_std);
} else { } else {
setprop("/systems/electrical/bus/dcbat", 0); setprop("/systems/electrical/bus/dcbat", 0);
@ -421,17 +421,19 @@ var master_elec = func {
charge2.stop(); charge2.stop();
} }
if ((dcbat > 0) and battery1_sw and !batt1_fail) { dc1 = getprop("/systems/electrical/bus/dc1");
dc2 = getprop("/systems/electrical/bus/dc2");
if ((dc1 > 25 or dc2 > 25) and battery1_sw and !batt1_fail) {
decharge1.stop(); decharge1.stop();
charge1.start(); charge1.start();
} }
if ((dcbat > 0) and battery2_sw and !batt2_fail) { if ((dc1 > 25 or dc2 > 25) and battery2_sw and !batt2_fail) {
decharge1.stop(); decharge1.stop();
charge2.start(); charge2.start();
} }
if ((dcbat == 0) and battery1_sw and !batt1_fail) { if ((dcbat == 0) and battery1_sw and !batt1_fail) {
decharge1.start(); decharge1.start();
} }