Added auto bandselector for StationList

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-10-01 14:27:27 +02:00
parent 78dfa435af
commit cd263f8c7e
+23 -10
View File
@@ -17,24 +17,37 @@ void Communication() {
} else {
int symPos = packet.indexOf("freq=");
String stlfreq = packet.substring(symPos + 5, packetSize);
if ((stlfreq.toInt()) / 10000 > 6500 && (stlfreq.toInt()) / 10000 < 10800) {
frequency = (stlfreq.toInt()) / 10000;
if (frequency >= FREQ_FM_OIRT_START && frequency <= FREQ_FM_OIRT_END && band != BAND_OIRT) {
band = BAND_OIRT;
SelectBand();
} else {
if (band != BAND_FM) {
band = BAND_FM;
SelectBand();
}
frequency = (stlfreq.toInt()) / 10000;
}
radio.SetFreq(frequency);
}
// To Do: AM
// if ((stlfreq.toInt()) / 1000 > 144 && (stlfreq.toInt()) / 1000 < 27000) {
// if (band != 5) {
// band = 5;
// SelectBand();
// }
// frequency5 = (stlfreq.toInt()) / 1000;
// radio.SetFreqAM(frequency5);
// }
if ((stlfreq.toInt()) / 1000 > 144 && (stlfreq.toInt()) / 1000 < 27000) {
frequency_AM = (stlfreq.toInt()) / 1000;
if (frequency_AM >= FREQ_LW_LOW_EDGE_MIN && frequency_AM <= FREQ_LW_HIGH_EDGE_MAX && band != BAND_LW) {
band = BAND_LW;
SelectBand();
} else if (frequency_AM >= FREQ_MW_LOW_EDGE_MIN_9K && frequency_AM <= FREQ_MW_HIGH_EDGE_MAX_9K && band != BAND_MW) {
band = BAND_MW;
SelectBand();
} else {
if (band != BAND_SW) {
band = BAND_SW;
SelectBand();
}
}
radio.SetFreqAM(frequency_AM);
}
radio.clearRDS(fullsearchrds);
ShowFreq(0);
store = true;