From 86499c33be99593b3a0f1ec2651181caac81676a Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Tue, 5 Jun 2018 18:29:35 -0400 Subject: [PATCH] System: Fix battery behavior when fully charged --- Nasal/electrical.nas | 4 ++++ revision.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Nasal/electrical.nas b/Nasal/electrical.nas index e5ebbc3a..78f6e11e 100644 --- a/Nasal/electrical.nas +++ b/Nasal/electrical.nas @@ -621,6 +621,8 @@ var ELEC = { setprop("/systems/electrical/battery1-percent", battery1_percent_calc); 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) { 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 @@ -643,6 +645,8 @@ var ELEC = { setprop("/systems/electrical/battery2-percent", battery2_percent_calc); 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) { 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 diff --git a/revision.txt b/revision.txt index 9e2c8d60..9bad6a3f 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4504 \ No newline at end of file +4505 \ No newline at end of file