From 86499c33be99593b3a0f1ec2651181caac81676a Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Tue, 5 Jun 2018 18:29:35 -0400 Subject: [PATCH 1/2] 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 From 84348b0868b2533dca8d0b17d314998b3f7de997 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sat, 9 Jun 2018 18:48:02 -0400 Subject: [PATCH 2/2] Sim: Replay handler --- Nasal/libraries.nas | 12 +++++++++++- revision.txt | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index a7540f01..b60b87f2 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -9,6 +9,8 @@ print("------------------------------------------------------------------------- print("Copyright (c) 2017-2018 Joshua Davidson (it0uchpods)"); print("-----------------------------------------------------------------------------"); +setprop("/sim/replay/was-active", 0); + # Dimmers setprop("/controls/lighting/ndl-norm", 1); setprop("/controls/lighting/ndr-norm", 1); @@ -205,7 +207,7 @@ var systemsLoop = maketimer(0.1, func { systems.ADIRS.loop(); libraries.ECAM.loop(); fadec.fadecLoop(); - + if ((getprop("/controls/pneumatic/switches/groundair") or getprop("/controls/switches/cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or getprop("/controls/gear/brake-parking") == 0)) { setprop("/controls/switches/cart", 0); setprop("/controls/pneumatic/switches/groundair", 0); @@ -245,6 +247,14 @@ var systemsLoop = maketimer(0.1, func { if ((getprop("/engines/engine[1]/state") == 2 or getprop("/engines/engine[1]/state") == 3) and getprop("/fdm/jsbsim/propulsion/tank[4]/contents-lbs") < 1) { systems.cutoff_two(); } + + if (getprop("/sim/replay/replay-state") == 1) { + setprop("/sim/replay/was-active", 1); + } else if (getprop("/sim/replay/replay-state") == 0 and getprop("/sim/replay/was-active") == 1) { + setprop("/sim/replay/was-active", 0); + acconfig.colddark(); + gui.popupTip("Replay Ended: Setting Cold and Dark state..."); + } }); setlistener("/options/steep-ils", func { diff --git a/revision.txt b/revision.txt index 9bad6a3f..5c38a199 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4505 \ No newline at end of file +4506 \ No newline at end of file