Bugfix in Stationlist tuning

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-10-09 23:23:00 +02:00
parent 014a4614bb
commit fa7146f52a
3 changed files with 13 additions and 8 deletions
+3 -2
View File
@@ -66,6 +66,7 @@ bool errorAold;
bool errorBold; bool errorBold;
bool errorCold; bool errorCold;
bool errorDold; bool errorDold;
bool externaltune;
bool fullsearchrds; bool fullsearchrds;
bool hasafold; bool hasafold;
bool haseonold; bool haseonold;
@@ -1645,7 +1646,7 @@ void SelectBand() {
if (band == BAND_MW) freqold = frequency_MW; if (band == BAND_MW) freqold = frequency_MW;
if (band == BAND_SW) freqold = frequency_SW; if (band == BAND_SW) freqold = frequency_SW;
LimitAMFrequency(); LimitAMFrequency();
CheckBandForbiddenAM(); if (!externaltune) CheckBandForbiddenAM();
radio.SetFreqAM(frequency_AM); radio.SetFreqAM(frequency_AM);
radio.setAMAttenuation(amrfagc); radio.setAMAttenuation(amrfagc);
radio.setAMCoChannel(amcodect, amcodectcount); radio.setAMCoChannel(amcodect, amcodectcount);
@@ -1677,7 +1678,7 @@ void SelectBand() {
BWset = BWsetFM; BWset = BWsetFM;
radio.clearRDS(fullsearchrds); radio.clearRDS(fullsearchrds);
freqold = frequency_AM; freqold = frequency_AM;
CheckBandForbiddenFM(); if (!externaltune) CheckBandForbiddenFM();
doBW(); doBW();
if (!screenmute) BuildDisplay(); if (!screenmute) BuildDisplay();
} }
+9 -6
View File
@@ -15,22 +15,24 @@ void Communication() {
if (strcmp(packetBuffer, "from=StationList;freq=?;bandwidth=?") == 0) { if (strcmp(packetBuffer, "from=StationList;freq=?;bandwidth=?") == 0) {
ShowFreq(0); ShowFreq(0);
} else { } else {
externaltune = true;
int symPos = packet.indexOf("freq="); int symPos = packet.indexOf("freq=");
String stlfreq = packet.substring(symPos + 5, packetSize); String stlfreq = packet.substring(symPos + 5, packetSize);
if (afscreen) BuildAdvancedRDS(); if (afscreen) BuildAdvancedRDS();
if ((stlfreq.toInt()) / 10000 > 6500 && (stlfreq.toInt()) / 10000 < 10800) { if ((stlfreq.toInt()) / 10000 > 6500 && (stlfreq.toInt()) / 10000 < 10800) {
unsigned int tempfreq = (stlfreq.toInt()) / 10000; unsigned int tempfreq = (stlfreq.toInt()) / 10000;
if (tempfreq >= FREQ_FM_OIRT_START && tempfreq <= FREQ_FM_OIRT_END) { if (tempfreq >= FREQ_FM_OIRT_START && tempfreq <= FREQ_FM_OIRT_END) {
if (band != BAND_OIRT) { if (band != BAND_OIRT) {
band = BAND_OIRT; band = BAND_OIRT;
frequency_OIRT = tempfreq; frequency_OIRT = tempfreq;
BuildDisplay(); SelectBand();
} }
} else { } else {
if (band != BAND_FM) { if (band != BAND_FM) {
band = BAND_FM; band = BAND_FM;
frequency = tempfreq; frequency = tempfreq;
BuildDisplay(); SelectBand();
} }
} }
if (band == BAND_OIRT) { if (band == BAND_OIRT) {
@@ -47,18 +49,18 @@ void Communication() {
BuildDisplay(); BuildDisplay();
ScreensaverTimerReopen(); ScreensaverTimerReopen();
} }
frequency_AM = (stlfreq.toInt()) / 1000; unsigned int tempfreq = (stlfreq.toInt()) / 1000;
if (frequency_AM >= FREQ_LW_LOW_EDGE_MIN && frequency_AM <= FREQ_LW_HIGH_EDGE_MAX && band != BAND_LW) { if (frequency_AM >= FREQ_LW_LOW_EDGE_MIN && frequency_AM <= FREQ_LW_HIGH_EDGE_MAX && band != BAND_LW) {
band = BAND_LW; band = BAND_LW;
frequency_LW = frequency_AM; frequency_LW = tempfreq;
SelectBand(); SelectBand();
} else if (frequency_AM >= FREQ_MW_LOW_EDGE_MIN_9K && frequency_AM <= FREQ_MW_HIGH_EDGE_MAX_9K && band != BAND_MW) { } else if (frequency_AM >= FREQ_MW_LOW_EDGE_MIN_9K && frequency_AM <= FREQ_MW_HIGH_EDGE_MAX_9K && band != BAND_MW) {
band = BAND_MW; band = BAND_MW;
frequency_MW = frequency_AM; frequency_MW = tempfreq;
SelectBand(); SelectBand();
} else { } else {
if (band != BAND_SW) { if (band != BAND_SW) {
frequency_SW = frequency_AM; frequency_SW = tempfreq;
band = BAND_SW; band = BAND_SW;
SelectBand(); SelectBand();
} }
@@ -68,6 +70,7 @@ void Communication() {
radio.clearRDS(fullsearchrds); radio.clearRDS(fullsearchrds);
ShowFreq(0); ShowFreq(0);
store = true; store = true;
externaltune = false;
} }
} }
} }
+1
View File
@@ -15,6 +15,7 @@ extern bool afscreen;
extern bool aftest; extern bool aftest;
extern bool BWreset; extern bool BWreset;
extern bool direction; extern bool direction;
extern bool externaltune;
extern bool fullsearchrds; extern bool fullsearchrds;
extern bool menu; extern bool menu;
extern bool RDSSPYTCP; extern bool RDSSPYTCP;