1
0
Fork 0

Navradio: fix regression and optimize older code

- Fix a little regression introduced in commit d2f4807fa2: 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.
This commit is contained in:
Florent Rougon 2022-11-07 23:14:02 +01:00
parent 8290d94ada
commit 876330772b

View file

@ -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
}
}