diff --git a/include/TEF6686.h b/include/TEF6686.h index 9be0f83..351857f 100644 --- a/include/TEF6686.h +++ b/include/TEF6686.h @@ -534,8 +534,8 @@ class TEF6686 { void SetFreq(uint16_t frequency); void SetFreqAM(uint16_t frequency); void getProcessing(uint16_t &highcut, uint16_t &stereo, uint16_t &sthiblend, uint8_t &stband_1, uint8_t &stband_2, uint8_t &stband_3, uint8_t &stband_4); - void getStatus(int16_t *level, uint16_t *USN, uint16_t *WAM, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel, int8_t *snr); - void getStatusAM(int16_t *level, uint16_t *noise, uint16_t *cochannel, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel, int8_t *snr); + void getStatus(int16_t *level, uint16_t *USN, uint16_t *WAM, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel); + void getStatusAM(int16_t *level, uint16_t *noise, uint16_t *cochannel, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel); uint16_t getIdentification(uint16_t *hw_version, uint16_t *sw_version); void setSoftmuteFM(uint8_t mode); void setSoftmuteAM(uint8_t mode); diff --git a/include/Tuner_Drv_Lithio.h b/include/Tuner_Drv_Lithio.h index d69a170..58b972c 100644 --- a/include/Tuner_Drv_Lithio.h +++ b/include/Tuner_Drv_Lithio.h @@ -80,7 +80,7 @@ void devTEF_Set_Cmd(TEF_MODULE module, uint8_t cmd, uint16_t len, ...); bool devTEF_Get_Cmd(TEF_MODULE module, uint8_t cmd, uint8_t *receive, uint16_t len); void devTEF_Radio_Set_Wavegen(bool mode, int16_t amplitude, uint16_t freq); -void devTEF_Radio_Get_Quality_Data(uint16_t *status, int16_t *level, uint16_t *usn, uint16_t *wam, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel, int8_t *snr); +void devTEF_Radio_Get_Quality_Data(uint16_t *status, int16_t *level, uint16_t *usn, uint16_t *wam, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel); uint8_t devTEF_APPL_Get_Operation_Status(); void devTEF_Radio_Get_RDS_Status(uint16_t *status, uint16_t *A_block, uint16_t *B_block, uint16_t *C_block, uint16_t *D_block, uint16_t *dec_error); void devTEF_Radio_Get_RDS_Data(uint16_t *status, uint16_t *A_block, uint16_t *B_block, uint16_t *C_block, uint16_t *D_block, uint16_t *dec_error); \ No newline at end of file diff --git a/include/globals.h b/include/globals.h index 6e06fdb..589fea5 100644 --- a/include/globals.h +++ b/include/globals.h @@ -230,8 +230,6 @@ extern int8_t USold; extern int8_t LevelOffset; extern int8_t LowLevelSet; extern int8_t Timezone; -extern int8_t CN; -extern int8_t CNold; extern int8_t VolSet; extern float batteryVold; extern IPAddress remoteip; diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index 3e5a554..8c02676 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -26,7 +26,7 @@ void TEF6686::TestAFEON() { timing = 0; devTEF_Set_Cmd(TEF_FM, Cmd_Tune_To, 2, 3, af[x].frequency); while (timing == 0 && !bitRead(timing, 15)) { - devTEF_Radio_Get_Quality_Data(&status, &aflevel, &afusn, &afwam, &afoffset, NULL, NULL, NULL); + devTEF_Radio_Get_Quality_Data(&status, &aflevel, &afusn, &afwam, &afoffset, NULL, NULL); timing = lowByte(status); } if (afoffset > -125 || afoffset < 125) { @@ -56,14 +56,14 @@ uint16_t TEF6686::TestAF() { int16_t aflevel, afoffset, currentoffset, currentlevel; byte timing; - devTEF_Radio_Get_Quality_Data(&status, ¤tlevel, ¤tusn, ¤twam, ¤toffset, NULL, NULL, NULL); + devTEF_Radio_Get_Quality_Data(&status, ¤tlevel, ¤tusn, ¤twam, ¤toffset, NULL, NULL); devTEF_Radio_Get_RDS_Status(&rds.rdsStat, &rds.rdsA, &rds.rdsB, &rds.rdsC, &rds.rdsD, &rds.rdsErr); for (int x = 0; x < af_counter; x++) { timing = 0; devTEF_Set_Cmd(TEF_FM, Cmd_Tune_To, 2, 3, af[x].frequency); while (timing == 0 && !bitRead(timing, 15)) { - devTEF_Radio_Get_Quality_Data(&status, &aflevel, &afusn, &afwam, &afoffset, NULL, NULL, NULL); + devTEF_Radio_Get_Quality_Data(&status, &aflevel, &afusn, &afwam, &afoffset, NULL, NULL); timing = lowByte(status); } af[x].score = aflevel - afusn - afwam; @@ -350,11 +350,11 @@ void TEF6686::setStHiBlendOffset(uint8_t start) { } } -void TEF6686::getStatus(int16_t *level, uint16_t *USN, uint16_t *WAM, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel, int8_t *snr) { - devTEF_Radio_Get_Quality_Data(NULL, level, USN, WAM, offset, bandwidth, audiolevel, snr); +void TEF6686::getStatus(int16_t *level, uint16_t *USN, uint16_t *WAM, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel) { + devTEF_Radio_Get_Quality_Data(NULL, level, USN, WAM, offset, bandwidth, audiolevel); } -void TEF6686::getStatusAM(int16_t *level, uint16_t *noise, uint16_t *cochannel, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel, int8_t *snr) { +void TEF6686::getStatusAM(int16_t *level, uint16_t *noise, uint16_t *cochannel, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel) { uint8_t buf[14]; devTEF_Get_Cmd(TEF_AM, Cmd_Get_Quality_Status, buf, sizeof(buf)); if(level != NULL) *level = Convert8bto16b(buf + 2); @@ -365,7 +365,6 @@ void TEF6686::getStatusAM(int16_t *level, uint16_t *noise, uint16_t *cochannel, if(audiolevel != NULL) *audiolevel = Convert8bto16b(buf + 12) / 10; if(level != NULL && *level < -200) *level = -200; if(level != NULL && *level > 1200) *level = 1200; - if(snr != NULL) *snr = int(0.46222375 * (float)(*level) / 10 - 0.082495118 * (float)(*noise / 50) / 10) + 10; } void TEF6686::readRDS(byte showrdserrors) { diff --git a/src/Tuner_Drv_Lithio.cpp b/src/Tuner_Drv_Lithio.cpp index ead834a..9a14afd 100644 --- a/src/Tuner_Drv_Lithio.cpp +++ b/src/Tuner_Drv_Lithio.cpp @@ -33,7 +33,7 @@ uint8_t devTEF_APPL_Get_Operation_Status() { return Convert8bto16b(buf); } -void devTEF_Radio_Get_Quality_Data(uint16_t *status, int16_t *level, uint16_t *usn, uint16_t *wam, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel, int8_t *snr) { +void devTEF_Radio_Get_Quality_Data(uint16_t *status, int16_t *level, uint16_t *usn, uint16_t *wam, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel) { uint8_t buf[14]; devTEF_Get_Cmd(TEF_FM, Cmd_Get_Quality_Data, buf, sizeof(buf)); @@ -50,7 +50,6 @@ void devTEF_Radio_Get_Quality_Data(uint16_t *status, int16_t *level, uint16_t *u if(offset != NULL) *offset = Convert8bto16b(buf + 8); if(bandwidth != NULL) *bandwidth = Convert8bto16b(buf + 10) / 10; if(audiolevel != NULL) *audiolevel = Convert8bto16b(buf + 12) / 10; - if(snr != NULL) *snr = (int8_t)(_level * 0.0675f - (_usn * 0.038f) - (_wam * 0.018f)); } void devTEF_Radio_Get_RDS_Status(uint16_t *status, uint16_t *A_block, uint16_t *B_block, uint16_t *C_block, uint16_t *D_block, uint16_t *dec_error) { diff --git a/src/comms.cpp b/src/comms.cpp index 54035b8..b77651d 100644 --- a/src/comms.cpp +++ b/src/comms.cpp @@ -776,7 +776,7 @@ void XDRGTKRoutine() { delay(5); DataPrint(String(freq_scan * 10, DEC)); DataPrint(" = "); - if (band < BAND_GAP) radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN); else radio.getStatusAM(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN); + if (band < BAND_GAP) radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus); else radio.getStatusAM(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus); DataPrint(String((SStatus / 10) + 10, DEC)); DataPrint(", "); } diff --git a/src/core.cpp b/src/core.cpp index d3155b0..1a44cfc 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -2290,7 +2290,7 @@ void Seek(bool mode) { } if (band < BAND_GAP) { - radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN); + radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus); if (isSignalQualityGood(USN, WAM, OStatus) && (!usesquelch || (Squelch < SStatus || Squelch == SQUELCH_MAX_VALUE))) { seek = false; radio.setUnMute(); @@ -2302,7 +2302,7 @@ void Seek(bool mode) { if (RDSSPYTCP) RemoteClient.print("G:\r\nRESET-------\r\n\r\n"); } } else { - radio.getStatusAM(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN); + radio.getStatusAM(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus); if ((USN < amscansens * 30) && (OStatus < 2 && OStatus > -2) && (!usesquelch || (Squelch < SStatus || Squelch == 920))) { seek = false; radio.setUnMute(); @@ -2339,7 +2339,7 @@ uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, ui radio.SetFreq(frequency); radio.clearRDS(); delay(DELAY_TUNE_MS); - radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN); + radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus); if (isSignalQualityGood(USN, WAM, OStatus)) { for (byte y = 0; y < 20; y++) { delay(DELAY_RDS_READ_MS); diff --git a/src/globals.cpp b/src/globals.cpp index 0e854eb..754eca1 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -218,8 +218,6 @@ int8_t USold = 0; int8_t LevelOffset; int8_t LowLevelSet; int8_t Timezone; -int8_t CN; -int8_t CNold; RTC_DATA_ATTR int8_t VolSet; float batteryVold; IPAddress remoteip; diff --git a/src/gui.cpp b/src/gui.cpp index 95fe380..674cd09 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -3036,7 +3036,6 @@ void BuildDisplay() { if (usesquelch || autosquelch) tftPrint(ALEFT, "SQ:", 197, 147, ActiveColor, ActiveColorSmooth, 16); tftPrint(ALEFT, "US:", 259, 147, ActiveColor, ActiveColorSmooth, 16); tftPrint(ALEFT, "MP:", 259, 165, ActiveColor, ActiveColorSmooth, 16); - tftPrint(ALEFT, "CN:", 197, 165, ActiveColor, ActiveColorSmooth, 16); tftPrint(ARIGHT, "dB", 255, 165, ActiveColor, ActiveColorSmooth, 16); tftPrint(ARIGHT, "%", 316, 165, ActiveColor, ActiveColorSmooth, 16); tftPrint(ARIGHT, "%", 316, 147, ActiveColor, ActiveColorSmooth, 16); @@ -3088,7 +3087,6 @@ void BuildDisplay() { SStatusold = 2000; SStatus = 100; rssiold = 2000; - CNold = 254; af_counterold = 254; batteryold = 6; batteryVold = 0; diff --git a/src/main.cpp b/src/main.cpp index 9ce091b..6d0a078 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -709,12 +709,10 @@ void doSquelch() { void ShowSignalLevel() { SAvg = (((SAvg * 9) + 5) / 10) + SStatus; - SAvg2 = (((SAvg2 * 9) + 5) / 10) + CN; SAvg4 = (((SAvg4 * 9) + 5) / 10) + WAM; SAvg5 = (((SAvg5 * 9) + 5) / 10) + USN; SStatus = SAvg / 10; - CN = SAvg2 / 10; MP = SAvg4 / 10; US = SAvg5 / 10; @@ -722,17 +720,6 @@ void ShowSignalLevel() { if (millis() >= SNRupdatetimer + TIMER_SNR_TIMER) { SNRupdatetimer = millis(); if (!advancedRDS) { - if (CN > (CNold + 1) || CN < (CNold - 1)) { - if (CNold == -126) tftPrint16(ARIGHT, "--", 234, 165, BackgroundColor, BackgroundColor); else tftPrint16(ARIGHT, String(CNold), 234, 165, BackgroundColor, BackgroundColor); - if (tuned) { - tftPrint16(ARIGHT, String(CN), 234, 165, PrimaryColor, PrimaryColorSmooth); - CNold = CN; - } else { - tftPrint16(ARIGHT, "--", 234, 165, PrimaryColor, PrimaryColorSmooth); - CNold = -126; - } - } - byte MPprint = constrain(map(MP, 0, 1000, 0, 100), 0, 100); if (MPprint != MPold) { tftReplace(ARIGHT, String(MPold), (band < BAND_GAP ? String(MPprint) : "--"), 299, 165, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16); @@ -795,7 +782,7 @@ void ShowSignalLevel() { } if (!seek) { - if (tuned && CN > 15 && SStatus > 300) { + if (tuned && SStatus > 300) { if (!setextendbw) { setextendbw = true; radio.extendBW(true); @@ -1152,7 +1139,7 @@ void loop() { } if (!scanholdflag) delay(75); - radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN); + radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus); if (!initdxscan) { switch (scancancel) { @@ -1354,8 +1341,8 @@ void loop() { if (millis() >= lowsignaltimer + 300) { lowsignaltimer = millis(); if (af || (!screenmute || (screenmute && (XDRGTKTCP || XDRGTKUSB)))) { - if (band < BAND_GAP) radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN); - else radio.getStatusAM(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN); + if (band < BAND_GAP) radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus); + else radio.getStatusAM(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus); } if (!BWtune && !menu) { doSquelch(); @@ -1365,8 +1352,8 @@ void loop() { } else { if (af || (!screenmute || (screenmute && (XDRGTKTCP || XDRGTKUSB)))) { - if (band < BAND_GAP) radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN); - else radio.getStatusAM(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN); + if (band < BAND_GAP) radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus); + else radio.getStatusAM(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus); } if (!BWtune && !menu) { doSquelch();