From e4e4bffe6e7e712a665ee8bf23c6acc6747718d2 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Sat, 30 Dec 2023 21:52:59 +0100 Subject: [PATCH] Added skin selector --- TEF6686_ESP32.ino | 5 +- src/constants.h | 22 ++--- src/gui.cpp | 221 +++++++++++++++++++++++++--------------------- src/gui.h | 24 ++--- src/language.h | 76 ++++++++-------- 5 files changed, 188 insertions(+), 160 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 9e91458..af73136 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -136,6 +136,7 @@ byte hardwaremodel = BASE_ILI9341; #endif byte hardwaremodelold; byte ContrastSet; +byte CurrentSkin; byte CurrentTheme; byte displayflip; byte ECCold; @@ -181,7 +182,6 @@ byte stepsize; byte StereoLevel; byte subnetclient; byte TEF; -byte theme; byte tot; byte tunemode; byte unit; @@ -457,6 +457,7 @@ void setup() { amscansens = EEPROM.readByte(EE_BYTE_AMSCANSENS); fmscansens = EEPROM.readByte(EE_BYTE_FMSCANSENS); freqfont = EEPROM.readByte(EE_BYTE_FREQFONT); + CurrentSkin = EEPROM.readByte(EE_BYTE_SKIN); if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000); else tft.setSPISpeed(spispeed * 10); LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN; @@ -1943,6 +1944,7 @@ void ModeButtonPress() { EEPROM.writeByte(EE_BYTE_AMSCANSENS, amscansens); EEPROM.writeByte(EE_BYTE_FMSCANSENS, fmscansens); EEPROM.writeByte(EE_BYTE_FREQFONT, freqfont); + EEPROM.writeByte(EE_BYTE_SKIN, CurrentSkin); EEPROM.commit(); if (af == 2) radio.rds.afreg = true; else radio.rds.afreg = false; if (!usesquelch) radio.setUnMute(); @@ -3570,6 +3572,7 @@ void DefaultSettings(byte userhardwaremodel) { EEPROM.writeByte(EE_BYTE_AMSCANSENS, 4); EEPROM.writeByte(EE_BYTE_FMSCANSENS, 4); EEPROM.writeByte(EE_BYTE_FREQFONT, 3); + EEPROM.writeByte(EE_BYTE_SKIN, 0); EEPROM.commit(); } diff --git a/src/constants.h b/src/constants.h index e1e2bd4..a348219 100644 --- a/src/constants.h +++ b/src/constants.h @@ -109,7 +109,7 @@ #define EE_PRESETS_CNT 99 #define EE_CHECKBYTE_VALUE 3 // 0 ~ 255,add new entry, change for new value -#define EE_TOTAL_CNT 822 +#define EE_TOTAL_CNT 823 #define EE_UINT16_FREQUENCY_FM 0 #define EE_BYTE_VOLSET 4 #define EE_BYTE_STEREO 5 @@ -183,15 +183,16 @@ #define EE_STRING_XDRGTK_KEY 106 // 11 byte #define EE_BYTE_FASTPS 118 #define EE_BYTE_TOT 119 -#define EE_BYTE_MWREGION 120 -#define EE_BYTE_SPISPEED 121 -#define EE_BYTE_AMSCANSENS 122 -#define EE_BYTE_FMSCANSENS 123 -#define EE_BYTE_FREQFONT 124 -#define EE_PRESETS_BAND_START 125 -#define EE_PRESET_BW_START 225 -#define EE_PRESET_MS_START 325 -#define EE_PRESETS_START 425 +#define EE_BYTE_MWREGION 120 +#define EE_BYTE_SPISPEED 121 +#define EE_BYTE_AMSCANSENS 122 +#define EE_BYTE_FMSCANSENS 123 +#define EE_BYTE_FREQFONT 124 +#define EE_BYTE_SKIN 125 +#define EE_PRESETS_BAND_START 126 +#define EE_PRESET_BW_START 226 +#define EE_PRESET_MS_START 326 +#define EE_PRESETS_START 426 #define EE_PRESETS_FREQUENCY 0 // End of EEPROM index defines @@ -199,6 +200,7 @@ static const char* const unitString[] = {"dBμV", "dBf", "dBm"}; static const char* const FreqFont[] = {"Classic", "Roubenstil", "Motoya", "Aura2", "Comic"}; static const char* const Theme[] = {"Essence", "Cyan", "Crimson", "Monochrome", "Volcano", "Dendro", "Sakura", "Whiteout", "Tangerine", "Ocean", "Indigo", "GoldBrite"}; +static const char* const Skin[] = {"Essential"}; // FM band: before BAND_GAP; AM band: after BAND_GAP enum RADIO_BAND { diff --git a/src/gui.cpp b/src/gui.cpp index 81c8409..3b69ecc 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -7,7 +7,7 @@ #include byte menuitem; -byte items[8] = {8, static_cast(dynamicspi ? 4 : 3), 7, 10, 9, 10, 10, 5}; +byte items[8] = {8, static_cast(dynamicspi ? 5 : 3), 7, 10, 9, 10, 10, 5}; void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/ switch (CurrentTheme) { @@ -34,7 +34,7 @@ void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de BarSignificantColor = TFT_RED; BarInsignificantColor = TFT_GREEN; ModBarSignificantColor = TFT_RED; - ModBarInsignificantColor = TFT_GREEN; + ModBarInsignificantColor = TFT_GREEN; BWAutoColor = 0x07F7; BWAutoColorSmooth = 0x0144; BatteryValueColor = 0x07F7; @@ -237,7 +237,7 @@ void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de BarSignificantColor = TFT_BLACK; BarInsignificantColor = TFT_GREEN; ModBarSignificantColor = TFT_BLACK; - ModBarInsignificantColor = TFT_GREEN; + ModBarInsignificantColor = TFT_GREEN; BWAutoColor = 0x7BCF; BWAutoColorSmooth = TFT_WHITE; BatteryValueColor = TFT_BLACK; @@ -372,7 +372,7 @@ void BuildAFScreen() { } afscreen = true; advancedRDS = false; - if (theme == 0) { + if (CurrentSkin == 0) { tft.fillScreen(BackgroundColor); tft.drawRect(0, 0, 320, 240, FrameColor); tft.drawLine(0, 30, 320, 30, FrameColor); @@ -449,6 +449,7 @@ void BuildMenu() { tftPrint(-1, myLanguage[language][108], 8, ITEM1 + 6, ActiveColor, ActiveColorSmooth, 16); 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); switch (hardwaremodel) { case BASE_ILI9341: tftPrint(1, myLanguage[language][109], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; @@ -459,11 +460,13 @@ void BuildMenu() { if (touchrotating) tftPrint(1, myLanguage[language][42], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (tot != 0) tftPrint(1, String(tot), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (tot != 0) tftPrint(1, myLanguage[language][205], 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); + if (dynamicspi) { - tftPrint(1, "MHz", 310, ITEM4 + 6, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][206], 8, ITEM4 + 6, ActiveColor, ActiveColorSmooth, 16); - if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 270, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); - else tftPrint(1, String(spispeed * 10, DEC), 270, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(1, "MHz", 310, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][206], 8, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); + if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 270, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); + else tftPrint(1, String(spispeed * 10, DEC), 270, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); } break; @@ -493,38 +496,39 @@ void BuildMenu() { case DISPLAYSETTINGS: tftPrint(-1, myLanguage[language][39], 8, ITEM1 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][29], 8, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][62], 8, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][63], 8, ITEM4 + 6, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][77], 8, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][91], 8, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][74], 8, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][173], 8, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][98], 8, ITEM9 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][63], 8, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][91], 8, ITEM4 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][74], 8, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][173], 8, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][98], 8, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][78], 8, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][77], 8, ITEM9 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][210], 8, ITEM10 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(1, myLanguage[language][0], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(1, "%", 310, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(1, String(ContrastSet, DEC), 270, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); - if (usesquelch) tftPrint(1, myLanguage[language][42], 310, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); - if (showmodulation) 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, Theme[CurrentTheme], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); - if (screensaverset) tftPrint(1, myLanguage[language][92], 310, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); - if (screensaverset) tftPrint(1, String(screensaverOptions[screensaverset], DEC), 270, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); + + if (showmodulation) tftPrint(1, myLanguage[language][42], 310, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); + if (screensaverset) tftPrint(1, myLanguage[language][92], 310, ITEM4 + 6, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); + if (screensaverset) tftPrint(1, String(screensaverOptions[screensaverset], DEC), 270, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); switch (poweroptions) { - case LCD_OFF: tftPrint(1, myLanguage[language][76], 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; - case LCD_BRIGHTNESS_1_PERCENT: tftPrint(1, myLanguage[language][94], 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; - case LCD_BRIGHTNESS_A_QUARTER: tftPrint(1, myLanguage[language][95], 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; - case LCD_BRIGHTNESS_HALF: tftPrint(1, myLanguage[language][96], 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; + case LCD_OFF: tftPrint(1, myLanguage[language][76], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; + case LCD_BRIGHTNESS_1_PERCENT: tftPrint(1, myLanguage[language][94], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; + case LCD_BRIGHTNESS_A_QUARTER: tftPrint(1, myLanguage[language][95], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; + case LCD_BRIGHTNESS_HALF: tftPrint(1, myLanguage[language][96], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; } switch (batteryoptions) { - case BATTERY_NONE: tftPrint(1, myLanguage[language][30], 310, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; - case BATTERY_VALUE: tftPrint(1, myLanguage[language][174], 310, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; - case BATTERY_PERCENT: tftPrint(1, myLanguage[language][175], 310, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; + case BATTERY_NONE: tftPrint(1, myLanguage[language][30], 310, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; + case BATTERY_VALUE: tftPrint(1, myLanguage[language][174], 310, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; + case BATTERY_PERCENT: tftPrint(1, myLanguage[language][175], 310, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; } - tftPrint(1, unitString[unit], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(1, unitString[unit], 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(1, Skin[CurrentSkin], 310, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(1, Theme[CurrentTheme], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(1, FreqFont[freqfont], 310, ITEM10 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; @@ -669,7 +673,7 @@ void BuildAdvancedRDS() { afpagenr = 1; advancedRDS = true; ScreensaverTimerSet(OFF); - if (theme == 0) { + if (CurrentSkin == 0) { tft.fillScreen(BackgroundColor); tft.drawRect(0, 0, 320, 240, FrameColor); tft.drawLine(0, 30, 320, 30, FrameColor); @@ -732,7 +736,7 @@ void BuildAdvancedRDS() { tftPrint(-1, "kHz", 203, 4, ActiveColor, ActiveColorSmooth, 28); tft.drawBitmap(122, 5, RDSLogo, 35, 22, GreyoutColor); - tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor); + tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor); if (!StereoToggle) { tft.drawSmoothCircle(71, 15, 10, SecondaryColor, SecondaryColorSmooth); @@ -798,7 +802,7 @@ void BuildDisplay() { afscreen = false; advancedRDS = false; int bandColor; - if (theme == 0) { + if (CurrentSkin == 0) { tft.fillScreen(BackgroundColor); tft.drawRect(0, 0, 320, 240, FrameColor); tft.drawLine(0, 30, 320, 30, FrameColor); @@ -873,8 +877,8 @@ void BuildDisplay() { if (band > BAND_GAP) tftPrint(0, "EQ", 303, 59, GreyoutColor, BackgroundColor, 16); tft.drawBitmap(122, 5, RDSLogo, 35, 22, GreyoutColor); - tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor); - + tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor); + if (!StereoToggle) { tft.drawSmoothCircle(71, 15, 10, SecondaryColor, SecondaryColorSmooth); tft.drawSmoothCircle(71, 15, 9, SecondaryColor, SecondaryColorSmooth); @@ -990,6 +994,12 @@ void MenuUp() { break; case ITEM4: + if (usesquelch) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); + if (usesquelch) usesquelch = false; else usesquelch = true; + if (usesquelch) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; + + case ITEM5: 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); @@ -1092,28 +1102,12 @@ void MenuUp() { break; case ITEM3: - if (usesquelch) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); - if (usesquelch) usesquelch = false; else usesquelch = true; - if (usesquelch) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - break; - - case ITEM4: if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); if (showmodulation) showmodulation = false; else showmodulation = true; if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; - case ITEM5: - CurrentTheme ++; - if (CurrentTheme > 11) CurrentTheme = 0; - doTheme(); - tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); - tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); - tftPrint(0, myLanguage[language][77], 155, 78, ActiveColor, ActiveColorSmooth, 28); - tftPrint(0, Theme[CurrentTheme], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - break; - - case ITEM6: + case ITEM4: if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, BackgroundColor, BackgroundColor, 28); if (!screensaverset) tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, BackgroundColor, BackgroundColor, 28); screensaverset ++; @@ -1122,7 +1116,7 @@ void MenuUp() { if (!screensaverset) tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; - case ITEM7: + case ITEM5: switch (poweroptionsold) { case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, BackgroundColor, BackgroundColor, 28); break; case LCD_BRIGHTNESS_1_PERCENT: tftPrint(0, myLanguage[language][94], 155, 118, BackgroundColor, BackgroundColor, 28); break; @@ -1142,7 +1136,7 @@ void MenuUp() { poweroptionsold = poweroptions; break; - case ITEM8: + case ITEM6: switch (batteryoptionsold) { case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); break; case BATTERY_VALUE: tftPrint(0, myLanguage[language][174], 155, 118, BackgroundColor, BackgroundColor, 28); break; @@ -1160,18 +1154,35 @@ void MenuUp() { batteryoptionsold = batteryoptions; break; - case ITEM9: - tftPrint(0, String(unitString[unit]), 155, 118, BackgroundColor, BackgroundColor, 28); + case ITEM7: + tftPrint(0, unitString[unit], 155, 118, BackgroundColor, BackgroundColor, 28); unit ++; - if (unit > 2) unit = 0; - tftPrint(0, String(unitString[unit]), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (unit > sizeof(unitString) / sizeof(unitString[0]) - 1) unit = 0; + tftPrint(0, unitString[unit], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; + + case ITEM8: + tftPrint(0, Skin[CurrentSkin], 155, 118, BackgroundColor, BackgroundColor, 28); + CurrentSkin ++; + if (CurrentSkin > sizeof(Skin) / sizeof(Skin[0]) - 1) CurrentSkin = 0; + tftPrint(0, Skin[CurrentSkin], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; + + case ITEM9: + CurrentTheme ++; + if (CurrentTheme > sizeof(Theme) / sizeof(Theme[0]) - 1) CurrentTheme = 0; + doTheme(); + tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); + tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); + tftPrint(0, myLanguage[language][77], 155, 78, ActiveColor, ActiveColorSmooth, 28); + tftPrint(0, Theme[CurrentTheme], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; case ITEM10: - tftPrint(0, String(FreqFont[freqfont]), 155, 118, BackgroundColor, BackgroundColor, 28); + tftPrint(0, FreqFont[freqfont], 155, 118, BackgroundColor, BackgroundColor, 28); freqfont ++; - if (freqfont > 4) freqfont = 0; - tftPrint(0, String(FreqFont[freqfont]), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (freqfont > sizeof(FreqFont) / sizeof(FreqFont[0]) - 1) freqfont = 0; + tftPrint(0, FreqFont[freqfont], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; } break; @@ -1574,6 +1585,12 @@ void MenuDown() { break; case ITEM4: + if (usesquelch) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); + if (usesquelch) usesquelch = false; else usesquelch = true; + if (usesquelch) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; + + case ITEM5: 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); @@ -1677,28 +1694,12 @@ void MenuDown() { break; case ITEM3: - if (usesquelch) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); - if (usesquelch) usesquelch = false; else usesquelch = true; - if (usesquelch) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - break; - - case ITEM4: if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); if (showmodulation) showmodulation = false; else showmodulation = true; if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; - case ITEM5: - CurrentTheme --; - if (CurrentTheme > 10) CurrentTheme = 11; - doTheme(); - tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); - tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); - tftPrint(0, myLanguage[language][77], 155, 78, ActiveColor, ActiveColorSmooth, 28); - tftPrint(0, Theme[CurrentTheme], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - break; - - case ITEM6: + case ITEM4: if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, BackgroundColor, BackgroundColor, 28); if (!screensaverset) tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, BackgroundColor, BackgroundColor, 28); screensaverset --; @@ -1707,7 +1708,7 @@ void MenuDown() { if (!screensaverset) tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; - case ITEM7: + case ITEM5: switch (poweroptionsold) { case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, BackgroundColor, BackgroundColor, 28); break; case LCD_BRIGHTNESS_1_PERCENT: tftPrint(0, myLanguage[language][94], 155, 118, BackgroundColor, BackgroundColor, 28); break; @@ -1727,7 +1728,7 @@ void MenuDown() { poweroptionsold = poweroptions; break; - case ITEM8: + case ITEM6: switch (batteryoptionsold) { case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); break; case BATTERY_VALUE: tftPrint(0, myLanguage[language][174], 155, 118, BackgroundColor, BackgroundColor, 28); break; @@ -1745,18 +1746,35 @@ void MenuDown() { batteryoptionsold = batteryoptions; break; - case ITEM9: - tftPrint(0, String(unitString[unit]), 155, 118, BackgroundColor, BackgroundColor, 28); + case ITEM7: + tftPrint(0, unitString[unit], 155, 118, BackgroundColor, BackgroundColor, 28); unit --; - if (unit > 2) unit = 2; - tftPrint(0, String(unitString[unit]), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (unit > sizeof(unitString) / sizeof(unitString[0]) - 1) unit = sizeof(unitString) / sizeof(unitString[0]) - 1; + tftPrint(0, unitString[unit], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; + + case ITEM8: + tftPrint(0, Skin[CurrentSkin], 155, 118, BackgroundColor, BackgroundColor, 28); + CurrentSkin --; + if (CurrentSkin > sizeof(Skin) / sizeof(Skin[0]) - 1) CurrentSkin = sizeof(Skin) / sizeof(Skin[0]) - 1; + tftPrint(0, Skin[CurrentSkin], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; + + case ITEM9: + CurrentTheme --; + if (CurrentTheme > sizeof(Theme) / sizeof(Theme[0]) - 1) CurrentTheme = sizeof(Theme) / sizeof(Theme[0]) - 1; + doTheme(); + tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); + tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); + tftPrint(0, myLanguage[language][77], 155, 78, ActiveColor, ActiveColorSmooth, 28); + tftPrint(0, Theme[CurrentTheme], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; case ITEM10: - tftPrint(0, String(FreqFont[freqfont]), 155, 118, BackgroundColor, BackgroundColor, 28); + tftPrint(0, FreqFont[freqfont], 155, 118, BackgroundColor, BackgroundColor, 28); freqfont --; - if (freqfont > 4) freqfont = 4; - tftPrint(0, String(FreqFont[freqfont]), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + if (freqfont > sizeof(FreqFont) / sizeof(FreqFont[0]) - 1) freqfont = sizeof(FreqFont) / sizeof(FreqFont[0]) - 1; + tftPrint(0, FreqFont[freqfont], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; } break; @@ -2211,6 +2229,11 @@ void DoMenu() { break; case ITEM4: + Infoboxprint(myLanguage[language][62]); + if (usesquelch) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; + + case ITEM5: Infoboxprint(myLanguage[language][206]); 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), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); @@ -2276,27 +2299,17 @@ void DoMenu() { break; case ITEM3: - Infoboxprint(myLanguage[language][62]); - if (usesquelch) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - break; - - case ITEM4: Infoboxprint(myLanguage[language][63]); if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; - case ITEM5: - Infoboxprint(myLanguage[language][77]); - tftPrint(0, Theme[CurrentTheme], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); - break; - - case ITEM6: + case ITEM4: Infoboxprint(myLanguage[language][91]); 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; - case ITEM7: + case ITEM5: Infoboxprint(myLanguage[language][74]); switch (poweroptions) { case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; @@ -2307,7 +2320,7 @@ void DoMenu() { poweroptionsold = poweroptions; break; - case ITEM8: + case ITEM6: Infoboxprint(myLanguage[language][173]); switch (batteryoptions) { case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; @@ -2317,11 +2330,21 @@ void DoMenu() { batteryoptionsold = batteryoptions; break; - case ITEM9: + case ITEM7: Infoboxprint(myLanguage[language][98]); tftPrint(0, unitString[unit], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; + case ITEM8: + Infoboxprint(myLanguage[language][78]); + tftPrint(0, Skin[CurrentSkin], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; + + case ITEM9: + Infoboxprint(myLanguage[language][77]); + tftPrint(0, Theme[CurrentTheme], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; + case ITEM10: Infoboxprint(myLanguage[language][210]); tftPrint(0, FreqFont[freqfont], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); diff --git a/src/gui.h b/src/gui.h index c887849..2b02d31 100644 --- a/src/gui.h +++ b/src/gui.h @@ -10,17 +10,17 @@ #define SMETERPIN 27 #define CONTRASTPIN 2 -#define ITEM_GAP 20 -#define ITEM1 30 -#define ITEM2 50 -#define ITEM3 70 -#define ITEM4 90 -#define ITEM5 110 -#define ITEM6 130 -#define ITEM7 150 -#define ITEM8 170 -#define ITEM9 190 -#define ITEM10 210 +#define ITEM_GAP 20 +#define ITEM1 30 +#define ITEM2 50 +#define ITEM3 70 +#define ITEM4 90 +#define ITEM5 110 +#define ITEM6 130 +#define ITEM7 150 +#define ITEM8 170 +#define ITEM9 190 +#define ITEM10 210 enum menupage {INDEX, MAINSETTINGS, AUDIOSETTINGS, DISPLAYSETTINGS, RDSSETTINGS, FMSETTINGS, AMSETTINGS, CONNECTIVITY}; @@ -73,6 +73,7 @@ extern byte batteryold; extern byte batteryoptions; extern byte batteryoptionsold; extern byte ContrastSet; +extern byte CurrentSkin; extern byte CurrentTheme; extern byte ECCold; extern byte fmscansens; @@ -107,7 +108,6 @@ extern byte StereoLevel; extern byte StereoLevel; extern byte submenu; extern byte subnetclient; -extern byte theme; extern byte tot; extern byte touchrotating; extern byte unit; diff --git a/src/language.h b/src/language.h index 2cb34ab..0c08c16 100644 --- a/src/language.h +++ b/src/language.h @@ -84,7 +84,7 @@ static const char* const myLanguage[18][211] = { "Time-out timer", // 75 "Screen off", // 76 "Theme", // 77 - "", // 78 + "Skin", // 78 "", // 79 "", // 80 "", // 81 @@ -216,7 +216,7 @@ static const char* const myLanguage[18][211] = { "Scan sensitivity", // 207 "NONE", // 208 "Software version", // 209 - "Frequency font" // 210 + "Frequency font" // 210 }, { "Nederlands", // Dutch @@ -297,7 +297,7 @@ static const char* const myLanguage[18][211] = { "Auto uitschakelen", // 75 "Scherm uit", // 76 "Thema", // 77 - "", // 78 + "Uiterlijk", // 78 *** "", // 79 *** "", // 80 *** "", // 81 *** @@ -429,7 +429,7 @@ static const char* const myLanguage[18][211] = { "Zoek gevoeligheid", // 207 "Geen", // 208 "Software versie", // 209 - "Frequentie font" // 210 + "Frequentie font" // 210 }, { "Polski", // Polish @@ -510,7 +510,7 @@ static const char* const myLanguage[18][211] = { "Wyłącznik czasowy", // 75 "Wyłącz ekran", // 76 "Motyw", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 *** "", // 80 *** "", // 81 *** @@ -641,8 +641,8 @@ static const char* const myLanguage[18][211] = { "Dynam. prędkość SPI", // 206 "Czułość skanowania", // 207 "BRAK", // 208 - "Wersja oprogramowania", // 209 - "Czcionka częstotliwości" // 210 *** + "Wersja oprogramowania", // 209 + "Czcionka częstotliwości" // 210 *** }, { "Hrvatski", // Croatian @@ -723,7 +723,7 @@ static const char* const myLanguage[18][211] = { "Time-out timer", // 75 *** "Zaslon isključiti", // 76 "Tema dizajna", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 *** "", // 80 *** "", // 81 *** @@ -855,7 +855,7 @@ static const char* const myLanguage[18][211] = { "Scan sensitivity", // 207 "NONE", // 208 represents: AM/FM bands unavailable(please delete this note after translation) "Software version", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Ελληνικά", // Greek @@ -936,7 +936,7 @@ static const char* const myLanguage[18][211] = { "Χρονοδιακόπτης λήξης", // 75 "Οθόνη σβηστή", // 76 "Θέμα", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 "", // 80 "", // 81 @@ -1068,7 +1068,7 @@ static const char* const myLanguage[18][211] = { "Ευαισθησία\nανίχνευσης", // 207 "KAMIA", // 208 "Έκδοση λογισμικού", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Română", // Romanian @@ -1149,7 +1149,7 @@ static const char* const myLanguage[18][211] = { "Intervalul de timp", // 75 "Ecran oprit", // 76 "Teme", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 *** "", // 80 *** "", // 81 *** @@ -1281,7 +1281,7 @@ static const char* const myLanguage[18][211] = { "Scan sensitivity", // 207 "NONE", // 208 represents: AM/FM bands unavailable(please delete this note after translation) "Software version", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Deutsch", // German @@ -1362,7 +1362,7 @@ static const char* const myLanguage[18][211] = { "Abschaltzeit", // 75 "Bildschirm aus", // 76 "Thema", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 "", // 80 "", // 81 @@ -1494,7 +1494,7 @@ static const char* const myLanguage[18][211] = { "Scanempfindlichkeit", // 207 "KEINE", // 208 "Softwareversion", // 209 - "Frequenz-Schriftart" // 210 *** + "Frequenz-Schriftart" // 210 *** }, { "Český", // Czech @@ -1575,7 +1575,7 @@ static const char* const myLanguage[18][211] = { "Čas", // 75 "Vypnutí obrazovky", // 76 "Vzhled", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 *** "", // 80 *** "", // 81 *** @@ -1707,7 +1707,7 @@ static const char* const myLanguage[18][211] = { "Scan sensitivity", // 207 "NONE", // 208 represents: AM/FM bands unavailable(please delete this note after translation) "Software version", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Slovenský", // Slovak @@ -1788,7 +1788,7 @@ static const char* const myLanguage[18][211] = { "Čas", // 75 "Vypnutie obrazovky", // 76 "Vzhľad", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 *** "", // 80 *** "", // 81 *** @@ -1920,7 +1920,7 @@ static const char* const myLanguage[18][211] = { "Scan sensitivity", // 207 "NONE", // 208 represents: AM/FM bands unavailable(please delete this note after translation) "Software version", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Français", // French @@ -2001,7 +2001,7 @@ static const char* const myLanguage[18][211] = { "Temporisateur", // 75 "Affichage éteint", // 76 "Thème", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 "", // 80 "", // 81 @@ -2133,7 +2133,7 @@ static const char* const myLanguage[18][211] = { "Sensibilité\ndu scanne ", // 207 "AUCUNE", // 208 "Version de logiciel", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Български", // Bulgarian @@ -2214,7 +2214,7 @@ static const char* const myLanguage[18][211] = { "Time-out timer", // 75 *** "Изключен дисплей", // 76 "Тема", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 "", // 80 *** "", // 81 @@ -2346,7 +2346,7 @@ static const char* const myLanguage[18][211] = { "Scan sensitivity", // 207 "NONE", // 208 represents: AM/FM bands unavailable(please delete this note after translation) "Software version", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Русский", // Russian @@ -2427,7 +2427,7 @@ static const char* const myLanguage[18][211] = { "Глубокий сон", // 75 "Погасить экран", // 76 "Тема", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 "", // 80 "", // 81 @@ -2559,7 +2559,7 @@ static const char* const myLanguage[18][211] = { "Чувствительность сканирования", // 207 "Отсутствуют", // 208 "Версия прошивки", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Українська", // Ukranian @@ -2640,7 +2640,7 @@ static const char* const myLanguage[18][211] = { "Таймер тайм-ауту", // 75 "Екран вимкнено", // 76 "Тема", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 "", // 80 "", // 81 @@ -2772,7 +2772,7 @@ static const char* const myLanguage[18][211] = { "Чутливість сканування", // 207 "NONE", // 208 represents: AM/FM bands unavailable(please delete this note after translation) "Версія ПО", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Italiano", // Italian @@ -2853,7 +2853,7 @@ static const char* const myLanguage[18][211] = { "Timer di time-out", // 75 *** "Schermo spento", // 76 "Motivo schermo", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 "", // 80 "", // 81 @@ -2985,7 +2985,7 @@ static const char* const myLanguage[18][211] = { "Sensibilità scansione", // 207 "NONE", // 208 represents: AM/FM bands unavailable(please delete this note after translation) "Software version", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Simplified Chinese", // Simplified Chinese @@ -3066,7 +3066,7 @@ static const char* const myLanguage[18][211] = { "倒计时关机", // 75 "关闭屏幕", // 76 "主题&颜色", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 "", // 80 "", // 81 @@ -3198,7 +3198,7 @@ static const char* const myLanguage[18][211] = { "搜索灵敏度", // 207 "不可用", // 208 "Software version", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Norsk", // Norwegian @@ -3279,7 +3279,7 @@ static const char* const myLanguage[18][211] = { "Tidsavbruddstimer", // 75 "Skjerm av", // 76 "Tema", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 *** "", // 80 *** "", // 81 *** @@ -3411,7 +3411,7 @@ static const char* const myLanguage[18][211] = { "Skannefølsomhet", // 207 "INGEN", // 208 "Programvareversjon", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Español", // Spanish @@ -3492,7 +3492,7 @@ static const char* const myLanguage[18][211] = { "Temporizador de\ntiempo muerto", // 75 "Apagar pantalla", // 76 "Tema", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 "", // 80 "", // 81 @@ -3624,7 +3624,7 @@ static const char* const myLanguage[18][211] = { "Sensibilidad\ndel escaneo", // 207 "NINGUNA", // 208 "Versión del software", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** }, { "Português", // Portuguese @@ -3705,7 +3705,7 @@ static const char* const myLanguage[18][211] = { "Temporizador de\ndesligamento", // 75 "Desligar a tela", // 76 "Tema", // 77 - "", // 78 + "Skin", // 78 *** "", // 79 "", // 80 "", // 81 @@ -3837,7 +3837,7 @@ static const char* const myLanguage[18][211] = { "Sensibilidade\nda varredura", // 207 "NENHUM", // 208 "Versão do software", // 209 - "Frequency font" // 210 *** + "Frequency font" // 210 *** } }; -#endif +#endif \ No newline at end of file