From 1fb7d5a893d31a7c924bf0cc571ac62c4c2d9117 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Mon, 19 Feb 2024 20:55:07 +0100 Subject: [PATCH] Added AGC setting Note: Flash data will be reset! --- TEF6686_ESP32.ino | 24 ++++++--- src/TEF6686.cpp | 9 ++-- src/TEF6686.h | 1 + src/Tuner_Drv_Lithio.cpp | 4 ++ src/Tuner_Drv_Lithio.h | 1 + src/comms.cpp | 7 ++- src/constants.h | 16 +++--- src/gui.cpp | 102 +++++++++++++++++++++++++++++---------- src/gui.h | 4 +- src/language.h | 74 ++++++++++++++-------------- 10 files changed, 160 insertions(+), 82 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 43e70f2..40bc046 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -116,6 +116,7 @@ byte af_counterold; byte aid_counterold; byte af; byte afpagenr; +byte amagc; byte amnb; byte amscansens; byte audiomode; @@ -144,6 +145,7 @@ byte displayflip; byte ECCold; byte eonptyold[20]; byte EQset; +byte fmagc; byte fmscansens; byte fmdefaultstepsize; byte fmnb; @@ -151,7 +153,7 @@ byte fmdeemphasis; byte freqfont; byte amcodect; byte amcodectcount; -byte amrfagc; +byte amgain; byte freqoldcount; byte HighCutLevel; byte HighCutOffset; @@ -450,7 +452,7 @@ void setup() { batteryoptions = EEPROM.readByte(EE_BYTE_BATTERY_OPTIONS); amcodect = EEPROM.readByte(EE_BYTE_AM_CO_DECT); amcodectcount = EEPROM.readByte(EE_BYTE_AM_CO_DECT_COUNT); - amrfagc = EEPROM.readByte(EE_BYTE_AM_RF_AGC); + amgain = EEPROM.readByte(EE_BYTE_AM_RF_GAIN); radio.rds.sortaf = EEPROM.readByte(EE_BYTE_SORTAF); stationlistid = EEPROM.readByte(EE_BYTE_STATIONLISTID); fmdeemphasis = EEPROM.readByte(EE_BYTE_FM_DEEMPHASIS); @@ -466,6 +468,8 @@ void setup() { freqfont = EEPROM.readByte(EE_BYTE_FREQFONT); CurrentSkin = EEPROM.readByte(EE_BYTE_SKIN); XDRGTKMuteScreen = EEPROM.readByte(EE_BYTE_XDRGTKMUTE); + fmagc = EEPROM.readByte(EE_BYTE_FMAGC); + amagc = EEPROM.readByte(EE_BYTE_AMAGC); if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000); else tft.setSPISpeed(spispeed * 10); LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN; @@ -709,7 +713,7 @@ void setup() { if (band > BAND_GAP) { radio.setAMCoChannel(amcodect, amcodectcount); - radio.setAMAttenuation(amrfagc); + radio.setAMAttenuation(amgain); } radio.setStereoLevel(StereoLevel); @@ -725,6 +729,8 @@ void setup() { radio.setAudio(audiomode); radio.setDeemphasis(fmdeemphasis); radio.rds.region = region; + radio.setAGC(fmagc); + radio.setAMAGC(amagc); LowLevelInit = true; if (ConverterSet >= 200) { @@ -1744,7 +1750,7 @@ void SelectBand() { LimitAMFrequency(); if (!externaltune) CheckBandForbiddenAM(); radio.SetFreqAM(frequency_AM); - radio.setAMAttenuation(amrfagc); + radio.setAMAttenuation(amgain); radio.setAMCoChannel(amcodect, amcodectcount); doBW(); if (!screenmute) { @@ -1948,7 +1954,7 @@ void ModeButtonPress() { EEPROM.writeByte(EE_BYTE_BATTERY_OPTIONS, batteryoptions); EEPROM.writeByte(EE_BYTE_AM_CO_DECT, amcodect); EEPROM.writeByte(EE_BYTE_AM_CO_DECT_COUNT, amcodectcount); - EEPROM.writeByte(EE_BYTE_AM_RF_AGC, amrfagc); + EEPROM.writeByte(EE_BYTE_AM_RF_GAIN, amgain); EEPROM.writeByte(EE_BYTE_SORTAF, radio.rds.sortaf); EEPROM.writeByte(EE_BYTE_STATIONLISTID, stationlistid); EEPROM.writeByte(EE_BYTE_FM_DEEMPHASIS, fmdeemphasis); @@ -1961,6 +1967,8 @@ void ModeButtonPress() { EEPROM.writeByte(EE_BYTE_FREQFONT, freqfont); EEPROM.writeByte(EE_BYTE_SKIN, CurrentSkin); EEPROM.writeByte(EE_BYTE_XDRGTKMUTE, XDRGTKMuteScreen); + EEPROM.writeByte(EE_BYTE_FMAGC, fmagc); + EEPROM.writeByte(EE_BYTE_AMAGC, amagc); EEPROM.commit(); if (af == 2) radio.rds.afreg = true; else radio.rds.afreg = false; if (!usesquelch) radio.setUnMute(); @@ -2620,7 +2628,7 @@ void ShowSignalLevel() { if (SStatusold / 10 != SStatusprint / 10) tftReplace(1, String(SStatusold / 10), String(SStatusprint / 10), 288, 105, FreqColor, FreqColorSmooth, 48); tftReplace(1, "." + String(abs(SStatusold % 10)), "." + String(abs(SStatusprint % 10)), 310, 105, FreqColor, FreqColorSmooth, 28); - if (band < BAND_GAP) segments = map(SStatus/10, 5, 70, 0, 100); else segments = (SStatus + 200) / 10; + if (band < BAND_GAP) segments = map(SStatus / 10, 5, 70, 0, 100); else segments = (SStatus + 200) / 10; tft.fillRect(16, 105, 2 * constrain(segments, 0, 54), 6, BarInsignificantColor); tft.fillRect(16 + 2 * 54, 105, 2 * (constrain(segments, 54, 94) - 54), 6, BarSignificantColor); tft.fillRect(16 + 2 * constrain(segments, 0, 94), 105, 2 * (94 - constrain(segments, 0, 94)), 6, GreyoutColor); @@ -3599,7 +3607,7 @@ void DefaultSettings(byte userhardwaremodel) { EEPROM.writeByte(EE_BYTE_BATTERY_OPTIONS, BATTERY_VALUE); EEPROM.writeByte(EE_BYTE_AM_CO_DECT, 100); EEPROM.writeByte(EE_BYTE_AM_CO_DECT_COUNT, 3); - EEPROM.writeByte(EE_BYTE_AM_RF_AGC, 0); + EEPROM.writeByte(EE_BYTE_AM_RF_GAIN, 0); EEPROM.writeByte(EE_BYTE_SORTAF, 1); EEPROM.writeByte(EE_BYTE_STATIONLISTID, 1); EEPROM.writeByte(EE_BYTE_FM_DEEMPHASIS, DEEMPHASIS_50); @@ -3615,6 +3623,8 @@ void DefaultSettings(byte userhardwaremodel) { EEPROM.writeByte(EE_BYTE_FREQFONT, 3); EEPROM.writeByte(EE_BYTE_SKIN, 0); EEPROM.writeByte(EE_BYTE_XDRGTKMUTE, 0); + EEPROM.writeByte(EE_BYTE_FMAGC, 92); + EEPROM.writeByte(EE_BYTE_AMAGC, 100); EEPROM.commit(); } diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index 5ba0983..c405a77 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -254,10 +254,11 @@ void TEF6686::setUnMute() { } void TEF6686::setAGC(uint8_t agc) { - if (agc == 0) devTEF_Radio_Set_RFAGC(920); - if (agc == 1) devTEF_Radio_Set_RFAGC(900); - if (agc == 2) devTEF_Radio_Set_RFAGC(870); - if (agc == 3) devTEF_Radio_Set_RFAGC(840); + devTEF_Radio_Set_RFAGC(agc); +} + +void TEF6686::setAMAGC(uint8_t agc) { + devTEF_Radio_Set_AMRFAGC(agc); } void TEF6686::setDeemphasis(uint8_t timeconstant) { diff --git a/src/TEF6686.h b/src/TEF6686.h index 51cca4d..853ecc6 100644 --- a/src/TEF6686.h +++ b/src/TEF6686.h @@ -674,6 +674,7 @@ class TEF6686 { void clearRDS(bool fullsearchrds); void power(bool mode); void setAGC(uint8_t agc); + void setAMAGC(uint8_t agc); void setiMS(bool mph); void setEQ(bool eq); void setDeemphasis(uint8_t timeconstant); diff --git a/src/Tuner_Drv_Lithio.cpp b/src/Tuner_Drv_Lithio.cpp index eecb4ff..943527a 100644 --- a/src/Tuner_Drv_Lithio.cpp +++ b/src/Tuner_Drv_Lithio.cpp @@ -140,6 +140,10 @@ void devTEF_Radio_Set_RFAGC(uint16_t agc) { devTEF_Set_Cmd(TEF_FM, Cmd_Set_RFAGC, 7, agc, 0); } +void devTEF_Radio_Set_AMRFAGC(uint16_t agc) { + devTEF_Set_Cmd(TEF_AM, Cmd_Set_RFAGC, 7, agc, 0); +} + void devTEF_Radio_Set_Deemphasis(uint16_t timeconstant) { devTEF_Set_Cmd(TEF_FM, Cmd_Set_Deemphasis, 5, timeconstant); } diff --git a/src/Tuner_Drv_Lithio.h b/src/Tuner_Drv_Lithio.h index f65192e..5e6f24a 100644 --- a/src/Tuner_Drv_Lithio.h +++ b/src/Tuner_Drv_Lithio.h @@ -84,6 +84,7 @@ void devTEF_Radio_Set_Stereo_Min(bool mode); void devTEF_Radio_Set_MphSuppression(bool mph); void devTEF_Radio_Set_ChannelEqualizer(bool eq); void devTEF_Radio_Set_RFAGC(uint16_t agc); +void devTEF_Radio_Set_AMRFAGC(uint16_t agc); void devTEF_Radio_Set_Deemphasis(uint16_t timeconstant); void devTEF_Radio_Specials(uint16_t audio); void devTEF_APPL_Set_StereoImprovement(bool mode); diff --git a/src/comms.cpp b/src/comms.cpp index c245a56..d4582ef 100644 --- a/src/comms.cpp +++ b/src/comms.cpp @@ -223,7 +223,12 @@ void XDRGTKRoutine() { int AGC; AGC = atol(buff + 1); DataPrint("A" + String(AGC) + "\n"); - radio.setAGC(AGC); + switch (AGC) { + case 0: if (band == BAND_FM || BAND_OIRT) radio.setAGC(92); else radio.setAMAGC(102); break; + case 1: if (band == BAND_FM || BAND_OIRT) radio.setAGC(90); else radio.setAMAGC(99); break; + case 2: if (band == BAND_FM || BAND_OIRT) radio.setAGC(87); else radio.setAMAGC(96); break; + case 3: if (band == BAND_FM || BAND_OIRT) radio.setAGC(84); else radio.setAMAGC(94); break; + } break; case 'C': diff --git a/src/constants.h b/src/constants.h index 001f937..79f7b07 100644 --- a/src/constants.h +++ b/src/constants.h @@ -196,9 +196,9 @@ // EEPROM index defines #define EE_PRESETS_CNT 99 -#define EE_CHECKBYTE_VALUE 3 // 0 ~ 255,add new entry, change for new value +#define EE_CHECKBYTE_VALUE 4 // 0 ~ 255,add new entry, change for new value -#define EE_TOTAL_CNT 824 +#define EE_TOTAL_CNT 826 #define EE_UINT16_FREQUENCY_FM 0 #define EE_BYTE_VOLSET 4 #define EE_BYTE_STEREO 5 @@ -260,7 +260,7 @@ #define EE_BYTE_BATTERY_OPTIONS 73 #define EE_BYTE_AM_CO_DECT 74 #define EE_BYTE_AM_CO_DECT_COUNT 75 -#define EE_BYTE_AM_RF_AGC 76 +#define EE_BYTE_AM_RF_GAIN 76 #define EE_BYTE_FM_DEEMPHASIS 77 #define EE_UINT16_FREQUENCY_LW 78 #define EE_UINT16_FREQUENCY_MW 82 @@ -279,10 +279,12 @@ #define EE_BYTE_FREQFONT 124 #define EE_BYTE_SKIN 125 #define EE_BYTE_XDRGTKMUTE 126 -#define EE_PRESETS_BAND_START 127 -#define EE_PRESET_BW_START 227 -#define EE_PRESET_MS_START 327 -#define EE_PRESETS_START 427 +#define EE_BYTE_FMAGC 127 +#define EE_BYTE_AMAGC 128 +#define EE_PRESETS_BAND_START 129 +#define EE_PRESET_BW_START 229 +#define EE_PRESET_MS_START 329 +#define EE_PRESETS_START 429 #define EE_PRESETS_FREQUENCY 0 // End of EEPROM index defines diff --git a/src/gui.cpp b/src/gui.cpp index 6e3e6ae..c735835 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -8,7 +8,7 @@ byte menuitem; -byte items[8] = {8, static_cast(dynamicspi ? 5 : 4), 7, 10, 9, 10, 10, 6}; +byte items[8] = {8, static_cast(dynamicspi ? 7 : 6), 7, 10, 9, 10, 10, 6}; void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/ switch (CurrentTheme) { @@ -509,6 +509,9 @@ void BuildMenu() { tftPrint(-1, myLanguage[language][107], 8, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][75], 8, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][62], 8, ITEM4 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][37], 8, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][198], 8, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16); + switch (hardwaremodel) { case BASE_ILI9341: tftPrint(1, myLanguage[language][109], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; @@ -520,12 +523,16 @@ void BuildMenu() { if (tot != 0) tftPrint(1, String(tot), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (tot != 0) tftPrint(1, myLanguage[language][80], 310, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (usesquelch) tftPrint(1, myLanguage[language][42], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(1, "dB", 310, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(1, "dB", 310, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(1, String(fmagc, DEC), 270, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(1, String(amagc, DEC), 270, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (dynamicspi) { - tftPrint(1, "MHz", 310, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][81], 8, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); - if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][204]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 270, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); - else tftPrint(1, String(spispeed * 10, DEC), 270, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(1, "MHz", 310, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][81], 8, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16); + if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][204]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 270, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16); + else tftPrint(1, String(spispeed * 10, DEC), 270, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16); } break; @@ -676,7 +683,7 @@ void BuildMenu() { tftPrint(-1, myLanguage[language][59], 8, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][185], 8, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][187], 8, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][198], 8, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][36], 8, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][169], 8, ITEM9 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][82], 8, ITEM10 + 6, ActiveColor, ActiveColorSmooth, 16); @@ -685,7 +692,7 @@ void BuildMenu() { if (amnb != 0) tftPrint(1, String(amnb, DEC), 270, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(1, "dB", 310, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16); if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, String(AMLevelOffset, DEC), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); - if (amrfagc != 0) tftPrint(1, "dB", 310, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); + if (amgain != 0) tftPrint(1, "dB", 310, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(1, "kHz", 310, ITEM9 + 6, ActiveColor, ActiveColorSmooth, 16); switch (bandAM) { @@ -703,7 +710,7 @@ void BuildMenu() { if (amcodect != 0) tftPrint(1, "%", 310, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16); if (amcodect != 0) tftPrint(1, String(amcodect, DEC), 270, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(1, String(amcodectcount, DEC), 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16); - if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 270, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); + if (amgain != 0) tftPrint(1, String(amgain, DEC), 270, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (mwstepsize) tftPrint(1, "10", 270, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, "9", 270, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(1, String(amscansens), 310, ITEM10 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; @@ -1066,6 +1073,22 @@ void MenuUp() { break; case ITEM5: + tftPrint(1, String(fmagc), 155, 118, BackgroundColor, BackgroundColor, 28); + fmagc++; + if (fmagc > 92) fmagc = 84; + tftPrint(1, String(fmagc), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + radio.setAGC(fmagc); + break; + + case ITEM6: + tftPrint(1, String(amagc), 155, 118, BackgroundColor, BackgroundColor, 28); + amagc++; + if (amagc > 102) amagc = 94; + tftPrint(1, String(amagc), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + radio.setAMAGC(amagc); + break; + + case ITEM7: if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][204]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, String(spispeed * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); @@ -1528,13 +1551,13 @@ void MenuUp() { break; case ITEM8: - if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); - if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, BackgroundColor, BackgroundColor, 28); - amrfagc += 6; - if (amrfagc > 36) amrfagc = 0; - if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, 28); - if (band > BAND_GAP) radio.setAMAttenuation(amrfagc); + if (amgain != 0) tftPrint(1, String(amgain, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); + if (amgain != 0) tftPrint(-1, "dB", 170, 118, BackgroundColor, BackgroundColor, 28); + amgain += 6; + if (amgain > 36) amgain = 0; + if (amgain != 0) tftPrint(1, String(amgain, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (amgain != 0) tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, 28); + if (band > BAND_GAP) radio.setAMAttenuation(amgain); break; case ITEM9: @@ -1663,6 +1686,22 @@ void MenuDown() { break; case ITEM5: + tftPrint(1, String(fmagc), 155, 118, BackgroundColor, BackgroundColor, 28); + fmagc--; + if (fmagc < 84) fmagc = 92; + tftPrint(1, String(fmagc), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + radio.setAGC(fmagc); + break; + + case ITEM6: + tftPrint(1, String(amagc), 155, 118, BackgroundColor, BackgroundColor, 28); + amagc--; + if (amagc < 94) amagc = 102; + tftPrint(1, String(amagc), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + radio.setAMAGC(amagc); + break; + + case ITEM7: if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][204]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, String(spispeed * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); @@ -2125,13 +2164,13 @@ void MenuDown() { break; case ITEM8: - if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); - if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, BackgroundColor, BackgroundColor, 28); - amrfagc -= 6; - if (amrfagc > 36) amrfagc = 36; - if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, 28); - if (band > BAND_GAP) radio.setAMAttenuation(amrfagc); + if (amgain != 0) tftPrint(1, String(amgain, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); + if (amgain != 0) tftPrint(-1, "dB", 170, 118, BackgroundColor, BackgroundColor, 28); + amgain -= 6; + if (amgain > 36) amgain = 36; + if (amgain != 0) tftPrint(1, String(amgain, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (amgain != 0) tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, 28); + if (band > BAND_GAP) radio.setAMAttenuation(amgain); break; case ITEM9: @@ -2312,6 +2351,19 @@ void DoMenu() { break; case ITEM5: + Infoboxprint(myLanguage[language][37]); + tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, 28); + tftPrint(1, String(fmagc), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; + + case ITEM6: + Infoboxprint(myLanguage[language][198]); + tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, 28); + tftPrint(1, String(amagc), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; + + + case ITEM7: Infoboxprint(myLanguage[language][81]); tftPrint(-1, "MHz", 170, 118, ActiveColor, ActiveColorSmooth, 28); if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][204]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, String(spispeed * 10 , DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); @@ -2612,9 +2664,9 @@ void DoMenu() { break; case ITEM8: - Infoboxprint(myLanguage[language][198]); - if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, 28); - if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + Infoboxprint(myLanguage[language][36]); + if (amgain != 0) tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, 28); + if (amgain != 0) tftPrint(1, String(amgain, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; case ITEM9: diff --git a/src/gui.h b/src/gui.h index 2674108..c84ec35 100644 --- a/src/gui.h +++ b/src/gui.h @@ -63,6 +63,7 @@ extern bool wifi; extern byte af; extern byte af_counterold; extern byte afpagenr; +extern byte amagc; extern byte amnb; extern byte amscansens; extern byte audiomode; @@ -77,6 +78,7 @@ extern byte ContrastSet; extern byte CurrentSkin; extern byte CurrentTheme; extern byte ECCold; +extern byte fmagc; extern byte fmscansens; extern byte fmdefaultstepsize; extern byte fmnb; @@ -84,7 +86,7 @@ extern byte fmdeemphasis; extern byte freqfont; extern byte amcodect; extern byte amcodectcount; -extern byte amrfagc; +extern byte amgain; extern byte hardwaremodel; extern byte hardwaremodelold; extern byte HighCutLevel; diff --git a/src/language.h b/src/language.h index 7293b4a..7486093 100644 --- a/src/language.h +++ b/src/language.h @@ -42,8 +42,8 @@ static const char* const myLanguage[18][206] = { "OFF", // 33 "SCANNING...", // 34 "Tuner not detected", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Show RDS errors", // 38 "Language", // 39 "Choose language", // 40 @@ -250,8 +250,8 @@ static const char* const myLanguage[18][206] = { "UIT", // 33 "ZOEKEN...", // 34 "Tuner niet herkend!", // 35 - "", // 36 - "", // 37 + "AM antenne versterking", // 36 + "FM AGC", // 37 "Toon RDS fouten", // 38 "Taal", // 39 "Kies taal", // 40 @@ -458,8 +458,8 @@ static const char* const myLanguage[18][206] = { "WYŁ.", // 33 "SKANOWANIE...", // 34 "Nie wykryto tunera", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Pokaż błędy RDS", // 38 "Język", // 39 "Wybierz swój język", // 40 @@ -666,8 +666,8 @@ static const char* const myLanguage[18][206] = { "ISK.", // 33 "SKENIRANJE...", // 34 "Prijemnik nije pronađen", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Prikaži RDS pogreške", // 38 "Jezik", // 39 "Odaberite jezik", // 40 @@ -874,8 +874,8 @@ static const char* const myLanguage[18][206] = { "ΑΝΕΝ.", // 33 "ΑΝΙΧΝΕΥΣΗ...", // 34 "Το tuner δεν εντοπίστηκε", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Περιθώριο σφαλμάτων\nRDS", // 38 "Γλώσσα", // 39 "Επιλογή γλώσσας", // 40 @@ -1082,8 +1082,8 @@ static const char* const myLanguage[18][206] = { "Oprit", // 33 "SCANEZ...", // 34 "Tunerul nu este prezent", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Arata erorile RDS", // 38 "Limba", // 39 "Alegeti Limba", // 40 @@ -1244,7 +1244,7 @@ static const char* const myLanguage[18][206] = { "CONECTARE", // 195 "Sortare automata AF", // 196 "ID Lista posturi", // 197 - " AGC AM", // 198 + "AGC AM", // 198 "FM deemphasis", // 199 "Mic", // 200 "Mare", // 201 @@ -1290,8 +1290,8 @@ static const char* const myLanguage[18][206] = { "AUS", // 33 "SCANNE...", // 34 "Tuner nicht erkannt", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Zeige RDS Fehler", // 38 "Sprache", // 39 "Sprache wählen", // 40 @@ -1498,8 +1498,8 @@ static const char* const myLanguage[18][206] = { "VYP", // 33 "SKENUJI...", // 34 "Tuner nedetekován", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Zobrazit chyby v RDS", // 38 "Jazyk", // 39 "Vyberte jazyk", // 40 @@ -1706,8 +1706,8 @@ static const char* const myLanguage[18][206] = { "VYP", // 33 "SKENUJEM...", // 34 "Tuner nedetekovaný", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Zobraziť chyby v RDS", // 38 "Jazyk", // 39 "Vyberte jazyk", // 40 @@ -1914,8 +1914,8 @@ static const char* const myLanguage[18][206] = { "FERMÉ", // 33 "RECHERCHE...", // 34 "Tuner non détecté", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Montrer les erreurs\nde décodage RDS", // 38 "Langage", // 39 "Choix de la langue", // 40 @@ -2122,8 +2122,8 @@ static const char* const myLanguage[18][206] = { "ИЗКЛ.", // 33 "СКАНИРАНЕ", // 34 "Тунерът не е разпознат!", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Показване на RDS грешки", // 38 "Език", // 39 "Изберете език", // 40 @@ -2330,8 +2330,8 @@ static const char* const myLanguage[18][206] = { "ВЫКЛ.", // 33 "СКАНИРОВАНИЕ...", // 34 "Тюнер не обнаружен", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Уровень ошибок RDS", // 38 "Язык меню", // 39 "Язык меню: ", // 40 @@ -2538,8 +2538,8 @@ static const char* const myLanguage[18][206] = { "ВИМКН.", // 33 "СКАНУВАННЯ...", // 34 "Тюнер не виявлено", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Показувати помилки RDS", // 38 "Мова", // 39 "Виберіть мову", // 40 @@ -2746,8 +2746,8 @@ static const char* const myLanguage[18][206] = { "OFF", // 33 *** "SCANSIONE...", // 34 "Ricevitore non rilevato", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Mostra errori RDS", // 38 "Lingua", // 39 "Scegli la lingua", // 40 @@ -2954,8 +2954,8 @@ static const char* const myLanguage[18][206] = { "OFF", // 33 *** "搜索中...", // 34 "未检测到收音芯片", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "显示 RDS errors", // 38 "语言", // 39 "选择语言", // 40 @@ -3162,8 +3162,8 @@ static const char* const myLanguage[18][206] = { "AV", // 33 "SKANNER...", // 34 "Tuner ikke oppdaget", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Vis RDS-feil", // 38 "Språk", // 39 "Velg språk", // 40 @@ -3370,8 +3370,8 @@ static const char* const myLanguage[18][206] = { "APAGADO", // 33 "ESCANEANDO...", // 34 "Sintonizador no detectado", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Mostrar errores RDS", // 38 "Idioma", // 39 "Elegir idioma", // 40 @@ -3578,8 +3578,8 @@ static const char* const myLanguage[18][206] = { "DESATIVADO", // 33 "ANALISANDO...", // 34 "Sintonizador não detectado", // 35 - "", // 36 - "", // 37 + "AM Antenna gain", // 36 + "FM AGC", // 37 "Mostrar erros RDS", // 38 "Idioma", // 39 "Escolha o idioma", // 40