From 0279672d8e42bc362e301511c8b514c58dff2d83 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Thu, 10 Aug 2023 21:03:16 +0200 Subject: [PATCH] Changes in SNR --- TEF6686_ESP32.ino | 36 ++++++++++++++++++------------------ src/TEF6686.cpp | 8 ++++---- src/TEF6686.h | 4 ++-- src/Tuner_Drv_Lithio.cpp | 4 ++-- src/Tuner_Drv_Lithio.h | 4 ++-- src/comms.cpp | 4 ++-- src/comms.h | 2 +- src/gui.cpp | 2 +- src/gui.h | 2 +- src/language.h | 24 ++++++++++++------------ 10 files changed, 45 insertions(+), 45 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index cfa8072..8ea5326 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -156,7 +156,6 @@ byte showmodulation; byte showSWMIBand; byte submenu; byte nowToggleSWMIBand = 1; -byte SNRold; byte stepsize; byte StereoLevel; byte subnetclient; @@ -214,7 +213,7 @@ int rssiold = 200; int scanner_filter; int SecondaryColor; int SecondaryColorSmooth; -int snrupdatetimer; +int SNRupdatetimer; int Sqstatusold; int Squelch; int Squelchold; @@ -233,6 +232,8 @@ int16_t SAvg2; int16_t SStatus; int8_t LevelOffset; int8_t LowLevelSet; +int8_t CN; +int8_t CNold; int8_t VolSet; float batteryVold; IPAddress remoteip; @@ -269,7 +270,6 @@ uint16_t SWMIBandPosold; // Fix Me: Should store this parameter into flash, for uint16_t USN; uint16_t WAM; uint8_t buff_pos; -uint8_t SNR; unsigned int change; unsigned int ConverterSet; unsigned int freq_scan; @@ -759,7 +759,7 @@ void loop() { if (millis() >= lowsignaltimer + 300) { lowsignaltimer = millis(); - if (band < BAND_GAP) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); + if (band < BAND_GAP) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, CN); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, CN); if (screenmute == true) readRds(); if (menu == false) { doSquelch(); @@ -768,7 +768,7 @@ void loop() { } } else { - if (band < BAND_GAP) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); + if (band < BAND_GAP) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, CN); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, CN); if (menu == false) { doSquelch(); readRds(); @@ -778,7 +778,7 @@ void loop() { } if (menu == true && menuopen == true && menupage == FMSETTINGS && menuoption == ITEM4) { - if (band < BAND_GAP) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); + if (band < BAND_GAP) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, CN); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, CN); if (millis() >= lowsignaltimer + 500 || change2 == true) { lowsignaltimer = millis(); change2 = false; @@ -1680,7 +1680,7 @@ void SelectBand() { CheckBandForbiddenAM(); radio.SetFreqAM(frequency_AM); doBW(); - radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); + radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, CN); if (screenmute == false) radio.clearRDS(fullsearchrds); BuildDisplay(); if (region == 0) tftPrint(-1, "PI:", 212, 193, GreyoutColor, BackgroundColor, 16); if (region == 1) tftPrint(-1, "ID:", 212, 193, GreyoutColor, BackgroundColor, 16); @@ -1704,7 +1704,7 @@ void SelectBand() { freqold = frequency_AM; CheckBandForbiddenFM(); doBW(); - radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); + radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, CN); if (screenmute == false) radio.clearRDS(fullsearchrds); BuildDisplay(); } } @@ -2301,23 +2301,23 @@ void ShowFreq(int mode) { void ShowSignalLevel() { if (screenmute == false) { - if (millis() >= snrupdatetimer + TIMER_SNR_TIMER) { - snrupdatetimer = millis(); + if (millis() >= SNRupdatetimer + TIMER_SNR_TIMER) { + SNRupdatetimer = millis(); if (!advancedRDS) { - if (SNR > (SNRold + 1) || SNR < (SNRold - 1)) { - if (SNRold == 0) tftPrint(1, "--", 295, 163, BackgroundColor, BackgroundColor, 16); else tftPrint(1, String(SNRold), 295, 163, BackgroundColor, BackgroundColor, 16); + if (CN > (CNold + 1) || CN < (CNold - 1)) { + if (CNold == 0) tftPrint(1, "--", 295, 163, BackgroundColor, BackgroundColor, 16); else tftPrint(1, String(CNold), 295, 163, BackgroundColor, BackgroundColor, 16); if (tuned == true) { - if (SNR == 0) tftPrint(1, "--", 295, 163, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, String(SNR), 295, 163, PrimaryColor, PrimaryColorSmooth, 16); - SNRold = SNR; + if (CN == 0) tftPrint(1, "--", 295, 163, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, String(CN), 295, 163, PrimaryColor, PrimaryColorSmooth, 16); + CNold = CN; } else { tftPrint(1, "--", 295, 163, PrimaryColor, PrimaryColorSmooth, 16); - SNRold = 0; + CNold = 0; } } } } SAvg = (((SAvg * 9) + 5) / 10) + SStatus; - SAvg2 = (((SAvg2 * 9) + 5) / 10) + SNR; + SAvg2 = (((SAvg2 * 9) + 5) / 10) + CN; float sval = 0; int16_t smeter = 0; @@ -2334,7 +2334,7 @@ void ShowSignalLevel() { smeter = int16_t(sval); SStatus = SAvg / 10; - SNR = SAvg2 / 10; + CN = SAvg2 / 10; if (menu == false) analogWrite(SMETERPIN, smeter); @@ -3178,7 +3178,7 @@ void Seek(bool mode) { if (XDRGTKUSB == true || XDRGTKTCP == true) { if (band == BAND_FM) DataPrint("T" + String(frequency * 10) + "\n"); else DataPrint("T" + String(frequency_AM) + "\n"); } - radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); + radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, CN); if ((USN < 200) && (WAM < 230) && (OStatus < 80 && OStatus > -80) && (Squelch < SStatus || Squelch == 920)) { seek = false; diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index ba549d4..0cc9223 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -12,7 +12,7 @@ void TEF6686::TestAFEON() { uint16_t rdsStat; uint16_t dummy1; uint16_t dummy2; - uint8_t dummy3; + int8_t dummy3; int16_t aflevel; uint16_t afusn; uint16_t afwam; @@ -56,7 +56,7 @@ uint16_t TEF6686::TestAF() { uint16_t rdsStat; uint16_t dummy1; uint16_t dummy2; - uint8_t dummy3; + int8_t dummy3; int16_t aflevel; uint16_t afusn; @@ -322,7 +322,7 @@ bool TEF6686::getProcessing(uint16_t &highcut, uint16_t &stereo, uint16_t &sthib return stband_4; } -bool TEF6686::getStatus(int16_t &level, uint16_t &USN, uint16_t &WAM, int16_t &offset, uint16_t &bandwidth, uint16_t &modulation, uint8_t &snr) { +bool TEF6686::getStatus(int16_t &level, uint16_t &USN, uint16_t &WAM, int16_t &offset, uint16_t &bandwidth, uint16_t &modulation, int8_t &snr) { uint16_t status; devTEF_Radio_Get_Quality_Status(&status, &level, &USN, &WAM, &offset, &bandwidth, &modulation, &snr); return level; @@ -333,7 +333,7 @@ bool TEF6686::getStatus(int16_t &level, uint16_t &USN, uint16_t &WAM, int16_t &o return snr; } -bool TEF6686::getStatusAM(int16_t &level, uint16_t &noise, uint16_t &cochannel, int16_t &offset, uint16_t &bandwidth, uint16_t &modulation, uint8_t &snr) { +bool TEF6686::getStatusAM(int16_t &level, uint16_t &noise, uint16_t &cochannel, int16_t &offset, uint16_t &bandwidth, uint16_t &modulation, int8_t &snr) { devTEF_Radio_Get_Quality_Status_AM(&level, &noise, &cochannel, &offset, &bandwidth, &modulation, &snr); return level; return noise; diff --git a/src/TEF6686.h b/src/TEF6686.h index 3a3bc29..74af081 100644 --- a/src/TEF6686.h +++ b/src/TEF6686.h @@ -207,8 +207,8 @@ class TEF6686 { void SetFreq(uint16_t frequency); void SetFreqAM(uint16_t frequency); bool 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); - bool getStatus(int16_t &level, uint16_t &USN, uint16_t &WAM, int16_t &offset, uint16_t &bandwidth, uint16_t &modulation, uint8_t &snr); - bool getStatusAM(int16_t &level, uint16_t &noise, uint16_t &cochannel, int16_t &offset, uint16_t &bandwidth, uint16_t &modulation, uint8_t &snr); + bool getStatus(int16_t &level, uint16_t &USN, uint16_t &WAM, int16_t &offset, uint16_t &bandwidth, uint16_t &modulation, int8_t &snr); + bool getStatusAM(int16_t &level, uint16_t &noise, uint16_t &cochannel, int16_t &offset, uint16_t &bandwidth, uint16_t &modulation, int8_t &snr); bool getIdentification(uint16_t &device, uint16_t &hw_version, uint16_t &sw_version); void setSoftmuteFM(uint8_t mode); void setSoftmuteAM(uint8_t mode); diff --git a/src/Tuner_Drv_Lithio.cpp b/src/Tuner_Drv_Lithio.cpp index f797b67..50bd915 100644 --- a/src/Tuner_Drv_Lithio.cpp +++ b/src/Tuner_Drv_Lithio.cpp @@ -206,7 +206,7 @@ bool devTEF_Radio_Get_Processing_Status (uint16_t *highcut, uint16_t *stereo, ui return r; } -bool devTEF_Radio_Get_Quality_Status (uint16_t *status, int16_t *level, uint16_t *usn, uint16_t *wam, int16_t *offset, uint16_t *bandwidth, uint16_t *mod, uint8_t *snr) { +bool devTEF_Radio_Get_Quality_Status (uint16_t *status, int16_t *level, uint16_t *usn, uint16_t *wam, int16_t *offset, uint16_t *bandwidth, uint16_t *mod, int8_t *snr) { uint8_t buf[14]; uint16_t r = devTEF_Get_Cmd(TEF_FM, Cmd_Get_Quality_Data, buf, sizeof(buf)); *status = Convert8bto16b(buf); @@ -222,7 +222,7 @@ bool devTEF_Radio_Get_Quality_Status (uint16_t *status, int16_t *level, uint16_t return r; } -bool devTEF_Radio_Get_Quality_Status_AM (int16_t *level, uint16_t *noise, uint16_t *cochannel, int16_t *offset, uint16_t *bandwidth, uint16_t *mod, uint8_t *snr) { +bool devTEF_Radio_Get_Quality_Status_AM (int16_t *level, uint16_t *noise, uint16_t *cochannel, int16_t *offset, uint16_t *bandwidth, uint16_t *mod, int8_t *snr) { uint8_t buf[14]; uint16_t r = devTEF_Get_Cmd(TEF_AM, Cmd_Get_Quality_Data, buf, sizeof(buf)); diff --git a/src/Tuner_Drv_Lithio.h b/src/Tuner_Drv_Lithio.h index f98d71d..79a41de 100644 --- a/src/Tuner_Drv_Lithio.h +++ b/src/Tuner_Drv_Lithio.h @@ -67,9 +67,9 @@ bool devTEF_Set_Cmd(TEF_MODULE module, uint8_t cmd, uint16_t len, ...); bool devTEF_Radio_Get_Identification (uint16_t *device, uint16_t *hw_version, uint16_t *sw_version); bool devTEF_Radio_Tune_To (uint16_t frequency ); bool devTEF_Radio_Tune_AM (uint16_t frequency ); -bool devTEF_Radio_Get_Quality_Status (uint16_t *status, int16_t *level, uint16_t *usn, uint16_t *wam, int16_t *offset, uint16_t *bandwidth, uint16_t *mod, uint8_t *snr); +bool devTEF_Radio_Get_Quality_Status (uint16_t *status, int16_t *level, uint16_t *usn, uint16_t *wam, int16_t *offset, uint16_t *bandwidth, uint16_t *mod, int8_t *snr); bool devTEF_Radio_Get_Processing_Status (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); -bool devTEF_Radio_Get_Quality_Status_AM (int16_t *level, uint16_t *noise, uint16_t *cochannel, int16_t *offset, uint16_t *bandwidth, uint16_t *mod, uint8_t *snr); +bool devTEF_Radio_Get_Quality_Status_AM (int16_t *level, uint16_t *noise, uint16_t *cochannel, int16_t *offset, uint16_t *bandwidth, uint16_t *mod, int8_t *snr); bool devTEF_APPL_Get_Operation_Status(uint8_t *bootstatus); bool devTEF_Audio_Set_Mute(uint8_t mode); bool devTEF_Audio_Set_Volume(int16_t volume); diff --git a/src/comms.cpp b/src/comms.cpp index b203863..cefde8e 100644 --- a/src/comms.cpp +++ b/src/comms.cpp @@ -414,7 +414,7 @@ void XDRGTKRoutine() { radio.SetFreq(freq_scan); DataPrint(String(freq_scan * 10, DEC)); DataPrint(" = "); - if (band < BAND_GAP) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); + if (band < BAND_GAP) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, CN); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, CN); DataPrint(String((SStatus / 10) + 10, DEC)); DataPrint(", "); } @@ -511,7 +511,7 @@ void XDRGTKRoutine() { DataPrint("Sm"); } } - DataPrint(String(((SStatus * 100) + 10875) / 1000) + "." + String(((SStatus * 100) + 10875) / 100 % 10) + ", " + String(WAM / 10) + ", " + String(SNR) + "\n"); + DataPrint(String(((SStatus * 100) + 10875) / 1000) + "." + String(((SStatus * 100) + 10875) / 100 % 10) + ", " + String(WAM / 10) + ", " + String(CN) + "\n"); } void passwordcrypt() { diff --git a/src/comms.h b/src/comms.h index 2a1e154..13658bd 100644 --- a/src/comms.h +++ b/src/comms.h @@ -73,7 +73,7 @@ extern uint16_t MStatus; extern uint16_t USN; extern uint16_t WAM; extern uint8_t buff_pos; -extern uint8_t SNR; +extern int8_t CN; extern unsigned int freq_scan; extern unsigned int frequency; extern unsigned int frequency_AM; diff --git a/src/gui.cpp b/src/gui.cpp index 34fdb95..f351aaa 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -784,7 +784,7 @@ void BuildDisplay() { SStatusold = 2000; SStatus = 100; rssiold = 2000; - SNRold = 254; + CNold = 254; af_counterold = 254; batteryold = 6; batteryVold = 0; diff --git a/src/gui.h b/src/gui.h index d50816f..4c6044f 100644 --- a/src/gui.h +++ b/src/gui.h @@ -95,7 +95,7 @@ extern byte screensaverOptions[5]; extern byte screensaverset; extern byte showmodulation; extern byte showSWMIBand; -extern byte SNRold; +extern int8_t CNold; extern byte StereoLevel; extern byte StereoLevel; extern byte submenu; diff --git a/src/language.h b/src/language.h index 6061f2a..a46ea66 100644 --- a/src/language.h +++ b/src/language.h @@ -187,9 +187,9 @@ static const char* const myLanguage[16][196] = { "Connectivity", // 183 "PRESS MODE TO RETURN", // 184 "AM CoChannelDet", // 185 - "CoChannelDet sensitivity", // 186 - "AM CoChannelDet threshold", // 187 - "CoChannelDet counet", // 188 + "CoChannel Det sensitivity", // 186 + "CoChannel Det threshold", // 187 + "CoChannel Det counter", // 188 "MAIN", // 189 "AUDIO", // 190 "DISPLAY", // 191 @@ -383,18 +383,18 @@ static const char* const myLanguage[16][196] = { "FM instellingen", // 181 "AM instellingen", // 182 "Connectiviteit", // 183 - "DRUK OP MODE OM TERUG TE GAAN", // 184 - "AM CoChannelDet", // 185 - "CoChannelDet sensitivity", // 186 - "AM CoChannelDet threshold", // 187 - "CoChannelDet counet", // 188 - "MAIN", // 189 - "AUDIO", // 190 - "DISPLAY", // 191 + "MODE OM TERUG TE GAAN", // 184 + "AM CoChannel detectie", // 185 + "CoChannel det. gevoeligheid", // 186 + "CoChannel det. kantelpunt", // 187 + "CoChannel det. teller", // 188 + "ALGEMEEN", // 189 + "GELUID", // 190 + "SCHERM", // 191 "RDS", // 192 "FM", // 193 "AM", // 194 - "CONNECT" // 195 + "VERBIND" // 195 }, { "Polski", // Polish