From d3b66bbb919f28c6d733f8e62fb957af66401861 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 17 Jul 2020 22:15:49 +0100 Subject: [PATCH] Improve performance by delaying ECAM to 15 herz in JSBSIM, correct clock so that annunciator test works corectly --- Nasal/Panels/clock.nas | 47 +++++++++++++++++++++++------------------- Systems/a320-fwc.xml | 2 +- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Nasal/Panels/clock.nas b/Nasal/Panels/clock.nas index b76da0bb..87c7b3cb 100644 --- a/Nasal/Panels/clock.nas +++ b/Nasal/Panels/clock.nas @@ -180,30 +180,35 @@ var start_loop = maketimer(0.1, func { }; }); - -var update_items = [ - props.UpdateManager.FromPropertyHashList(["/fdm/jsbsim/hydraulics/rudder/trim-deg", "/controls/switches/annun-test"], 0.05, func(notification) - { - var rudder_val = getprop("fdm/jsbsim/hydraulics/rudder/trim-deg"); - if (getprop("/controls/switches/annun-test") == 1) { - setprop("/controls/flight/rudder-trim-display", sprintf("%3.1f", "88.8")); - setprop("/controls/flight/rudder-trim-letter-display", sprintf("%1.0f", "8")); +var updateRudderTrim = func() { + var rudder_val = getprop("fdm/jsbsim/hydraulics/rudder/trim-deg"); + if (getprop("/controls/switches/annun-test") == 1) { + setprop("/controls/flight/rudder-trim-display", sprintf("%3.1f", "88.8")); + setprop("/controls/flight/rudder-trim-letter-display", sprintf("%1.0f", "8")); + } else { + if (rudder_val > -0.05 and rudder_val < 0.05) { + setprop("/controls/flight/rudder-trim-display", sprintf("%2.1f", abs(rudder_val))); + setprop("/controls/flight/rudder-trim-letter-display", ""); + } else { + if (rudder_val >= 0.05) { + setprop("/controls/flight/rudder-trim-display", sprintf("%2.1f", abs(rudder_val))); + setprop("/controls/flight/rudder-trim-letter-display", "R"); } else { - if (rudder_val > -0.05 and rudder_val < 0.05) { + if (rudder_val <= -0.05) { setprop("/controls/flight/rudder-trim-display", sprintf("%2.1f", abs(rudder_val))); - setprop("/controls/flight/rudder-trim-letter-display", ""); - } else { - if (rudder_val >= 0.05) { - setprop("/controls/flight/rudder-trim-display", sprintf("%2.1f", abs(rudder_val))); - setprop("/controls/flight/rudder-trim-letter-display", "R"); - } else { - if (rudder_val <= -0.05) { - setprop("/controls/flight/rudder-trim-display", sprintf("%2.1f", abs(rudder_val))); - setprop("/controls/flight/rudder-trim-letter-display", "L"); - } - } + setprop("/controls/flight/rudder-trim-letter-display", "L"); } } } + } +} + +var update_items = [ + props.UpdateManager.FromProperty("/fdm/jsbsim/hydraulics/rudder/trim-deg", 0.05, func(notification) + { + updateRudderTrim(); + } ), -]; \ No newline at end of file +]; + +setlistener("/controls/switches/annun-test", updateRudderTrim, 0, 0); \ No newline at end of file diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml index 6246a2a4..3e77e0ec 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -336,7 +336,7 @@ - +