Bugfix: AF should not work when in menu or in afpage

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-07-23 16:57:25 +02:00
parent 8c2cd6ae19
commit 5e089dc3a1
+19 -17
View File
@@ -411,7 +411,7 @@ void setup() {
break; break;
case BAND_OIRT: case BAND_OIRT:
if (frequency % FREQ_OIRT_STEP_30K != 0) { if (frequency % FREQ_OIRT_STEP_30K != 0) {
Round30K(frequency_OIRT); Round30K(frequency_OIRT);
} }
break; break;
default: break; default: break;
@@ -623,21 +623,11 @@ void loop() {
if (power == true) { if (power == true) {
Communication(); Communication();
if (band == BAND_FM && af && radio.rds.correctPI != 0) { if (!menu && !afpage) {
if ((aftest && millis() >= aftimer + 3000) || ((USN > 250 || WAM > 250) && millis() >= aftimer + 1000)) { if (band == BAND_FM && af && radio.rds.correctPI != 0) {
aftimer = millis(); if ((aftest && millis() >= aftimer + 3000) || ((USN > 250 || WAM > 250) && millis() >= aftimer + 1000)) {
aftest = false; aftimer = millis();
frequency = radio.TestAF(); aftest = false;
if (freqold != frequency) {
ShowFreq(0);
if (XDRGTKUSB == true || XDRGTKTCP == true) DataPrint("T" + String(frequency * 10));
store = true;
}
}
if (band == BAND_FM && millis() >= aftimer + 10000) {
aftimer = millis();
if (USN > 150 || WAM > 150) {
frequency = radio.TestAF(); frequency = radio.TestAF();
if (freqold != frequency) { if (freqold != frequency) {
ShowFreq(0); ShowFreq(0);
@@ -645,6 +635,18 @@ void loop() {
store = true; store = true;
} }
} }
if (band == BAND_FM && millis() >= aftimer + 10000) {
aftimer = millis();
if (USN > 150 || WAM > 150) {
frequency = radio.TestAF();
if (freqold != frequency) {
ShowFreq(0);
if (XDRGTKUSB == true || XDRGTKTCP == true) DataPrint("T" + String(frequency * 10));
store = true;
}
}
}
} }
} }
@@ -4262,7 +4264,7 @@ void ShowFreq(int mode) {
Udp.beginPacket(remoteip, 9030); Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF tuner;freq="); Udp.print("from=TEF tuner;freq=");
if (band > BAND_GAP) Udp.print(String(frequency_AM) + "000;ClearRDS=1"); if (band > BAND_GAP) Udp.print(String(frequency_AM) + "000;ClearRDS=1");
else Udp.print(String(band == BAND_FM ? frequency: frequency_OIRT) + "0000;ClearRDS=1"); else Udp.print(String(band == BAND_FM ? frequency : frequency_OIRT) + "0000;ClearRDS=1");
Udp.endPacket(); Udp.endPacket();
} }
} }