From b5d7d053d2d4463552d919a8deb834cd74f9ee3e Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Mon, 30 Oct 2023 16:49:28 +0100 Subject: [PATCH] Added menu option for default MW stepsize, menu cleanup --- TEF6686_ESP32.ino | 25 ++++++----- src/constants.h | 13 +++--- src/gui.cpp | 109 ++++++++++++++++++++++++++++------------------ src/gui.h | 2 +- src/language.h | 52 +++++++++++----------- 5 files changed, 116 insertions(+), 85 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index d2361dd..1911555 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -74,6 +74,7 @@ bool memoryms[EE_PRESETS_CNT]; bool memorystore; bool menu; bool menuopen; +bool mwstepsize; bool nobattery; bool rdsflagreset; bool rdsreset; @@ -158,7 +159,6 @@ byte poweroptions; byte poweroptionsold; byte rdsblockold; byte region; -byte regionold; byte rotarymode; byte touchrotating; byte screensaverOptions[5] = {0, 3, 10, 30, 60}; @@ -441,11 +441,12 @@ void setup() { nowToggleSWMIBand = EEPROM.readByte(EE_BYTE_BANDAUTOSW); radio.rds.fastps = EEPROM.readByte(EE_BYTE_FASTPS); tot = EEPROM.readByte(EE_BYTE_TOT); + mwstepsize = EEPROM.readByte(EE_BYTE_MWREGION); LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN; LWHighEdgeSet = FREQ_LW_HIGH_EDGE_MAX; - MWLowEdgeSet = region == 0 ? FREQ_MW_LOW_EDGE_MIN_9K : FREQ_MW_LOW_EDGE_MIN_10K; - MWHighEdgeSet = region == 0 ? FREQ_MW_HIGH_EDGE_MAX_9K : FREQ_MW_HIGH_EDGE_MAX_10K; + MWLowEdgeSet = mwstepsize == false ? FREQ_MW_LOW_EDGE_MIN_9K : FREQ_MW_LOW_EDGE_MIN_10K; + MWHighEdgeSet = mwstepsize == false ? FREQ_MW_HIGH_EDGE_MAX_9K : FREQ_MW_HIGH_EDGE_MAX_10K; SWLowEdgeSet = FREQ_SW_LOW_EDGE_MIN; SWHighEdgeSet = FREQ_SW_HIGH_EDGE_MAX; if (LowEdgeOIRTSet < FREQ_FM_OIRT_START || LowEdgeOIRTSet > FREQ_FM_OIRT_END) LowEdgeOIRTSet = FREQ_FM_OIRT_START; @@ -1874,6 +1875,7 @@ void ModeButtonPress() { EEPROM.writeByte(EE_BYTE_FM_DEEMPHASIS, fmdeemphasis); EEPROM.writeByte(EE_BYTE_FASTPS, radio.rds.fastps); EEPROM.writeByte(EE_BYTE_TOT, tot); + EEPROM.writeByte(EE_BYTE_MWREGION, mwstepsize); EEPROM.commit(); Serial.end(); if (wifi) remoteip = IPAddress (WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient); @@ -1893,6 +1895,8 @@ void ModeButtonPress() { RDSSprite.loadFont(FONT16); SquelchSprite.loadFont(FONT16); } + MWLowEdgeSet = mwstepsize == false ? FREQ_MW_LOW_EDGE_MIN_9K : FREQ_MW_LOW_EDGE_MIN_10K; + MWHighEdgeSet = mwstepsize == false ? FREQ_MW_HIGH_EDGE_MAX_9K : FREQ_MW_HIGH_EDGE_MAX_10K; doBandSelectionFM(); doBandSelectionAM(); ScreensaverTimerSet(screensaverOptions[screensaverset]); @@ -1997,8 +2001,8 @@ void RoundStep() { radio.SetFreq(frequency_OIRT); } else { if (band == BAND_MW) { - unsigned int freq = frequency_AM / (region == REGION_EU ? FREQ_MW_STEP_9K : FREQ_MW_STEP_10K); - frequency_AM = freq * (region == REGION_EU ? FREQ_MW_STEP_9K : FREQ_MW_STEP_10K); + unsigned int freq = frequency_AM / (mwstepsize == false ? FREQ_MW_STEP_9K : FREQ_MW_STEP_10K); + frequency_AM = freq * (mwstepsize == false ? FREQ_MW_STEP_9K : FREQ_MW_STEP_10K); radio.SetFreqAM(frequency_AM); } else if (band == BAND_SW) { Round5K(frequency_AM); @@ -3067,10 +3071,10 @@ void TuneUp() { if (stepsize == 0) { if (band > BAND_GAP) { if (frequency_AM < MWHighEdgeSet && frequency_AM > MWLowEdgeSet) { - if (region == REGION_EU) { + if (!mwstepsize) { temp = FREQ_MW_STEP_9K; frequency_AM = (frequency_AM / FREQ_MW_STEP_9K) * FREQ_MW_STEP_9K; - } else if (region == REGION_US) { + } else if (mwstepsize) { temp = FREQ_MW_STEP_10K; frequency_AM = (frequency_AM / FREQ_MW_STEP_10K) * FREQ_MW_STEP_10K; } @@ -3149,10 +3153,10 @@ void TuneDown() { if (stepsize == 0) { if (band > BAND_GAP) { if (frequency_AM < MWHighEdgeSet && frequency_AM > MWLowEdgeSet) { - if (region == REGION_EU) { + if (!mwstepsize) { temp = FREQ_MW_STEP_9K; frequency_AM = (frequency_AM / FREQ_MW_STEP_9K) * FREQ_MW_STEP_9K; - } else if (region == REGION_US) { + } else if (mwstepsize) { temp = FREQ_MW_STEP_10K; frequency_AM = (frequency_AM / FREQ_MW_STEP_10K) * FREQ_MW_STEP_10K; } @@ -3412,7 +3416,8 @@ void DefaultSettings(byte userhardwaremodel) { EEPROM.writeByte(EE_BYTE_BWSET_AM, 2); EEPROM.writeByte(EE_BYTE_BANDAUTOSW, 0); EEPROM.writeByte(EE_BYTE_FASTPS, 1); - EEPROM.writeByte(EE_BYTE_TOT, 60); + EEPROM.writeByte(EE_BYTE_TOT, 0); + EEPROM.writeByte(EE_BYTE_MWREGION, 0); EEPROM.commit(); } diff --git a/src/constants.h b/src/constants.h index a352748..ede29b0 100644 --- a/src/constants.h +++ b/src/constants.h @@ -107,9 +107,9 @@ // EEPROM index defines #define EE_PRESETS_CNT 99 -#define EE_CHECKBYTE_VALUE 38 // 0 ~ 255,add new entry, change for new value +#define EE_CHECKBYTE_VALUE 39 // 0 ~ 255,add new entry, change for new value -#define EE_TOTAL_CNT 818 +#define EE_TOTAL_CNT 819 #define EE_UINT16_FREQUENCY_FM 0 #define EE_BYTE_VOLSET 4 #define EE_BYTE_STEREO 5 @@ -183,10 +183,11 @@ #define EE_STRING_XDRGTK_KEY 106 // 11 byte #define EE_BYTE_FASTPS 118 #define EE_BYTE_TOT 119 -#define EE_PRESETS_BAND_START 120 -#define EE_PRESET_BW_START 220 -#define EE_PRESET_MS_START 320 -#define EE_PRESETS_START 420 +#define EE_BYTE_MWREGION 120 +#define EE_PRESETS_BAND_START 121 +#define EE_PRESET_BW_START 221 +#define EE_PRESET_MS_START 321 +#define EE_PRESETS_START 421 #define EE_PRESETS_FREQUENCY 8750 // End of EEPROM index defines diff --git a/src/gui.cpp b/src/gui.cpp index 190c856..9ddaf71 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -7,7 +7,7 @@ #include byte menuitem; -byte items[8] = {8, 3, 6, 10, 9, 10, 8, 5}; +byte items[8] = {8, 3, 6, 10, 9, 10, 9, 5}; void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/ switch (CurrentTheme) { @@ -356,7 +356,7 @@ void BuildAFScreen() { for (byte i = 0; i < 20; i++) { std::memset(eonpicodeold[i], '\0', sizeof(eonpicodeold[i])); } - + if (radio.rds.hasDABAF && radio.rds.dabaffreq != 0) tftPrint(1, "DAB: " + String(radio.rds.dabafchannel) + " (" + String(radio.rds.dabafeid) + ")", 166, 32, SecondaryColor, SecondaryColorSmooth, 16); } @@ -550,7 +550,7 @@ void BuildMenu() { 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][169], 8, ITEM9 + 6, ActiveColor, ActiveColorSmooth, 16); if (softmuteam) tftPrint(1, myLanguage[language][42], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (amnb != 0) tftPrint(1, "%", 310, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16); @@ -558,6 +558,7 @@ void BuildMenu() { 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); + tftPrint(1, "kHz", 310, ITEM9 + 6, ActiveColor, ActiveColorSmooth, 16); switch (bandAM) { case AM_BAND_ALL: tftPrint(1, myLanguage[language][102] + String(",") + myLanguage[language][103] + String(",") + myLanguage[language][104], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; @@ -574,6 +575,7 @@ void BuildMenu() { 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 (mwstepsize) tftPrint(1, "10", 270, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, "9", 270, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; case CONNECTIVITY: @@ -905,14 +907,14 @@ void MenuUp() { break; case ITEM3: - if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, BackgroundColor, BackgroundColor, 28); - else tftPrint(0, String(spispeed * 10 , DEC) + " Mhz", 155, 118, BackgroundColor, BackgroundColor, 28); + if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); + else tftPrint(1, String(spispeed * 10 , DEC), 155, 118, BackgroundColor, BackgroundColor, 28); spispeed++; if (spispeed > SPI_SPEED_COUNT - 1) spispeed = 0; - if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - else tftPrint(0, String(spispeed * 10 , DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + else tftPrint(1, String(spispeed * 10 , DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (spispeed == SPI_SPEED_DEFAULT) SPI.setFrequency(SPI_FREQUENCY); else SPI.setFrequency(spispeed * 1000000); spispeedold = spispeed; @@ -950,7 +952,7 @@ void MenuUp() { if (StereoLevel > 60 || StereoLevel <= 30) { if (StereoLevel == 1) StereoLevel = 30; else StereoLevel = 0; } - if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, ActiveColor, ActiveColorSmooth, 28); if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); radio.setStereoLevel(StereoLevel); break; @@ -970,7 +972,7 @@ void MenuUp() { if (HighCutOffset > 60 || HighCutOffset <= 20) { if (HighCutOffset == 1) HighCutOffset = 20; else HighCutOffset = 0; } - if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, ActiveColor, ActiveColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); radio.setHighCutOffset(HighCutOffset); break; @@ -1021,7 +1023,7 @@ void MenuUp() { if (!screensaverset) tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, BackgroundColor, BackgroundColor, 28); screensaverset ++; if (screensaverset > sizeof(screensaverOptions) / sizeof(screensaverOptions[0]) - 1) screensaverset = 0; - if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, ActiveColor, ActiveColorSmooth, 28); if (!screensaverset) tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; @@ -1071,7 +1073,8 @@ void MenuUp() { break; case ITEM10: - if (tot != 0) tftPrint(0, String(tot) + " " + myLanguage[language][205], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); + if (tot != 0) tftPrint(-1, myLanguage[language][205], 170, 118, BackgroundColor, BackgroundColor, 28); + if (tot != 0) tftPrint(1, String(tot), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); switch (tot) { case 0: tot = 15; break; case 15: tot = 30; break; @@ -1079,7 +1082,8 @@ void MenuUp() { case 60: tot = 90; break; default: tot = 0; break; } - if (tot != 0) tftPrint(0, String(tot) + " " + myLanguage[language][205], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (tot != 0) tftPrint(-1, myLanguage[language][205], 170, 118, ActiveColor, ActiveColorSmooth, 28); + if (tot != 0) tftPrint(1, String(tot), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; } break; @@ -1110,7 +1114,6 @@ void MenuUp() { if (region == REGION_EU) region = REGION_US; else region = REGION_EU; if (region == REGION_EU) tftPrint(0, myLanguage[language][47], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (region == REGION_US) tftPrint(0, myLanguage[language][48], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - regionold = region; radio.rds.region = region; break; @@ -1230,7 +1233,7 @@ void MenuUp() { if (fmnb == 1) fmnb = 50; else fmnb = 0; } if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - if (fmnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (fmnb != 0) tftPrint(-1, "%", 170, 118, ActiveColor, ActiveColorSmooth, 28); radio.setFMNoiseBlanker(fmnb); break; @@ -1298,7 +1301,7 @@ void MenuUp() { if (amnb == 1) amnb = 50; else amnb = 0; } if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - if (amnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (amnb != 0) tftPrint(-1, "%", 170, 118, ActiveColor, ActiveColorSmooth, 28); radio.setAMNoiseBlanker(amnb); break; @@ -1342,12 +1345,14 @@ void MenuUp() { break; case ITEM6: - if (amcodect != 0) tftPrint(0, String(amcodect, DEC) + " %", 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); + if (amcodect != 0) tftPrint(-1, "%", 170, 118, BackgroundColor, BackgroundColor, 28); + if (amcodect != 0) tftPrint(1, String(amcodect, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); amcodect++; if (amcodect > 150 || amcodect <= 50) { if (amcodect == 1) amcodect = 50; else amcodect = 0; } - if (amcodect != 0) tftPrint(0, String(amcodect, DEC) + " %", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (amcodect != 0) tftPrint(-1, "%", 170, 118, ActiveColor, ActiveColorSmooth, 28); + if (amcodect != 0) tftPrint(1, String(amcodect, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (band > BAND_GAP) radio.setAMCoChannel(amcodect, amcodectcount); break; @@ -1365,10 +1370,15 @@ void MenuUp() { 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, PrimaryColor, PrimaryColorSmooth, 28); + if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, 28); if (band > BAND_GAP) radio.setAMAttenuation(amrfagc); break; + case ITEM9: + if (mwstepsize) tftPrint (1, "10", 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint (1, "9", 155, 118, BackgroundColor, BackgroundColor, 28); + if (mwstepsize) mwstepsize = false; else mwstepsize = true; + if (mwstepsize) tftPrint (1, "10", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint (1, "9", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; } break; @@ -1456,14 +1466,14 @@ void MenuDown() { if (touchrotating) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; case ITEM3: - if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, BackgroundColor, BackgroundColor, 28); - else tftPrint(0, String(spispeed * 10 , DEC) + " Mhz", 155, 118, BackgroundColor, BackgroundColor, 28); + if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); + else tftPrint(1, String(spispeed * 10 , DEC), 155, 118, BackgroundColor, BackgroundColor, 28); spispeed--; if (spispeed > SPI_SPEED_COUNT - 1) spispeed = SPI_SPEED_COUNT - 1; - if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - else tftPrint(0, String(spispeed * 10 , DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + else tftPrint(1, String(spispeed * 10 , DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (spispeed == SPI_SPEED_DEFAULT) SPI.setFrequency(SPI_FREQUENCY); else SPI.setFrequency(spispeed * 1000000); spispeedold = spispeed; @@ -1503,7 +1513,7 @@ void MenuDown() { if (StereoLevel < 30 || StereoLevel > 60) { if (StereoLevel > 60) StereoLevel = 60; else StereoLevel = 0; } - if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, ActiveColor, ActiveColorSmooth, 28); if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); radio.setStereoLevel(StereoLevel); break; @@ -1523,7 +1533,7 @@ void MenuDown() { if (HighCutOffset < 20 || HighCutOffset > 60) { if (HighCutOffset > 60) HighCutOffset = 60; else HighCutOffset = 0; } - if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, ActiveColor, ActiveColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); radio.setHighCutOffset(HighCutOffset); break; @@ -1574,7 +1584,7 @@ void MenuDown() { if (!screensaverset) tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, BackgroundColor, BackgroundColor, 28); screensaverset --; if (screensaverset > sizeof(screensaverOptions) / sizeof(screensaverOptions[0]) - 1) screensaverset = sizeof(screensaverOptions) / sizeof(screensaverOptions[0]) - 1; - if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, ActiveColor, ActiveColorSmooth, 28); if (!screensaverset) tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; @@ -1624,7 +1634,8 @@ void MenuDown() { break; case ITEM10: - if (tot != 0) tftPrint(0, String(tot) + " " + myLanguage[language][205], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); + if (tot != 0) tftPrint(-1, myLanguage[language][205], 170, 118, BackgroundColor, BackgroundColor, 28); + if (tot != 0) tftPrint(1, String(tot), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); switch (tot) { case 15: tot = 0; break; case 30: tot = 15; break; @@ -1632,7 +1643,8 @@ void MenuDown() { case 90: tot = 60; break; default: tot = 90; break; } - if (tot != 0) tftPrint(0, String(tot) + " " + myLanguage[language][205], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (tot != 0) tftPrint(-1, myLanguage[language][205], 170, 118, ActiveColor, ActiveColorSmooth, 28); + if (tot != 0) tftPrint(1, String(tot), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; } break; @@ -1663,7 +1675,6 @@ void MenuDown() { if (region == REGION_EU) region = REGION_US; else region = REGION_EU; if (region == REGION_EU) tftPrint(0, myLanguage[language][47], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (region == REGION_US) tftPrint(0, myLanguage[language][48], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - regionold = region; radio.rds.region = region; break; @@ -1782,7 +1793,7 @@ void MenuDown() { if (fmnb > 150) fmnb = 150; else fmnb = 0; } if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - if (fmnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (fmnb != 0) tftPrint(-1, "%", 170, 118, ActiveColor, ActiveColorSmooth, 28); radio.setFMNoiseBlanker(fmnb); break; @@ -1849,7 +1860,7 @@ void MenuDown() { if (amnb > 150) amnb = 150; else amnb = 0; } if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - if (amnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (amnb != 0) tftPrint(-1, "%", 170, 118, ActiveColor, ActiveColorSmooth, 28); radio.setAMNoiseBlanker(amnb); break; @@ -1893,12 +1904,14 @@ void MenuDown() { break; case ITEM6: - if (amcodect != 0) tftPrint(0, String(amcodect, DEC) + " %", 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); + if (amcodect != 0) tftPrint(-1, "%", 170, 118, BackgroundColor, BackgroundColor, 28); + if (amcodect != 0) tftPrint(1, String(amcodect, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); amcodect--; if (amcodect < 50 || amcodect > 150) { if (amcodect > 150) amcodect = 150; else amcodect = 0; } - if (amcodect != 0) tftPrint(0, String(amcodect, DEC) + " %", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (amcodect != 0) tftPrint(-1, "%", 170, 118, ActiveColor, ActiveColorSmooth, 28); + if (amcodect != 0) tftPrint(1, String(amcodect, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (band > BAND_GAP) radio.setAMCoChannel(amcodect, amcodectcount); break; @@ -1916,10 +1929,15 @@ void MenuDown() { 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, PrimaryColor, PrimaryColorSmooth, 28); + if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, 28); if (band > BAND_GAP) radio.setAMAttenuation(amrfagc); break; + case ITEM9: + if (mwstepsize) tftPrint (1, "10", 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint (1, "9", 155, 118, BackgroundColor, BackgroundColor, 28); + if (mwstepsize) mwstepsize = false; else mwstepsize = true; + if (mwstepsize) tftPrint (1, "10", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint (1, "9", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; } break; @@ -2061,14 +2079,14 @@ void DoMenu() { break; case ITEM2: - Infoboxprint(myLanguage[language][107]); + Infoboxprint(myLanguage[language][68]); if (touchrotating) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; case ITEM3: Infoboxprint(myLanguage[language][206]); - if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - else tftPrint(0, String(spispeed * 10 , DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + tftPrint(-1, "MHz", 170, 118, ActiveColor, ActiveColorSmooth, 28); + if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, String(spispeed * 10 , DEC) + " MHz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; } break; @@ -2141,7 +2159,7 @@ void DoMenu() { case ITEM6: Infoboxprint(myLanguage[language][91]); - if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, ActiveColor, ActiveColorSmooth, 28); if (!screensaverset) tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, String(screensaverOptions[screensaverset], DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; @@ -2173,7 +2191,8 @@ void DoMenu() { case ITEM10: Infoboxprint(myLanguage[language][75]); - if (tot != 0) tftPrint(0, String(tot) + " " + myLanguage[language][205], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (tot != 0) tftPrint(-1, myLanguage[language][205], 170, 118, ActiveColor, ActiveColorSmooth, 28); + if (tot != 0) tftPrint(1, String(tot), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; } break; @@ -2279,7 +2298,7 @@ void DoMenu() { case ITEM7: Infoboxprint(myLanguage[language][65]); - if (fmnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (fmnb != 0) tftPrint(-1, "%", 170, 118, ActiveColor, ActiveColorSmooth, 28); if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; @@ -2320,7 +2339,7 @@ void DoMenu() { case ITEM2: Infoboxprint(myLanguage[language][64]); - if (amnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (amnb != 0) tftPrint(-1, "%", 170, 118, ActiveColor, ActiveColorSmooth, 28); if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; @@ -2350,7 +2369,8 @@ void DoMenu() { case ITEM6: Infoboxprint(myLanguage[language][186]); - if (amcodect != 0) tftPrint(0, String(amcodect, DEC) + " %", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (amcodect != 0) tftPrint(-1, "%", 170, 118, ActiveColor, ActiveColorSmooth, 28); + if (amcodect != 0) tftPrint(1, String(amcodect, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; case ITEM7: @@ -2360,10 +2380,15 @@ void DoMenu() { case ITEM8: Infoboxprint(myLanguage[language][198]); - if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, PrimaryColor, PrimaryColorSmooth, 28); + 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); break; + case ITEM9: + Infoboxprint(myLanguage[language][169]); + tftPrint(-1, "kHz", 170, 118, ActiveColor, ActiveColorSmooth, 28); + if (mwstepsize) tftPrint (1, "10", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint (1, "9", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; } break; diff --git a/src/gui.h b/src/gui.h index 87f1185..25b352d 100644 --- a/src/gui.h +++ b/src/gui.h @@ -43,6 +43,7 @@ extern bool hasrtplusold; extern bool hastmcold; extern bool LowLevelInit; extern bool menuopen; +extern bool mwstepsize; extern bool rdsreset; extern bool RDSstatus; extern bool RDSstatusold; @@ -89,7 +90,6 @@ extern byte poweroptions; extern byte poweroptionsold; extern byte rdsblockold; extern byte region; -extern byte regionold; extern byte screensaverOptions[5]; extern byte screensaverset; extern byte showmodulation; diff --git a/src/language.h b/src/language.h index d6d1d6e..ac5d29e 100644 --- a/src/language.h +++ b/src/language.h @@ -69,7 +69,7 @@ static const char* const myLanguage[18][207] = { "FM Noise blanker", // 65 "Defaults loaded", // 66 "Audio output", // 67 - "Allow tuning during screensaver", // 68 + "Allow tuning\nduring screensaver", // 68 "Invert display", // 69 "About software", // 70 "Main code:", // 71 @@ -170,7 +170,7 @@ static const char* const myLanguage[18][207] = { "Identifier", // 166 "Purchase", // 167 "Get data", // 168 - " ", // 169 + "MW default stepsize", // 169 "Tangerine", // 170 "Ocean", // 171 "Indigo", // 172 @@ -186,10 +186,10 @@ static const char* const myLanguage[18][207] = { "AM settings", // 182 "Connectivity", // 183 "PRESS MODE TO RETURN", // 184 - "AM CoChannelDet", // 185 - "CoChannel Det sensitivity", // 186 - "CoChannel Det threshold", // 187 - "CoChannel Det counter", // 188 + "CoChannel Detector", // 185 + "CoChannel Detector\nsensitivity", // 186 + "CoChannel Detector\nthreshold", // 187 + "CoChannel Detector\ncounter", // 188 "MAIN", // 189 "AUDIO", // 190 "DISPLAY", // 191 @@ -199,7 +199,7 @@ static const char* const myLanguage[18][207] = { "CONNECT", // 195 "Auto sort AF", // 196 "Stationlist ID", // 197 - "AM ATT", // 198 + "AM AGC", // 198 "FM deemphasis", // 199 "Small", // 200 "Large", // 201 @@ -379,7 +379,7 @@ static const char* const myLanguage[18][207] = { "Identificatie", // 166 "Aankoop", // 167 "Verkrijg data", // 168 - " ", // 169 + "MW Stapgrootte", // 169 "Tangerine", // 170 "Ocean", // 171 "Indigo", // 172 @@ -588,7 +588,7 @@ static const char* const myLanguage[18][207] = { "Identyfikator", // 166 "Zakup", // 167 "Pobierz dane", // 168 - " ", // 169 + "MW default stepsize", // 169 "Tangerine", // 170 "Ocean", // 171 "Indigo", // 172 @@ -696,7 +696,7 @@ static const char* const myLanguage[18][207] = { "FM prigušivač šuma", // 65 "Zadane postavke učitane", // 66 "Audio izlaz", // 67 - "Allow tuning during screensaver", // 68 + "Allow tuning\nduring screensaver", // 68 "Invertiraj boju zaslona", // 69 "O softveru", // 70 "Glavni izvorni kod:", // 71 @@ -797,7 +797,7 @@ static const char* const myLanguage[18][207] = { "Identifikator", // 166 "Kupnja", // 167 "Get data", // 168 - " ", // 169 + "MW default stepsize", // 169 "Tangerine", // 170 "Ocean", // 171 "Indigo", // 172 @@ -1006,7 +1006,7 @@ static const char* const myLanguage[18][207] = { "Αναγνωριστικό", // 166 "Αγορά", // 167 "Λήψη δεδομένων", // 168 - " ", // 169 + "MW default stepsize", // 169 "Μανταρινί", // 170 "Ωκεανός", // 171 "Ινδικό", // 172 @@ -1215,7 +1215,7 @@ static const char* const myLanguage[18][207] = { "Identifier", // 166 "Purchase", // 167 "Get data", // 168 - " ", // 169 + "MW default stepsize", // 169 "Tangerine", // 170 "Ocean", // 171 "Indigo", // 172 @@ -1424,7 +1424,7 @@ static const char* const myLanguage[18][207] = { "Musik-ID", // 166 "Bezugsquelle", // 167 "Empfange Daten", // 168 - " ", // 169 + "MW default stepsize", // 169 "Tangerine", // 170 "Ocean", // 171 "Indigo", // 172 @@ -1633,7 +1633,7 @@ static const char* const myLanguage[18][207] = { "Identifier", // 166 "Purchase", // 167 "Get data", // 168 - " ", // 169 + "MW default stepsize", // 169 "Tangerine", // 170 "Ocean", // 171 "Indigo", // 172 @@ -1842,7 +1842,7 @@ static const char* const myLanguage[18][207] = { "Identifier", // 166 "Purchase", // 167 "Get data", // 168 - " ", // 169 + "MW default stepsize", // 169 "Tangerine", // 170 "Ocean", // 171 "Indigo", // 172 @@ -2051,7 +2051,7 @@ static const char* const myLanguage[18][207] = { "Identifiant", // 166 "Achat", // 167 "Obtenir des données", // 168 - " ", // 169 + "MW default stepsize", // 169 "Mandarine", // 170 "Océan", // 171 "Indigo", // 172 @@ -2260,7 +2260,7 @@ static const char* const myLanguage[18][207] = { "Identifier", // 166 "Purchase", // 167 "Get data", // 168 - " ", // 169 + "MW default stepsize", // 169 "Tangerine", // 170 "Ocean", // 171 "Indigo", // 172 @@ -2469,7 +2469,7 @@ static const char* const myLanguage[18][207] = { "Идентификатор", // 166 "Покупка", // 167 "Получить данные", // 168 - " ", // 169 + "MW default stepsize", // 169 "Мандариновый", // 170 "Океан", // 171 "Индиго", // 172 @@ -2678,7 +2678,7 @@ static const char* const myLanguage[18][207] = { "Ідентифікатор", // 166 "Покупка", // 167 "Отримати дані", // 168 - " ", // 169 + "MW default stepsize", // 169 "Мандариновий", // 170 "Океан", // 171 "Індиго", // 172 @@ -2887,7 +2887,7 @@ static const char* const myLanguage[18][207] = { "Identifier", // 166 "Purchase", // 167 "Get data", // 168 - " ", // 169 + "MW default stepsize", // 169 "Tangerine", // 170 "Ocean", // 171 "Indigo", // 172 @@ -3096,7 +3096,7 @@ static const char* const myLanguage[18][207] = { "Identifier", // 166 "Purchase", // 167 "Get data", // 168 - " ", // 169 + "MW default stepsize", // 169 "桔红", // 170 "海之蓝", // 171 "靛青", // 172 @@ -3305,7 +3305,7 @@ static const char* const myLanguage[18][207] = { "Identifikator", // 166 "Kjøp", // 167 "Få data", // 168 - " ", // 169 + "MW default stepsize", // 169 "Tangerine", // 170 "Ocean", // 171 "Indigo", // 172 @@ -3514,7 +3514,7 @@ static const char* const myLanguage[18][207] = { "Identificador", // 166 "Compra", // 167 "Obtener datos", // 168 - " ", // 169 + "MW default stepsize", // 169 "Mandarina", // 170 "Océano", // 171 "Índigo", // 172 @@ -3723,7 +3723,7 @@ static const char* const myLanguage[18][207] = { "Identificador", // 166 "Compra", // 167 "Obter dados", // 168 - " ", // 169 + "MW default stepsize", // 169 "Tangerina", // 170 "Oceano", // 171 "Índigo", // 172 @@ -3761,5 +3761,5 @@ static const char* const myLanguage[18][207] = { "Aplicativos detectados", // 204 "Min.", // 205 "Velocidade dinâmica\nde SPI" // 206 -} + } };