From 77338c1b2ec0ac755992bc597500c6846503aad0 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Fri, 11 Aug 2017 12:32:27 -0400 Subject: [PATCH] A3XX: Fix electrical bug --- Nasal/electrical.nas | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Nasal/electrical.nas b/Nasal/electrical.nas index fc81e2b3..b8165144 100644 --- a/Nasal/electrical.nas +++ b/Nasal/electrical.nas @@ -403,7 +403,7 @@ var master_elec = func { 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); } else { setprop("/systems/electrical/bus/dcbat", 0); @@ -421,17 +421,19 @@ var master_elec = func { 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(); 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(); charge2.start(); } - if ((dcbat == 0) and battery1_sw and !batt1_fail) { decharge1.start(); }