From e7d893e4a31df5147990100cb0337649d8a8764d Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Tue, 10 Oct 2023 23:19:38 +0200 Subject: [PATCH] Fix on StationList LW/MW/SW tuning --- src/comms.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/comms.cpp b/src/comms.cpp index 581e8d4..007293a 100644 --- a/src/comms.cpp +++ b/src/comms.cpp @@ -50,22 +50,34 @@ void Communication() { ScreensaverTimerReopen(); } unsigned int tempfreq = (stlfreq.toInt()) / 1000; - if (tempfreq >= FREQ_LW_LOW_EDGE_MIN && tempfreq <= FREQ_LW_HIGH_EDGE_MAX && band != BAND_LW) { - band = BAND_LW; + if (tempfreq >= FREQ_LW_LOW_EDGE_MIN && tempfreq <= FREQ_LW_HIGH_EDGE_MAX) { frequency_LW = tempfreq; - SelectBand(); - } else if (tempfreq >= FREQ_MW_LOW_EDGE_MIN_9K && tempfreq <= FREQ_MW_HIGH_EDGE_MAX_9K && band != BAND_MW) { - band = BAND_MW; + if (band != BAND_LW) { + band = BAND_LW; + SelectBand(); + } else { + radio.SetFreqAM(frequency_LW); + frequency_AM = frequency_LW; + } + } else if (tempfreq >= FREQ_MW_LOW_EDGE_MIN_9K && tempfreq <= FREQ_MW_HIGH_EDGE_MAX_9K) { frequency_MW = tempfreq; - SelectBand(); + if (band != BAND_MW) { + band = BAND_MW; + SelectBand(); + } else { + radio.SetFreqAM(frequency_MW); + frequency_AM = frequency_MW; + } } else { + frequency_SW = tempfreq; if (band != BAND_SW) { - frequency_SW = tempfreq; band = BAND_SW; SelectBand(); + } else { + radio.SetFreqAM(frequency_SW); + frequency_AM = frequency_SW; } } - radio.SetFreqAM(frequency_AM); } radio.clearRDS(fullsearchrds); ShowFreq(0);