From 876330772bfe44bd16c8dfc7217c078a99d190dc Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Mon, 7 Nov 2022 23:14:02 +0100 Subject: [PATCH] Navradio: fix regression and optimize older code - Fix a little regression introduced in commit d2f4807fa2add: changing the standby frequency disabled the low-pass filter for the next call to updateReceiver(); this must happen when the selected frequency is changed but not when the standby frequency is changed. This is covered by the recently-added unit test NavRadioTests::testVORSignalQuality. - Optimization of the older code: no need to perform a navaid search() when only the standby frequency is changed. --- src/Instrumentation/navradio.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Instrumentation/navradio.cxx b/src/Instrumentation/navradio.cxx index b722da6ac..4f56e390c 100644 --- a/src/Instrumentation/navradio.cxx +++ b/src/Instrumentation/navradio.cxx @@ -698,10 +698,12 @@ void FGNavRadio::valueChanged (SGPropertyNode* prop) _navaid = NULL; _apply_lowpass_filter = false; _time_before_search_sec = 0; - } else if ((prop == freq_node) || (prop == alt_freq_node)) { + } else if (prop == alt_freq_node) { + updateFormattedFrequencies(); + } else if (prop == freq_node) { updateFormattedFrequencies(); _apply_lowpass_filter = false; // signal quality allowed to vary quickly - _time_before_search_sec = 0.0; // force a frequency update + _time_before_search_sec = 0.0; // trigger a new search() ASAP } }