Fixed bug in deemphasis selector

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-10-24 19:23:16 +02:00
parent 6786df55bc
commit dd2370a083
2 changed files with 23 additions and 15 deletions

View File

@@ -236,9 +236,11 @@ void TEF6686::setAGC(uint8_t agc) {
}
void TEF6686::setDeemphasis(uint8_t timeconstant) {
if (timeconstant == 1) devTEF_Radio_Set_Deemphasis(500);
if (timeconstant == 2) devTEF_Radio_Set_Deemphasis(750);
if (timeconstant == 3) devTEF_Radio_Set_Deemphasis(0);
switch (timeconstant) {
case 1: devTEF_Radio_Set_Deemphasis(500); break;
case 2: devTEF_Radio_Set_Deemphasis(750); break;
default: devTEF_Radio_Set_Deemphasis(0); break;
}
}
void TEF6686::setAudio(uint8_t audio) {
@@ -532,7 +534,7 @@ void TEF6686::readRDS(byte showrdserrors)
af_counterbcheck = 1;
} else if ((rds.rdsC >> 8) > 224 && (rds.rdsC >> 8) < 250 && ((rds.rdsC & 0xFF) * 10 + 8750) != currentfreq && rds.hasAF) {
afmethodBprobe = false;
afmethodBtrigger = true;
afmethodBtrigger = true;
af_counterb = 0;
af_counterbcheck = 0;
}

View File

@@ -57,7 +57,7 @@ void Communication() {
SelectBand();
} else {
radio.SetFreqAM(frequency_LW);
frequency_AM = 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;
@@ -66,7 +66,7 @@ void Communication() {
SelectBand();
} else {
radio.SetFreqAM(frequency_MW);
frequency_AM = frequency_MW;
frequency_AM = frequency_MW;
}
} else {
frequency_SW = tempfreq;
@@ -75,7 +75,7 @@ void Communication() {
SelectBand();
} else {
radio.SetFreqAM(frequency_SW);
frequency_AM = frequency_SW;
frequency_AM = frequency_SW;
}
}
}
@@ -248,8 +248,14 @@ void XDRGTKRoutine() {
break;
case 'D':
DeEmphasis = atol(buff + 1);
DataPrint("D" + String(DeEmphasis) + "\n");
byte demp;
demp = atol(buff + 1);
DataPrint("D" + String(demp) + "\n");
switch (demp) {
case 0: DeEmphasis = 1; break;
case 1: DeEmphasis = 2; break;
case 2: DeEmphasis = 0; break;
}
radio.setDeemphasis(DeEmphasis);
break;
@@ -348,8 +354,8 @@ void XDRGTKRoutine() {
freqtemp = atoi(buff + 1);
if (seek) seek = false;
if (freqtemp >= LWLowEdgeSet && freqtemp <= LWHighEdgeSet) {
frequency_LW = freqtemp;
frequency_AM = freqtemp;
frequency_LW = freqtemp;
frequency_AM = freqtemp;
if (afscreen || advancedRDS) BuildDisplay();
if (band != BAND_LW) {
band = BAND_LW;
@@ -359,8 +365,8 @@ void XDRGTKRoutine() {
DataPrint("M1\n");
}
if (freqtemp >= MWLowEdgeSet && freqtemp <= MWHighEdgeSet) {
frequency_AM = freqtemp;
frequency_MW = freqtemp;
frequency_AM = freqtemp;
frequency_MW = freqtemp;
if (afscreen || advancedRDS) BuildDisplay();
if (band != BAND_MW) {
band = BAND_MW;
@@ -370,8 +376,8 @@ void XDRGTKRoutine() {
DataPrint("M1\n");
}
if (freqtemp >= SWLowEdgeSet && freqtemp <= SWHighEdgeSet) {
frequency_SW = freqtemp;
frequency_AM = freqtemp;
frequency_SW = freqtemp;
frequency_AM = freqtemp;
if (afscreen || advancedRDS) BuildDisplay();
if (band != BAND_SW) {
band = BAND_SW;