diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 93a9648..2811f9d 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -17,6 +17,7 @@ #include "src/TEF6686.h" #include "src/constants.h" #include "src/language.h" +#include "src/gui.h" #define ROTARY_PIN_A 34 #define ROTARY_PIN_B 36 @@ -2005,312 +2006,7 @@ void ButtonPress() { ScreensaverTimerRestart(); } } else { - if (menuopen == false) { - menuopen = true; - tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); - tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); - switch (menupage) { - case 1: - switch (menuoption) { - case 30: - tftPrint(0, myLanguage[language][10], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); - if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(VolSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 50: - tftPrint(0, myLanguage[language][11], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(-1, "MHz", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(1, String(ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 70: - tftPrint(0, myLanguage[language][12], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(-1, "MHz", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(1, String(LowEdgeSet / 10 + ConverterSet, DEC) + "." + String(LowEdgeSet % 10 + ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 90: - tftPrint(0, myLanguage[language][13], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(-1, "MHz", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(1, String(HighEdgeSet / 10 + ConverterSet, DEC) + "." + String(HighEdgeSet % 10 + ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 110: - tftPrint(0, myLanguage[language][14], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(-1, "dBμV", 190, 165, ActiveColor, ActiveColorSmooth, FONT28); - if (LevelOffset > 0) tftPrint(1, "+" + String(LevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(LevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - SStatusold = 2000; - change2 = true; - break; - - case 130: - tftPrint(0, myLanguage[language][15], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); - if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 150: - tftPrint(0, myLanguage[language][16], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (HighCutLevel != 0) tftPrint(-1, "Hz", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); - if (HighCutLevel != 0) tftPrint(1, String(HighCutLevel * 100, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 170: - tftPrint(0, myLanguage[language][17], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); - if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 190: - tftPrint(0, myLanguage[language][18], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(-1, "dBμV", 155, 118, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(1, String(LowLevelSet, DEC), 145, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 210: - tftPrint(0, myLanguage[language][19], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(-1, "%", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(1, String(ContrastSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - } - break; - - case 2: - switch (menuoption) { - case 30: - tftPrint(0, myLanguage[language][40], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(0, myLanguage[language][0], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 50: - tftPrint(0, myLanguage[language][38], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (showrdserrors) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 70: - tftPrint(0, myLanguage[language][43], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (softmutefm) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 90: - tftPrint(0, myLanguage[language][44], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (softmuteam) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 110: - tftPrint(0, myLanguage[language][45], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (edgebeep) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 130: - tftPrint(0, myLanguage[language][46], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (region == 0) tftPrint(0, myLanguage[language][47], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (region == 1) tftPrint(0, myLanguage[language][48], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 150: - tftPrint(0, myLanguage[language][49], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 170: - tftPrint(0, myLanguage[language][50], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (USBmode) tftPrint(0, "RDS Spy", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, "XDRGTK", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 190: - tftPrint(0, myLanguage[language][51], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (wifi) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 210: - tftPrint(0, myLanguage[language][53], 155, 58, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(0, "ESP_" + String(ESP_getChipId()), 155, 98, PrimaryColor, PrimaryColorSmooth, FONT28); - tftPrint(0, myLanguage[language][54], 155, 138, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(0, "http://192.168.4.1", 155, 174, PrimaryColor, PrimaryColorSmooth, FONT16); - char key [9]; - XDRGTK_key.toCharArray(key, 9); - WiFiConnectParam XDRGTK_key_text("Set XDRGTK Password: (max 8 characters)"); - WiFiConnectParam XDRGTK_key_input("XDRGTK_key", "Password", key, 9); - wc.addParameter(&XDRGTK_key_text); - wc.addParameter(&XDRGTK_key_input); - wc.startConfigurationPortal(AP_WAIT); - XDRGTK_key = XDRGTK_key_input.getValue(); - EEPROM.writeString(EE_STRING_XDRGTK_KEY, XDRGTK_key); - EEPROM.commit(); - tryWiFi(); - delay(2000); - BuildMenu(); - break; - } - break; - - case 3: - switch (menuoption) { - case 30: - tftPrint(0, myLanguage[language][58], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 50: - tftPrint(0, myLanguage[language][59], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (showSWMIBand) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 70: - tftPrint(0, myLanguage[language][60], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (radio.rds.filter) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 90: - tftPrint(0, myLanguage[language][61], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (radio.rds.pierrors) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 110: - tftPrint(0, myLanguage[language][62], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (showsquelch) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 130: - tftPrint(0, myLanguage[language][63], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 150: - tftPrint(0, myLanguage[language][64], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (amnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 170: - tftPrint(0, myLanguage[language][65], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (fmnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 190: - tftPrint(0, myLanguage[language][67], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (audiomode) tftPrint(0, "MPX", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, "Stereo", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 210: - tftPrint(0, myLanguage[language][107], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (touchrotating) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - } - break; - - case 4: - switch (menuoption) { - case 30: - tftPrint(0, myLanguage[language][77], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(0, CurrentThemeString, 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 50: - tftPrint(0, myLanguage[language][71], 155, 38, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(0, myLanguage[language][72], 155, 88, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(0, "PE5PVB", 155, 68, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, "ohmytime", 145, 118, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, "HyperDX", 145, 133, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(-1, "MCelliotG", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(-1, "andimik", 155, 133, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, "DXHR05", 145, 148, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, "NoobishSVK", 145, 163, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(-1, "yo2ldk", 155, 148, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(-1, "Justin_Peng(Portable)", 155, 163, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(0, "github.com/PE5PVB/TEF6686_ESP32", 155, 183, ActiveColor, ActiveColorSmooth, FONT16); - break; - - case 70: - tftPrint(0, myLanguage[language][74], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - switch (poweroptions) { - case DEEP_SLEEP: tftPrint(0, myLanguage[language][75], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case LCD_BRIGHTNESS_1_PERCENT: tftPrint(0, myLanguage[language][94], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case LCD_BRIGHTNESS_A_QUARTER: tftPrint(0, myLanguage[language][95], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case LCD_BRIGHTNESS_HALF: tftPrint(0, myLanguage[language][96], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - } - poweroptionsold = poweroptions; - break; - - case 90: - tftPrint(-1, "KHz", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(0, myLanguage[language][90], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 110: - tftPrint(0, myLanguage[language][91], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (!screensaverset) tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(screensaverOptions[screensaverset], DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 130: - tftPrint(0, myLanguage[language][97], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); - if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(AMLevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 150: - tftPrint(0, myLanguage[language][98], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(0, unitString[unit], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 170: - tftPrint(0, myLanguage[language][99], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - if (af) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - case 190: - tftPrint(0, myLanguage[language][100], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - ShowBandSelectionFM(true, true); - break; - case 210: - tftPrint(0, myLanguage[language][101], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - ShowBandSelectionAM(true, true); - break; - } - break; - - case 5: - switch (menuoption) { - case 30: - tftPrint(0, myLanguage[language][108], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - switch (hardwaremodel) { - case BASE_ILI9341: tftPrint(0, myLanguage[language][109], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case PORTABLE_ILI9341: tftPrint(0, myLanguage[language][110], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case PORTABLE_TOUCH_ILI9341: tftPrint(0, myLanguage[language][111], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - } - hardwaremodelold = hardwaremodel; - break; - - case 50: - tftPrint(0, myLanguage[language][173], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); - switch (batteryoptions) { - case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case BATTERY_VALUE: tftPrint(0, myLanguage[language][174], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case BATTERY_PERCENT: tftPrint(0, myLanguage[language][175], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - } - batteryoptionsold = batteryoptions; - break; - } - break; - - } - } else { - if (menupage == 2 && menuoption == 190 && wifi == true) { - tryWiFi(); - delay(2000); - } - if (menupage == 2 && menuoption == 30) { - doTheme(); - } - menuopen = false; - BuildMenu(); - } + DoMenu(); } while (digitalRead(ROTARY_BUTTON) == LOW) delay(50); } @@ -2356,400 +2052,7 @@ void KeyUp() { ShowFreq(0); store = true; } else { - if (menuopen == false) { - tft.drawRoundRect(8, menuoption + 3, 302, 21, 5, BackgroundColor); - if (hardwaremodel == BASE_ILI9341) { - menuoption += 20; - if (menuoption > 210) { - menupage++; - if (menupage > menupagestotal) menupage = 1; - menuoption = 30; - BuildMenu(); - } - } else { - menuoption -= 20; - if (menuoption < 30) { - menupage--; - if (menupage == 0) menupage = menupagestotal; - menuoption = 210; - BuildMenu(); - } - } - tft.drawRoundRect(8, menuoption + 3, 302, 21, 5, ActiveColor); - } else { - switch (menupage) { - case 1: - switch (menuoption) { - case 30: - if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(VolSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - VolSet++; - if (VolSet > 10) VolSet = 10; - if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(VolSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setVolume(VolSet); - break; - - case 50: - tftPrint(1, String(ConverterSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - ConverterSet++; - if (ConverterSet > 2400 || ConverterSet <= 200) { - if (ConverterSet == 1) ConverterSet = 200; else ConverterSet = 0; - } - if (ConverterSet >= 200) { - Wire.beginTransmission(0x12); - Wire.write(ConverterSet >> 8); - Wire.write(ConverterSet & (0xFF)); - Wire.endTransmission(); - } - tftPrint(1, String(ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 70: - tftPrint(1, String(LowEdgeSet / 10 + ConverterSet, DEC) + "." + String(LowEdgeSet % 10 + ConverterSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - LowEdgeSet ++; - if (LowEdgeSet > 1070) LowEdgeSet = 650; - tftPrint(1, String(LowEdgeSet / 10 + ConverterSet, DEC) + "." + String(LowEdgeSet % 10 + ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 90: - tftPrint(1, String(HighEdgeSet / 10 + ConverterSet, DEC) + "." + String(HighEdgeSet % 10 + ConverterSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - HighEdgeSet ++; - if (HighEdgeSet > 1080) HighEdgeSet = 660; - tftPrint(1, String(HighEdgeSet / 10 + ConverterSet, DEC) + "." + String(HighEdgeSet % 10 + ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 110: - if (LevelOffset > 0) tftPrint(1, "+" + String(LevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(LevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - LevelOffset++; - if (LevelOffset > 15) LevelOffset = -25; - if (LevelOffset > 0) tftPrint(1, "+" + String(LevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(LevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setOffset(LevelOffset); - change2 = true; - break; - - case 130: - if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, BackgroundColor, BackgroundColor, FONT28); - StereoLevel ++; - if (StereoLevel > 60 || StereoLevel <= 30) { - if (StereoLevel == 1) StereoLevel = 30; else StereoLevel = 0; - } - if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setStereoLevel(StereoLevel); - break; - - case 150: - tftPrint(1, String(HighCutLevel * 100, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - HighCutLevel ++; - if (HighCutLevel > 70) HighCutLevel = 15; - tftPrint(1, String(HighCutLevel * 100, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setHighCutLevel(HighCutLevel); - break; - - case 170: - if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - HighCutOffset ++; - if (HighCutOffset > 60 || HighCutOffset <= 20) { - if (HighCutOffset == 1) HighCutOffset = 20; else HighCutOffset = 0; - } - if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setHighCutOffset(HighCutOffset); - break; - - case 190: - tftPrint(1, String(LowLevelSet, DEC), 145, 118, BackgroundColor, BackgroundColor, FONT28); - LowLevelSet++; - if (LowLevelSet > 30) LowLevelSet = -15; - tftPrint(1, String(LowLevelSet, DEC), 145, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 210: - tftPrint(1, String(ContrastSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - ContrastSet ++; - if (ContrastSet > 100) ContrastSet = 1; - tftPrint(1, String(ContrastSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); - break; - } - break; - - case 2: - switch (menuoption) { - case 30: - tftPrint(0, myLanguage[language][0], 155, 118, BackgroundColor, BackgroundColor, FONT28); - language ++; - if (language == (sizeof (myLanguage) / sizeof (myLanguage[0]))) language = 0; - tftPrint(0, myLanguage[language][0], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 50: - if (showrdserrors) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (showrdserrors) showrdserrors = false; else showrdserrors = true; - if (showrdserrors) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 70: - if (softmutefm) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (softmutefm) softmutefm = false; else softmutefm = true; - if (softmutefm) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setSoftmuteFM(softmutefm); - break; - - case 90: - if (softmuteam) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (softmuteam) softmuteam = false; else softmuteam = true; - if (softmuteam) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setSoftmuteAM(softmuteam); - break; - - case 110: - if (edgebeep) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (edgebeep) edgebeep = false; else edgebeep = true; - if (edgebeep) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 130: - if (region == 0) tftPrint(0, myLanguage[language][47], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (region == 1) tftPrint(0, myLanguage[language][48], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (region == 0) region = 1; else region = 0; - if (region == 0) tftPrint(0, myLanguage[language][47], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (region == 1) tftPrint(0, myLanguage[language][48], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - regionold = region; - if (region == 0) radio.setDeemphasis(1); - if (region == 1) radio.setDeemphasis(2); - radio.rds.region = region; - break; - - case 150: - if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (radio.rds.underscore) radio.rds.underscore = false; else radio.rds.underscore = true; - if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 170: - if (USBmode) tftPrint(0, "RDS Spy", 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, "XDRGTK", 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (USBmode) USBmode = false; else USBmode = true; - if (USBmode) tftPrint(0, "RDS Spy", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, "XDRGTK", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 190: - if (wifi) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (wifi) wifi = false; else wifi = true; - if (wifi) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - } - break; - - case 3: - switch (menuoption) { - case 30: - tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - subnetclient ++; - if (subnetclient > 254) subnetclient = 1; - tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 50: - if (showSWMIBand) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (showSWMIBand) showSWMIBand = false; else showSWMIBand = true; - if (showSWMIBand) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 70: - if (radio.rds.filter) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (radio.rds.filter) radio.rds.filter = false; else radio.rds.filter = true; - if (radio.rds.filter) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 90: - if (radio.rds.pierrors) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (radio.rds.pierrors) radio.rds.pierrors = false; else radio.rds.pierrors = true; - if (radio.rds.pierrors) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 110: - if (showsquelch) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (showsquelch) showsquelch = false; else showsquelch = true; - if (showsquelch) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 130: - if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (showmodulation) showmodulation = false; else showmodulation = true; - if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 150: - if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (amnb != 0) tftPrint(-1, "%", 170, 118, BackgroundColor, BackgroundColor, FONT28); - amnb ++; - if (amnb > 150 || amnb <= 50) { - if (amnb == 1) amnb = 50; else amnb = 0; - } - if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (amnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setAMNoiseBlanker(amnb); - break; - - case 170: - if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (fmnb != 0) tftPrint(-1, "%", 170, 118, BackgroundColor, BackgroundColor, FONT28); - fmnb ++; - if (fmnb > 150 || fmnb <= 50) { - if (fmnb == 1) fmnb = 50; else fmnb = 0; - } - if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (fmnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setFMNoiseBlanker(fmnb); - break; - - case 190: - if (audiomode) tftPrint(0, "MPX", 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, "Stereo", 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (audiomode) audiomode = false; else audiomode = true; - if (audiomode) tftPrint(0, "MPX", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, "Stereo", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setAudio(audiomode); - break; - - case 210: - if (touchrotating) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (touchrotating) touchrotating = 0; else touchrotating = 1; - if (touchrotating) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - } - break; - - case 4: - switch (menuoption) { - case 30: - CurrentTheme ++; - if (CurrentTheme > 10) 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, FONT28); - tftPrint(0, CurrentThemeString, 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 70: - switch (poweroptionsold) { - case DEEP_SLEEP: tftPrint(0, myLanguage[language][75], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case LCD_BRIGHTNESS_1_PERCENT: tftPrint(0, myLanguage[language][94], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case LCD_BRIGHTNESS_A_QUARTER: tftPrint(0, myLanguage[language][95], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case LCD_BRIGHTNESS_HALF: tftPrint(0, myLanguage[language][96], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - } - - poweroptions++; - if (poweroptions > RADIO_POWER_MODE_CNT - 1) poweroptions = 0; - - switch (poweroptions) { - case DEEP_SLEEP: tftPrint(0, myLanguage[language][75], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case LCD_BRIGHTNESS_1_PERCENT: tftPrint(0, myLanguage[language][94], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case LCD_BRIGHTNESS_A_QUARTER: tftPrint(0, myLanguage[language][95], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case LCD_BRIGHTNESS_HALF: tftPrint(0, myLanguage[language][96], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - } - poweroptionsold = poweroptions; - break; - - case 90: - if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (fmdefaultstepsize) fmdefaultstepsize = 0; else fmdefaultstepsize = 1; - if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 110: - if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, BackgroundColor, BackgroundColor, FONT28); - if (!screensaverset) tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, BackgroundColor, BackgroundColor, FONT28); - screensaverset ++; - if (screensaverset > sizeof(screensaverOptions) / sizeof(screensaverOptions[0]) - 1) screensaverset = 0; - if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (!screensaverset) tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 130: - if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(AMLevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - AMLevelOffset++; - if (AMLevelOffset > 15) AMLevelOffset = -50; - if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(AMLevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setAMOffset(AMLevelOffset); - break; - - case 150: - tftPrint(0, String(unitString[unit]), 155, 118, BackgroundColor, BackgroundColor, FONT28); - unit ++; - if (unit > 2) unit = 0; - tftPrint(0, String(unitString[unit]), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 170: - if (af) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (af) af = false; else af = true; - if (af) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 190: - ShowBandSelectionFM(true, REVERSE); - bandFM++; - if (bandFM > FM_BAND_CNT - 1) bandFM = FM_BAND_ALL; - ShowBandSelectionFM(true, true); - break; - - case 210: - ShowBandSelectionAM(true, REVERSE); - bandAM++; - if (bandAM > AM_BAND_CNT - 1) bandAM = AM_BAND_ALL; - ShowBandSelectionAM(true, true); - break; - - } - break; - - case 5: - switch (menuoption) { - case 30: - switch (hardwaremodelold) { - case BASE_ILI9341: tftPrint(0, myLanguage[language][109], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case PORTABLE_ILI9341: tftPrint(0, myLanguage[language][110], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case PORTABLE_TOUCH_ILI9341: tftPrint(0, myLanguage[language][111], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - } - - hardwaremodel++; - if (hardwaremodel > RADIO_HARDWARE_CNT - 1) hardwaremodel = 0; - - switch (hardwaremodel) { - case BASE_ILI9341: tftPrint(0, myLanguage[language][109], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case PORTABLE_ILI9341: tftPrint(0, myLanguage[language][110], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case PORTABLE_TOUCH_ILI9341: tftPrint(0, myLanguage[language][111], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - } - hardwaremodelold = hardwaremodel; - break; - - case 50: - switch (batteryoptionsold) { - case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case BATTERY_VALUE: tftPrint(0, myLanguage[language][174], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case BATTERY_PERCENT: tftPrint(0, myLanguage[language][175], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - } - - batteryoptions++; - if (batteryoptions > RADIO_BATTERY_CNT - 1) batteryoptions = 0; - - switch (batteryoptions) { - case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case BATTERY_VALUE: tftPrint(0, myLanguage[language][174], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case BATTERY_PERCENT: tftPrint(0, myLanguage[language][175], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - } - batteryoptionsold = batteryoptions; - break; - - } - break; - - } - } + MenuUp(); } } } @@ -2795,397 +2098,7 @@ void KeyDown() { ShowFreq(0); store = true; } else { - if (menuopen == false) { - tft.drawRoundRect(8, menuoption + 3, 302, 21, 5, BackgroundColor); - if (hardwaremodel == BASE_ILI9341) { - menuoption -= 20; - if (menuoption < 30) { - menupage--; - if (menupage == 0) menupage = menupagestotal; - menuoption = 210; - BuildMenu(); - } - } else { - menuoption += 20; - if (menuoption > 210) { - menupage++; - if (menupage > menupagestotal) menupage = 1; - menuoption = 30; - BuildMenu(); - } - } - tft.drawRoundRect(8, menuoption + 3, 302, 21, 5, ActiveColor); - } else { - switch (menupage) { - case 1: - switch (menuoption) { - case 30: - if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(VolSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - VolSet--; - if (VolSet < -10) VolSet = -10; - if (VolSet > 10) VolSet = 10; - if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(VolSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setVolume(VolSet); - break; - - case 50: - tftPrint(1, String(ConverterSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - ConverterSet--; - if (ConverterSet < 200 || ConverterSet > 2400) { - if (ConverterSet > 2400) ConverterSet = 2400; else ConverterSet = 0; - } - if (ConverterSet >= 200) { - Wire.beginTransmission(0x12); - Wire.write(ConverterSet >> 8); - Wire.write(ConverterSet & (0xFF)); - Wire.endTransmission(); - } - tftPrint(1, String(ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 70: - tftPrint(1, String(LowEdgeSet / 10 + ConverterSet, DEC) + "." + String(LowEdgeSet % 10 + ConverterSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - LowEdgeSet -= 10; - if (LowEdgeSet < 650) LowEdgeSet = 1079; - tftPrint(1, String(LowEdgeSet / 10 + ConverterSet, DEC) + "." + String(LowEdgeSet % 10 + ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 90: - tftPrint(1, String(HighEdgeSet / 10 + ConverterSet, DEC) + "." + String(HighEdgeSet % 10 + ConverterSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - HighEdgeSet -= 10; - if (HighEdgeSet < 660) HighEdgeSet = 1080; - tftPrint(1, String(HighEdgeSet / 10 + ConverterSet, DEC) + "." + String(HighEdgeSet % 10 + ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - - case 110: - if (LevelOffset > 0) tftPrint(1, "+" + String(LevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(LevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - LevelOffset--; - if (LevelOffset < -25) LevelOffset = 15; - if (LevelOffset > 0) tftPrint(1, "+" + String(LevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(LevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); radio.setOffset(LevelOffset); - change2 = true; - break; - - case 130: - if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, BackgroundColor, BackgroundColor, FONT28); - StereoLevel --; - if (StereoLevel < 30 || StereoLevel > 60) { - if (StereoLevel > 60) StereoLevel = 60; else StereoLevel = 0; - } - if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setStereoLevel(StereoLevel); - break; - - case 150: - tftPrint(1, String(HighCutLevel * 100, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - HighCutLevel --; - if (HighCutLevel < 15 || HighCutLevel > 70) HighCutLevel = 70; - tftPrint(1, String(HighCutLevel * 100, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setHighCutLevel(HighCutLevel); - break; - - case 170: - if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - HighCutOffset --; - if (HighCutOffset < 20 || HighCutOffset > 60) { - if (HighCutOffset > 60) HighCutOffset = 60; else HighCutOffset = 0; - } - if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setHighCutOffset(HighCutOffset); - break; - - case 190: - tftPrint(1, String(LowLevelSet, DEC), 145, 118, BackgroundColor, BackgroundColor, FONT28); - LowLevelSet--; - if (LowLevelSet < -15) LowLevelSet = 30; - tftPrint(1, String(LowLevelSet, DEC), 145, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - - case 210: - tftPrint(1, String(ContrastSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - ContrastSet --; - if (ContrastSet < 1) ContrastSet = 100; - tftPrint(1, String(ContrastSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); - break; - } - break; - - case 2: - switch (menuoption) { - case 30: - tftPrint(0, myLanguage[language][0], 155, 118, BackgroundColor, BackgroundColor, FONT28); - language --; - if (language > (sizeof (myLanguage) / sizeof (myLanguage[0]))) language = (sizeof (myLanguage) / sizeof (myLanguage[0])) - 1; - tftPrint(0, myLanguage[language][0], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 50: - if (showrdserrors) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (showrdserrors) showrdserrors = false; else showrdserrors = true; - if (showrdserrors) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 70: - if (softmutefm) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (softmutefm) softmutefm = false; else softmutefm = true; - if (softmutefm) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setSoftmuteFM(softmutefm); - break; - - case 90: - if (softmuteam) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (softmuteam) softmuteam = false; else softmuteam = true; - if (softmuteam) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setSoftmuteAM(softmuteam); - break; - - case 110: - if (edgebeep) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (edgebeep) edgebeep = false; else edgebeep = true; - if (edgebeep) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 130: - if (region == 0) tftPrint(0, myLanguage[language][47], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (region == 1) tftPrint(0, myLanguage[language][48], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (region == 0) region = 1; else region = 0; - if (region == 0) tftPrint(0, myLanguage[language][47], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (region == 1) tftPrint(0, myLanguage[language][48], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - regionold = region; - if (region == 0) radio.setDeemphasis(1); - if (region == 1) radio.setDeemphasis(2); - radio.rds.region = region; - break; - - case 150: - if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (radio.rds.underscore) radio.rds.underscore = false; else radio.rds.underscore = true; - if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 170: - if (USBmode) tftPrint(0, "RDS Spy", 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, "XDRGTK", 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (USBmode) USBmode = false; else USBmode = true; - if (USBmode) tftPrint(0, "RDS Spy", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, "XDRGTK", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 190: - if (wifi) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (wifi) wifi = false; else wifi = true; - if (wifi) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - } - break; - - case 3: - switch (menuoption) { - case 30: - tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - subnetclient --; - if (subnetclient < 1) subnetclient = 254; - tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 50: - if (showSWMIBand) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (showSWMIBand) showSWMIBand = false; else showSWMIBand = true; - if (showSWMIBand) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 70: - if (radio.rds.filter) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (radio.rds.filter) radio.rds.filter = false; else radio.rds.filter = true; - if (radio.rds.filter) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 90: - if (radio.rds.pierrors) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (radio.rds.pierrors) radio.rds.pierrors = false; else radio.rds.pierrors = true; - if (radio.rds.pierrors) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 110: - if (showsquelch) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (showsquelch) showsquelch = false; else showsquelch = true; - if (showsquelch) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 130: - if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (showmodulation) showmodulation = false; else showmodulation = true; - if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 150: - if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (amnb != 0) tftPrint(-1, "%", 170, 118, BackgroundColor, BackgroundColor, FONT28); - amnb --; - if (amnb > 150 || amnb <= 50) { - if (amnb > 150) amnb = 150; else amnb = 0; - } - if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (amnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setAMNoiseBlanker(amnb); - break; - - case 170: - if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (fmnb != 0) tftPrint(-1, "%", 170, 118, BackgroundColor, BackgroundColor, FONT28); - fmnb --; - if (fmnb > 150 || fmnb <= 50) { - if (fmnb > 150) fmnb = 150; else fmnb = 0; - } - if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - if (fmnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setFMNoiseBlanker(fmnb); - break; - - case 190: - if (audiomode) tftPrint(0, "MPX", 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, "Stereo", 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (audiomode) audiomode = false; else audiomode = true; - if (audiomode) tftPrint(0, "MPX", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, "Stereo", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setAudio(audiomode); - break; - case 210: - if (touchrotating) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (touchrotating) touchrotating = 0; else touchrotating = 1; - if (touchrotating) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - } - break; - case 4: - switch (menuoption) { - case 30: - CurrentTheme --; - if (CurrentTheme > 10) CurrentTheme = 10; - 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, FONT28); - tftPrint(0, CurrentThemeString, 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 70: - switch (poweroptionsold) { - case DEEP_SLEEP: tftPrint(0, myLanguage[language][75], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case LCD_BRIGHTNESS_1_PERCENT: tftPrint(0, myLanguage[language][94], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case LCD_BRIGHTNESS_A_QUARTER: tftPrint(0, myLanguage[language][95], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case LCD_BRIGHTNESS_HALF: tftPrint(0, myLanguage[language][96], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - } - - poweroptions--; - if (poweroptions > RADIO_POWER_MODE_CNT - 1) poweroptions = RADIO_POWER_MODE_CNT - 1; - - switch (poweroptions) { - case DEEP_SLEEP: tftPrint(0, myLanguage[language][75], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case LCD_BRIGHTNESS_1_PERCENT: tftPrint(0, myLanguage[language][94], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case LCD_BRIGHTNESS_A_QUARTER: tftPrint(0, myLanguage[language][95], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case LCD_BRIGHTNESS_HALF: tftPrint(0, myLanguage[language][96], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - } - poweroptionsold = poweroptions; - break; - - case 90: - if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (fmdefaultstepsize) fmdefaultstepsize = 0; else fmdefaultstepsize = 1; - if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 110: - if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, BackgroundColor, BackgroundColor, FONT28); - if (!screensaverset) tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, BackgroundColor, BackgroundColor, FONT28); - 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, FONT28); - if (!screensaverset) tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 130: - if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(AMLevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); - AMLevelOffset--; - if (AMLevelOffset < -50) AMLevelOffset = 15; - if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(AMLevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - radio.setAMOffset(AMLevelOffset); - break; - - case 150: - tftPrint(0, String(unitString[unit]), 155, 118, BackgroundColor, BackgroundColor, FONT28); - unit --; - if (unit > 2) unit = 2; - tftPrint(0, String(unitString[unit]), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 170: - if (af) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); - if (af) af = false; else af = true; - if (af) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); - break; - - case 190: - ShowBandSelectionFM(true, REVERSE); - bandFM--; - if (bandFM > FM_BAND_CNT) bandFM = FM_BAND_FM; - ShowBandSelectionFM(true, true); - break; - - case 210: - ShowBandSelectionAM(true, REVERSE); - bandAM--; - if (bandAM > AM_BAND_CNT) bandAM = AM_BAND_SW; - ShowBandSelectionAM(true, true); - break; - - } - break; - - case 5: - switch (menuoption) { - case 30: - switch (hardwaremodelold) { - case BASE_ILI9341: tftPrint(0, myLanguage[language][109], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case PORTABLE_ILI9341: tftPrint(0, myLanguage[language][110], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case PORTABLE_TOUCH_ILI9341: tftPrint(0, myLanguage[language][111], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - } - - hardwaremodel--; - if (hardwaremodel > RADIO_HARDWARE_CNT - 1) hardwaremodel = RADIO_HARDWARE_CNT - 1; - - switch (hardwaremodel) { - case BASE_ILI9341: tftPrint(0, myLanguage[language][109], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case PORTABLE_ILI9341: tftPrint(0, myLanguage[language][110], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case PORTABLE_TOUCH_ILI9341: tftPrint(0, myLanguage[language][111], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - } - hardwaremodelold = hardwaremodel; - break; - - case 50: - switch (batteryoptionsold) { - case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case BATTERY_VALUE: tftPrint(0, myLanguage[language][174], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - case BATTERY_PERCENT: tftPrint(0, myLanguage[language][175], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; - } - - batteryoptions--; - if (batteryoptions > RADIO_BATTERY_CNT - 1) batteryoptions = RADIO_BATTERY_CNT - 1; - - switch (batteryoptions) { - case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case BATTERY_VALUE: tftPrint(0, myLanguage[language][174], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - case BATTERY_PERCENT: tftPrint(0, myLanguage[language][175], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; - } - batteryoptionsold = batteryoptions; - break; - } - break; - - } - } + MenuDown(); } } } @@ -3799,154 +2712,6 @@ void showRadioText() { RTold = radio.rds.stationText + " " + radio.rds.stationText32; } -void BuildMenu() { - advancedRDS = false; - tft.fillScreen(BackgroundColor); - tft.drawRect(0, 0, 320, 240, FrameColor); - tft.drawLine(0, 23, 320, 23, FrameColor); - tftPrint(-1, myLanguage[language][41], 4, 7, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, String(menupage) + "/" + String(menupagestotal), 314, 7, ActiveColor, ActiveColorSmooth, FONT16); - tft.drawRoundRect(8, menuoption + 3, 302, 21, 5, ActiveColor); - switch (menupage) { - case 1: - tftPrint(1, "dB", 305, 36, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, "MHz", 305, 56, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, "MHz", 305, 76, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, "MHz", 305, 96, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, "dB", 305, 116, ActiveColor, ActiveColorSmooth, FONT16); - if (StereoLevel != 0) tftPrint(1, "dBμV", 305, 136, ActiveColor, ActiveColorSmooth, FONT16); - if (HighCutLevel != 0) tftPrint(1, "Hz", 305, 156, ActiveColor, ActiveColorSmooth, FONT16); - if (HighCutOffset != 0) tftPrint(1, "dBμV", 305, 176, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, "dBμV", 305, 196, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, "%", 305, 216, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][20], 14, 36, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][21], 14, 56, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][22], 14, 76, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][23], 14, 96, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][24], 14, 116, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][25], 14, 136, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][26], 14, 156, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][27], 14, 176, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][28], 14, 196, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][29], 14, 216, ActiveColor, ActiveColorSmooth, FONT16); - - if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 265, 36, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, String(VolSet, DEC), 265, 36, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, String(ConverterSet, DEC), 265, 56, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, String(LowEdgeSet / 10 + ConverterSet, DEC) + "." + String(LowEdgeSet % 10 + ConverterSet, DEC), 265, 76, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, String(HighEdgeSet / 10 + ConverterSet, DEC) + "." + String(HighEdgeSet % 10 + ConverterSet, DEC), 265, 96, PrimaryColor, PrimaryColorSmooth, FONT16); - if (LevelOffset > 0) tftPrint(1, "+" + String(LevelOffset, DEC), 265, 116, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, String(LevelOffset, DEC), 265, 116, PrimaryColor, PrimaryColorSmooth, FONT16); - if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 265, 136, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 136, PrimaryColor, PrimaryColorSmooth, FONT16); - if (HighCutLevel != 0) tftPrint(1, String(HighCutLevel * 100, DEC), 265, 156, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 156, PrimaryColor, PrimaryColorSmooth, FONT16); - if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 265, 176, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 176, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, String(LowLevelSet, DEC), 265, 196, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, String(ContrastSet, DEC), 265, 216, PrimaryColor, PrimaryColorSmooth, FONT16); - break; - - case 2: - tftPrint(-1, myLanguage[language][39], 14, 36, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][38], 14, 56, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][43], 14, 76, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][44], 14, 96, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][45], 14, 116, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][46], 14, 136, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][49], 14, 156, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][50], 14, 176, ActiveColor, ActiveColorSmooth, FONT16); - if (wifi) tftPrint(-1, String(myLanguage[language][51]) + " IP: " + String(WiFi.localIP().toString()), 14, 196, ActiveColor, ActiveColorSmooth, FONT16); else tftPrint(-1, myLanguage[language][51], 14, 196, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][52], 14, 216, ActiveColor, ActiveColorSmooth, FONT16); - - tftPrint(1, myLanguage[language][0], 305, 36, PrimaryColor, PrimaryColorSmooth, FONT16); - if (showrdserrors) tftPrint(1, myLanguage[language][42], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); - if (softmutefm) tftPrint(1, myLanguage[language][42], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); - if (softmuteam) tftPrint(1, myLanguage[language][42], 305, 96, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 96, PrimaryColor, PrimaryColorSmooth, FONT16); - if (edgebeep) tftPrint(1, myLanguage[language][42], 305, 116, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 116, PrimaryColor, PrimaryColorSmooth, FONT16); - if (region == 0) tftPrint(1, myLanguage[language][47], 305, 136, PrimaryColor, PrimaryColorSmooth, FONT16); - if (region == 1) tftPrint(1, myLanguage[language][48], 305, 136, PrimaryColor, PrimaryColorSmooth, FONT16); - if (radio.rds.underscore) tftPrint(1, myLanguage[language][42], 305, 156, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 156, PrimaryColor, PrimaryColorSmooth, FONT16); - if (USBmode) tftPrint(1, "RDS Spy", 305, 176, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, "XDRGTK", 305, 176, PrimaryColor, PrimaryColorSmooth, FONT16); - if (wifi) tftPrint(1, myLanguage[language][42], 305, 196, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 196, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, ">", 305, 216, PrimaryColor, PrimaryColorSmooth, FONT16); - break; - - case 3: - tftPrint(-1, myLanguage[language][58], 14, 36, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][59], 14, 56, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][60], 14, 76, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][61], 14, 96, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][62], 14, 116, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][63], 14, 136, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][64], 14, 156, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][65], 14, 176, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][67], 14, 196, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][68], 14, 216, ActiveColor, ActiveColorSmooth, FONT16); - - if (amnb != 0) tftPrint(1, "%", 305, 156, ActiveColor, ActiveColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 156, ActiveColor, ActiveColorSmooth, FONT16); - if (fmnb != 0) tftPrint(1, "%", 305, 176, ActiveColor, ActiveColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 176, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 305, 36, PrimaryColor, PrimaryColorSmooth, FONT16); - if (showSWMIBand) tftPrint(1, myLanguage[language][42], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); - if (radio.rds.filter) tftPrint(1, myLanguage[language][42], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); - if (radio.rds.pierrors) tftPrint(1, myLanguage[language][42], 305, 96, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 96, PrimaryColor, PrimaryColorSmooth, FONT16); - if (showsquelch) tftPrint(1, myLanguage[language][42], 305, 116, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 116, PrimaryColor, PrimaryColorSmooth, FONT16); - if (showmodulation) tftPrint(1, myLanguage[language][42], 305, 136, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 136, PrimaryColor, PrimaryColorSmooth, FONT16); - if (amnb != 0) tftPrint(1, String(amnb, DEC), 265, 156, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 156, PrimaryColor, PrimaryColorSmooth, FONT16); - if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 265, 176, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 176, PrimaryColor, PrimaryColorSmooth, FONT16); - if (audiomode) tftPrint(1, "MPX", 305, 196, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, "Stereo", 305, 196, PrimaryColor, PrimaryColorSmooth, FONT16); - if (touchrotating) tftPrint(1, myLanguage[language][42], 305, 216, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 216, PrimaryColor, PrimaryColorSmooth, FONT16); - break; - - case 4: - tftPrint(-1, myLanguage[language][77], 14, 36, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][70], 14, 56, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][74], 14, 76, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][90], 14, 96, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][91], 14, 116, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][97], 14, 136, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][98], 14, 156, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][99], 14, 176, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][100], 14, 196, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][101], 14, 216, ActiveColor, ActiveColorSmooth, FONT16); - - tftPrint(1, "KHz", 305, 96, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, "dB", 305, 136, ActiveColor, ActiveColorSmooth, FONT16); - if (screensaverset) tftPrint(1, myLanguage[language][92], 305, 116, ActiveColor, ActiveColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 116, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, CurrentThemeString, 305, 36, PrimaryColor, PrimaryColorSmooth, FONT16); - - switch (poweroptions) { - case DEEP_SLEEP: tftPrint(1, myLanguage[language][75], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); break; - case LCD_OFF: tftPrint(1, myLanguage[language][76], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); break; - case LCD_BRIGHTNESS_1_PERCENT: tftPrint(1, myLanguage[language][94], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); break; - case LCD_BRIGHTNESS_A_QUARTER: tftPrint(1, myLanguage[language][95], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); break; - case LCD_BRIGHTNESS_HALF: tftPrint(1, myLanguage[language][96], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); break; - } - - if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 265, 96, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 265, 96, PrimaryColor, PrimaryColorSmooth, FONT16); - if (screensaverset) tftPrint(1, String(screensaverOptions[screensaverset], DEC), 265, 116, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 116, PrimaryColor, PrimaryColorSmooth, FONT16); - if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 265, 136, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, String(AMLevelOffset, DEC), 265, 136, PrimaryColor, PrimaryColorSmooth, FONT16); - if (af) tftPrint(1, myLanguage[language][42], 305, 176, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 176, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(1, unitString[unit], 305, 156, PrimaryColor, PrimaryColorSmooth, FONT16); - ShowBandSelectionFM(false, true); - ShowBandSelectionAM(false, true); - break; - - case 5: - tftPrint(-1, myLanguage[language][108], 14, 36, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][173], 14, 56, ActiveColor, ActiveColorSmooth, FONT16); - - switch (hardwaremodel) { - case BASE_ILI9341: tftPrint(1, myLanguage[language][109], 305, 36, PrimaryColor, PrimaryColorSmooth, FONT16); break; - case PORTABLE_ILI9341: tftPrint(1, myLanguage[language][110 ], 305, 36, PrimaryColor, PrimaryColorSmooth, FONT16); break; - case PORTABLE_TOUCH_ILI9341: tftPrint(1, myLanguage[language][111], 305, 36, PrimaryColor, PrimaryColorSmooth, FONT16); break; - } - switch (batteryoptions) { - case BATTERY_NONE: tftPrint(1, myLanguage[language][30], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); break; - case BATTERY_VALUE: tftPrint(1, myLanguage[language][174], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); break; - case BATTERY_PERCENT: tftPrint(1, myLanguage[language][175], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); break; - } - break; - - } - analogWrite(SMETERPIN, 0); -} - void MuteScreen(bool setting) { if (!setting && screenmute) { screenmute = false; @@ -4031,289 +2796,6 @@ void ShowAFEON() { } } -void BuildAFScreen() { - if (!afscreen && RDSstatus) { - tft.drawRoundRect(20, 30, 274, 170, 5, ActiveColor); - tft.fillRoundRect(22, 32, 270, 166, 5, BackgroundColor); - tftPrint(0, myLanguage[language][34], 155, 98, ActiveColor, ActiveColorSmooth, FONT28); - radio.TestAFEON(); - } - afscreen = true; - advancedRDS = false; - if (theme == 0) { - tft.fillScreen(BackgroundColor); - tft.drawRect(0, 0, 320, 240, FrameColor); - tft.drawLine(0, 30, 320, 30, FrameColor); - tft.drawLine(0, 199, 320, 199, FrameColor); - tft.drawLine(0, 218, 320, 218, FrameColor); - tft.drawLine(168, 30, 168, 199, FrameColor); - tft.drawLine(108, 30, 108, 0, FrameColor); - tft.drawLine(137, 30, 137, 0, FrameColor); - tft.drawLine(175, 30, 175, 0, FrameColor); - tft.drawLine(268, 30, 268, 0, FrameColor); - tftPrint(-1, "kHz", 222, 4, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(0, myLanguage[language][93], 160, 222, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][88], 184, 48, PrimaryColor, PrimaryColorSmooth, FONT16); - tftPrint(-1, myLanguage[language][87], 6, 48, PrimaryColor, PrimaryColorSmooth, FONT16); - - for (byte i = 0; i < 20; i++) mappedfreqold[i] = 0; - RDSstatusold = false; - ShowFreq(0); - Stereostatusold = false; - haseonold = false; - hasafold = false; - BWreset = true; - SStatusold = 2000; - rssiold = 2000; - batteryold = 6; - af_counterold = 254; - strcpy(radioIdPrevious, "0"); - programServicePrevious = "0"; - for (byte i = 0; i < 11; i++) eonpsold[i] = ""; - } -} - -void BuildAdvancedRDS() { - afscreen = false; - afpage = false; - afpagenr = 0; - advancedRDS = true; - ScreensaverTimerSet(OFF); - if (theme == 0) { - tft.fillScreen(BackgroundColor); - tft.drawRect(0, 0, 320, 240, FrameColor); - tft.drawLine(0, 30, 320, 30, FrameColor); - tft.drawLine(0, 68, 320, 68, FrameColor); - tft.drawLine(0, 104, 320, 104, FrameColor); - tft.drawLine(0, 126, 320, 126, FrameColor); - tft.drawLine(64, 30, 64, 0, FrameColor); - tft.drawLine(210, 30, 210, 240, FrameColor); - tft.drawLine(108, 30, 108, 0, FrameColor); - tft.drawLine(137, 30, 137, 0, FrameColor); - tft.drawLine(175, 30, 175, 0, FrameColor); - tft.drawLine(268, 30, 268, 0, FrameColor); - tft.drawLine(0, 140, 210, 140, FrameColor); - tft.drawLine(0, 166, 210, 166, FrameColor); - tft.drawLine(0, 193, 210, 193, FrameColor); - tft.drawLine(210, 191, 320, 191, FrameColor); - tft.drawLine(0, 217, 210, 217, FrameColor); - tft.drawRect(0, 0, 320, 240, FrameColor); - - tftPrint(-1, "ERRORS", 3, 34, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, unitString[unit], 310, 51, ActiveColor, ActiveColorSmooth, FONT16); - if (region == 0) tftPrint(-1, "PI", 216, 81, ActiveColor, ActiveColorSmooth, FONT16); - if (region == 1) tftPrint(-1, "ID", 216, 81, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "PS", 3, 81, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "PTY", 3, 109, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "RT+", 3, 147, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "AF", 3, 199, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "EON", 3, 174, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "RT", 3, 222, ActiveColor, ActiveColorSmooth, FONT16); - - tftPrint(-1, "A:", 66, 34, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "B:", 104, 34, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "C:", 142, 34, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "D:", 180, 34, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "ECC", 214, 193, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "LIC", 214, 208, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "PIN", 214, 223, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, "Dynamic PTY", 300, 130, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, "Artif. head", 300, 145, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, "Compressed", 300, 160, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, "Has stereo", 300, 175, ActiveColor, ActiveColorSmooth, FONT16); - - tft.fillCircle(86, 41, 5, SignificantColor); - tft.fillCircle(124, 41, 5, SignificantColor); - tft.fillCircle(162, 41, 5, SignificantColor); - tft.fillCircle(200, 41, 5, SignificantColor); - - tft.fillCircle(310, 137, 5, SignificantColor); - tft.fillCircle(310, 153, 5, SignificantColor); - tft.fillCircle(310, 168, 5, SignificantColor); - tft.fillCircle(310, 183, 5, SignificantColor); - - for (int i = 0; i < 33; i++) tft.fillCircle((6 * i) + 10, 133, 2, GreyoutColor); - - tftPrint(-1, "kHz", 222, 4, ActiveColor, ActiveColorSmooth, FONT28); - - tft.drawCircle(81, 15, 10, GreyoutColor); - tft.drawCircle(81, 15, 9, GreyoutColor); - tft.drawCircle(91, 15, 10, GreyoutColor); - tft.drawCircle(91, 15, 9, GreyoutColor); - tft.drawBitmap(139, 5, RDSLogo, 35, 22, GreyoutColor); - - if (StereoToggle == false) { - tft.drawCircle(86, 15, 10, SecondaryColor); - tft.drawCircle(86, 15, 9, SecondaryColor); - } - - if (radio.rds.hasCT) tftPrint(1, rds_clockold, 205, 109, SecondaryColor, SecondaryColorSmooth, FONT16); - tftPrint(-1, "TP", 6, 51, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "TA", 28, 51, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "AF", 50, 51, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "CT", 72, 51, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "TMC", 90, 51, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "RT+", 124, 51, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "EON", 153, 51, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "M", 185, 51, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "S", 198, 51, GreyoutColor, BackgroundColor, FONT16); - } - - RDSstatusold = false; - ShowFreq(0); - Stereostatusold = false; - SStatusold = 2000; - SStatus = 100; - rssiold = 2000; - rdsblockold = 33; - batteryold = 6; - - strcpy(programTypePrevious, "0"); - strcpy(radioIdPrevious, "0"); - programServicePrevious = "0"; - ptynold = ""; - MSold = 0; - ECCold = 254; - licold = 254; - af_counterold = 254; - TAold = false; - TPold = false; - hastmcold = false; - errorAold = true; - errorBold = true; - errorCold = true; - errorDold = true; - dynamicPTYold = false; - artheadold = false; - compressedold = false; - rdsstereoold = false; - hasafold = false; - haseonold = false; - BWreset = true; - pinstringold = ""; - ShowMemoryPos(); -} - -void BuildDisplay() { - afscreen = false; - advancedRDS = false; - int bandColor; - if (theme == 0) { - tft.fillScreen(BackgroundColor); - tft.drawRect(0, 0, 320, 240, FrameColor); - tft.drawLine(0, 30, 320, 30, FrameColor); - tft.drawLine(0, 100, 320, 100, FrameColor); - tft.drawLine(64, 30, 64, 0, FrameColor); - tft.drawLine(210, 100, 210, 217, FrameColor); - tft.drawLine(268, 30, 268, 0, FrameColor); - tft.drawLine(0, 160, 210, 160, FrameColor); - tft.drawLine(0, 180, 320, 180, FrameColor); - tft.drawLine(0, 217, 320, 217, FrameColor); - tft.drawLine(108, 30, 108, 0, FrameColor); - tft.drawLine(137, 30, 137, 0, FrameColor); - tft.drawLine(175, 30, 175, 0, FrameColor); - tft.drawLine(20, 114, 204, 114, TFT_DARKGREY); - if (!showmodulation) tft.drawLine(20, 143, 204, 143, GreyoutColor); else tft.drawLine(20, 143, 204, 143, TFT_DARKGREY); - for (byte segments = 0; segments < 94; segments++) { - if (segments > 54) { - if (((segments - 53) % 10) == 0) { - tft.fillRect(16 + (2 * segments), 112, 2, 2, BarSignificantColor); - if (!showmodulation) tft.fillRect(16 + (2 * segments), 141, 2, 2, GreyoutColor); else tft.fillRect(16 + (2 * segments), 141, 2, 2, BarSignificantColor); - } - } else { - if (((segments + 1) % 6) == 0) { - tft.fillRect(16 + (2 * segments), 112, 2, 2, BarInsignificantColor); - if (!showmodulation) tft.fillRect(16 + (2 * segments), 141, 2, 2, GreyoutColor); else tft.fillRect(16 + (2 * segments), 141, 2, 2, BarInsignificantColor); - } - } - } - if (showsquelch) tftPrint(-1, "SQ:", 212, 145, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(1, "C/N", 270, 163, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "dB", 300, 163, ActiveColor, ActiveColorSmooth, FONT16); - if (region == 0) tftPrint(-1, "PI:", 216, 193, ActiveColor, ActiveColorSmooth, FONT16); - if (region == 1) tftPrint(-1, "ID:", 216, 193, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "PS:", 6, 193, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "RT:", 6, 221, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "PTY:", 6, 163, ActiveColor, ActiveColorSmooth, FONT16); - - tftPrint(0, "S", 7, 103, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "1", 24, 115, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "3", 48, 115, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "5", 72, 115, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "7", 96, 115, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "9", 120, 115, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "+10", 134, 115, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "+30", 174, 115, ActiveColor, ActiveColorSmooth, FONT16); - - if (!showmodulation) { - tftPrint(0, "M", 7, 132, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "10", 27, 144, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "30", 57, 144, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "50", 87, 144, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "70", 117, 144, GreyoutColor, BackgroundColor, FONT16); - tftPrint(-1, "100", 164, 144, GreyoutColor, BackgroundColor, FONT16); - } else { - tftPrint(0, "M", 7, 132, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "10", 27, 144, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "30", 57, 144, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "50", 87, 144, ActiveColor, ActiveColorSmooth, FONT16); - tftPrint(-1, "70", 117, 144, ActiveColor, BackgroundColor, FONT16); - tftPrint(-1, "100", 164, 144, ActiveColor, ActiveColorSmooth, FONT16); - } - - tftPrint(-1, "kHz", 222, 4, ActiveColor, ActiveColorSmooth, FONT28); - tftPrint(-1, unitString[unit], 282, 145, ActiveColor, ActiveColorSmooth, FONT16); - - if (band < BAND_GAP) tftPrint(-1, "MHz", 258, 76, ActiveColor, ActiveColorSmooth, FONT28); else tftPrint(-1, "kHz", 258, 76, ActiveColor, ActiveColorSmooth, FONT28); - - tft.drawRoundRect(248, 56, 32, 20, 5, GreyoutColor); - if (band > BAND_GAP) tftPrint(0, "iMS", 265, 59, GreyoutColor, BackgroundColor, FONT16); - tft.drawRoundRect(286, 56, 32, 20, 5, GreyoutColor); - if (band > BAND_GAP) tftPrint(0, "EQ", 303, 59, GreyoutColor, BackgroundColor, FONT16); - - tft.drawCircle(81, 15, 10, GreyoutColor); - tft.drawCircle(81, 15, 9, GreyoutColor); - tft.drawCircle(91, 15, 10, GreyoutColor); - tft.drawCircle(91, 15, 9, GreyoutColor); - tft.drawBitmap(139, 5, RDSLogo, 35, 22, GreyoutColor); - if (StereoToggle == false) { - tft.drawCircle(86, 15, 10, SecondaryColor); - tft.drawCircle(86, 15, 9, SecondaryColor); - } - - if (bandforbidden) bandColor = GreyoutColor; else bandColor = SecondaryColor; - switch (band) { - case BAND_LW: tftPrint(-1, myLanguage[language][102], 70, 32, bandColor, SecondaryColorSmooth, FONT16); break; - case BAND_MW: tftPrint(-1, myLanguage[language][103], 70, 32, bandColor, SecondaryColorSmooth, FONT16); break; - case BAND_SW: tftPrint(-1, myLanguage[language][104], 70, 32, bandColor, SecondaryColorSmooth, FONT16); break; - case BAND_FM: tftPrint(-1, myLanguage[language][105], 70, 32, bandColor, SecondaryColorSmooth, FONT16); break; - case BAND_OIRT: tftPrint(-1, myLanguage[language][106], 70, 32, bandColor, SecondaryColorSmooth, FONT16); break; - } - } - RDSstatusold = false; - Stereostatusold = false; - LowLevelInit = true; - ShowFreq(0); - ShowTuneMode(); - updateBW(); - ShowStepSize(); - ShowMemoryPos(); - updateiMS(); - updateEQ(); - Squelchold = -2; - SStatusold = 2000; - SStatus = 100; - rssiold = 2000; - SNRold = 254; - af_counterold = 254; - batteryold = 6; - strcpy(programTypePrevious, "0"); - strcpy(radioIdPrevious, "0"); - programServicePrevious = "0"; - BWreset = true; - if (band < BAND_GAP) tftPrint(-1, "MHz", 258, 76, ActiveColor, ActiveColorSmooth, FONT28); else tftPrint(-1, "kHz", 258, 76, ActiveColor, ActiveColorSmooth, FONT28); -} - void ShowFreq(int mode) { resetFontOnNextCall = true; tft.unloadFont(); @@ -4328,7 +2810,7 @@ void ShowFreq(int mode) { if (screenmute == false) { detachInterrupt(digitalPinToInterrupt(ROTARY_PIN_A)); detachInterrupt(digitalPinToInterrupt(ROTARY_PIN_B)); - if (band > BAND_GAP ) { + if (band > BAND_GAP) { unsigned int freq = frequency_AM; String count = String(freq, DEC); if ((setupmode == false && count.length() != freqoldcount) || mode != 0) { @@ -4410,7 +2892,7 @@ void ShowFreq(int mode) { rds_clockold = ""; sprite.fillSprite(BackgroundColor); sprite2.fillSprite(BackgroundColor); - if (advancedRDS) sprite2.pushSprite(35, 220); else sprite.pushSprite(38, 220); + if (advancedRDS) sprite2.pushSprite(35, 220); else if (!afscreen) sprite.pushSprite(38, 220); if (wifi) { Udp.beginPacket(remoteip, 9030); @@ -5088,12 +3570,12 @@ void ShowBattery() { if (!advancedRDS && !afscreen) { if (batteryoptions > BATTERY_NONE) { batteryV = ((float)v / 4095.0) * 2.0 * 3.3 * (vref / 1000.0); - if (batteryoptions == BATTERY_VALUE){ + if (batteryoptions == BATTERY_VALUE) { if (batteryV < BATTERY_LOW_VALUE) return; - tftPrint(-1, String(batteryVold,1), 213, 163, BackgroundColor, BackgroundColor, FONT16); - - tftPrint(-1, String(batteryV,1), 213, 163, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(-1, String(batteryVold, 1), 213, 163, BackgroundColor, BackgroundColor, FONT16); + + tftPrint(-1, String(batteryV, 1), 213, 163, PrimaryColor, PrimaryColorSmooth, FONT16); tftPrint(-1, "V", 232, 163, PrimaryColor, PrimaryColorSmooth, FONT16); batteryVold = batteryV; } else if (batteryoptions == BATTERY_PERCENT) { diff --git a/src/TEF6686.h b/src/TEF6686.h index fb9e528..69a85e3 100644 --- a/src/TEF6686.h +++ b/src/TEF6686.h @@ -1,4 +1,5 @@ -#define TEF6686_h +#ifndef TEF6686_H +#define TEF6686_H #include "Arduino.h" #include "Tuner_Drv_Lithio.h" @@ -281,4 +282,6 @@ class TEF6686 { uint16_t currentfreq; bool togglebit; bool runningbit; -}; \ No newline at end of file +}; + +#endif \ No newline at end of file diff --git a/src/Tuner_Drv_Lithio.h b/src/Tuner_Drv_Lithio.h index 131036f..12583aa 100644 --- a/src/Tuner_Drv_Lithio.h +++ b/src/Tuner_Drv_Lithio.h @@ -1,3 +1,6 @@ +#ifndef TUNER_DRV_LITHIO_H +#define TUNER_DRV_LITHIO_H + typedef enum { TEF_FM = 32, TEF_AM = 33, @@ -104,3 +107,5 @@ bool devTEF_Radio_Set_StHiBlend_Noise(uint8_t mode, uint16_t start, uint16_t slo bool devTEF_Radio_Set_StHiBlend_Mph(uint8_t mode, uint16_t start, uint16_t slope); bool devTEF_Radio_Set_NoisBlanker(uint8_t mode, uint16_t start); bool devTEF_Radio_Set_Wavegen(bool mode, int16_t amplitude, uint16_t freq); + +#endif \ No newline at end of file diff --git a/src/gui.cpp b/src/gui.cpp new file mode 100644 index 0000000..4861082 --- /dev/null +++ b/src/gui.cpp @@ -0,0 +1,1538 @@ +#include "gui.h" +#include "language.h" +#include "constants.h" +#include "FONT16.h" +#include "FONT16_CHS.h" +#include "FONT28.h" +#include "FONT28_CHS.h" +#include +#include +#include + +void BuildAFScreen() { + if (!afscreen && RDSstatus) { + tft.drawRoundRect(20, 30, 274, 170, 5, ActiveColor); + tft.fillRoundRect(22, 32, 270, 166, 5, BackgroundColor); + tftPrint(0, myLanguage[language][34], 155, 98, ActiveColor, ActiveColorSmooth, FONT28); + radio.TestAFEON(); + } + afscreen = true; + advancedRDS = false; + if (theme == 0) { + tft.fillScreen(BackgroundColor); + tft.drawRect(0, 0, 320, 240, FrameColor); + tft.drawLine(0, 30, 320, 30, FrameColor); + tft.drawLine(0, 199, 320, 199, FrameColor); + tft.drawLine(0, 218, 320, 218, FrameColor); + tft.drawLine(168, 30, 168, 199, FrameColor); + tft.drawLine(108, 30, 108, 0, FrameColor); + tft.drawLine(137, 30, 137, 0, FrameColor); + tft.drawLine(175, 30, 175, 0, FrameColor); + tft.drawLine(268, 30, 268, 0, FrameColor); + tftPrint(-1, "kHz", 222, 4, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(0, myLanguage[language][93], 160, 222, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][88], 184, 48, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][87], 6, 48, PrimaryColor, PrimaryColorSmooth, FONT16); + for (byte i = 0; i < 20; i++) mappedfreqold[i] = 0; + RDSstatusold = false; + ShowFreq(0); + Stereostatusold = false; + haseonold = false; + hasafold = false; + BWreset = true; + SStatusold = 2000; + rssiold = 2000; + batteryold = 6; + af_counterold = 254; + strcpy(radioIdPrevious, "0"); + programServicePrevious = "0"; + for (byte i = 0; i < 11; i++) eonpsold[i] = ""; + + } +} + +void BuildMenu() { + advancedRDS = false; + tft.fillScreen(BackgroundColor); + tft.drawRect(0, 0, 320, 240, FrameColor); + tft.drawLine(0, 23, 320, 23, FrameColor); + tftPrint(-1, myLanguage[language][41], 4, 7, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, String(menupage) + "/" + String(menupagestotal), 314, 7, ActiveColor, ActiveColorSmooth, FONT16); + tft.drawRoundRect(8, menuoption + 3, 302, 21, 5, ActiveColor); + switch (menupage) { + case 1: + tftPrint(1, "dB", 305, 36, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, "MHz", 305, 56, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, "MHz", 305, 76, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, "MHz", 305, 96, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, "dB", 305, 116, ActiveColor, ActiveColorSmooth, FONT16); + if (StereoLevel != 0) tftPrint(1, "dBμV", 305, 136, ActiveColor, ActiveColorSmooth, FONT16); + if (HighCutLevel != 0) tftPrint(1, "Hz", 305, 156, ActiveColor, ActiveColorSmooth, FONT16); + if (HighCutOffset != 0) tftPrint(1, "dBμV", 305, 176, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, "dBμV", 305, 196, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, "%", 305, 216, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][20], 14, 36, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][21], 14, 56, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][22], 14, 76, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][23], 14, 96, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][24], 14, 116, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][25], 14, 136, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][26], 14, 156, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][27], 14, 176, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][28], 14, 196, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][29], 14, 216, ActiveColor, ActiveColorSmooth, FONT16); + + if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 265, 36, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, String(VolSet, DEC), 265, 36, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, String(ConverterSet, DEC), 265, 56, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, String(LowEdgeSet / 10 + ConverterSet, DEC) + "." + String(LowEdgeSet % 10 + ConverterSet, DEC), 265, 76, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, String(HighEdgeSet / 10 + ConverterSet, DEC) + "." + String(HighEdgeSet % 10 + ConverterSet, DEC), 265, 96, PrimaryColor, PrimaryColorSmooth, FONT16); + if (LevelOffset > 0) tftPrint(1, "+" + String(LevelOffset, DEC), 265, 116, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, String(LevelOffset, DEC), 265, 116, PrimaryColor, PrimaryColorSmooth, FONT16); + if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 265, 136, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 136, PrimaryColor, PrimaryColorSmooth, FONT16); + if (HighCutLevel != 0) tftPrint(1, String(HighCutLevel * 100, DEC), 265, 156, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 156, PrimaryColor, PrimaryColorSmooth, FONT16); + if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 265, 176, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 176, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, String(LowLevelSet, DEC), 265, 196, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, String(ContrastSet, DEC), 265, 216, PrimaryColor, PrimaryColorSmooth, FONT16); + break; + + case 2: + tftPrint(-1, myLanguage[language][39], 14, 36, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][38], 14, 56, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][43], 14, 76, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][44], 14, 96, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][45], 14, 116, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][46], 14, 136, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][49], 14, 156, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][50], 14, 176, ActiveColor, ActiveColorSmooth, FONT16); + if (wifi) tftPrint(-1, String(myLanguage[language][51]) + " IP: " + String(WiFi.localIP().toString()), 14, 196, ActiveColor, ActiveColorSmooth, FONT16); else tftPrint(-1, myLanguage[language][51], 14, 196, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][52], 14, 216, ActiveColor, ActiveColorSmooth, FONT16); + + tftPrint(1, myLanguage[language][0], 305, 36, PrimaryColor, PrimaryColorSmooth, FONT16); + if (showrdserrors) tftPrint(1, myLanguage[language][42], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); + if (softmutefm) tftPrint(1, myLanguage[language][42], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); + if (softmuteam) tftPrint(1, myLanguage[language][42], 305, 96, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 96, PrimaryColor, PrimaryColorSmooth, FONT16); + if (edgebeep) tftPrint(1, myLanguage[language][42], 305, 116, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 116, PrimaryColor, PrimaryColorSmooth, FONT16); + if (region == 0) tftPrint(1, myLanguage[language][47], 305, 136, PrimaryColor, PrimaryColorSmooth, FONT16); + if (region == 1) tftPrint(1, myLanguage[language][48], 305, 136, PrimaryColor, PrimaryColorSmooth, FONT16); + if (radio.rds.underscore) tftPrint(1, myLanguage[language][42], 305, 156, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 156, PrimaryColor, PrimaryColorSmooth, FONT16); + if (USBmode) tftPrint(1, "RDS Spy", 305, 176, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, "XDRGTK", 305, 176, PrimaryColor, PrimaryColorSmooth, FONT16); + if (wifi) tftPrint(1, myLanguage[language][42], 305, 196, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 196, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, ">", 305, 216, PrimaryColor, PrimaryColorSmooth, FONT16); + break; + + case 3: + tftPrint(-1, myLanguage[language][58], 14, 36, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][59], 14, 56, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][60], 14, 76, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][61], 14, 96, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][62], 14, 116, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][63], 14, 136, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][64], 14, 156, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][65], 14, 176, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][67], 14, 196, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][68], 14, 216, ActiveColor, ActiveColorSmooth, FONT16); + + if (amnb != 0) tftPrint(1, "%", 305, 156, ActiveColor, ActiveColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 156, ActiveColor, ActiveColorSmooth, FONT16); + if (fmnb != 0) tftPrint(1, "%", 305, 176, ActiveColor, ActiveColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 176, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 305, 36, PrimaryColor, PrimaryColorSmooth, FONT16); + if (showSWMIBand) tftPrint(1, myLanguage[language][42], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); + if (radio.rds.filter) tftPrint(1, myLanguage[language][42], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); + if (radio.rds.pierrors) tftPrint(1, myLanguage[language][42], 305, 96, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 96, PrimaryColor, PrimaryColorSmooth, FONT16); + if (showsquelch) tftPrint(1, myLanguage[language][42], 305, 116, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 116, PrimaryColor, PrimaryColorSmooth, FONT16); + if (showmodulation) tftPrint(1, myLanguage[language][42], 305, 136, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 136, PrimaryColor, PrimaryColorSmooth, FONT16); + if (amnb != 0) tftPrint(1, String(amnb, DEC), 265, 156, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 156, PrimaryColor, PrimaryColorSmooth, FONT16); + if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 265, 176, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 176, PrimaryColor, PrimaryColorSmooth, FONT16); + if (audiomode) tftPrint(1, "MPX", 305, 196, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, "Stereo", 305, 196, PrimaryColor, PrimaryColorSmooth, FONT16); + if (touchrotating) tftPrint(1, myLanguage[language][42], 305, 216, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 216, PrimaryColor, PrimaryColorSmooth, FONT16); + break; + + case 4: + tftPrint(-1, myLanguage[language][77], 14, 36, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][70], 14, 56, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][74], 14, 76, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][90], 14, 96, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][91], 14, 116, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][97], 14, 136, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][98], 14, 156, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][99], 14, 176, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][100], 14, 196, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][101], 14, 216, ActiveColor, ActiveColorSmooth, FONT16); + + tftPrint(1, "KHz", 305, 96, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, "dB", 305, 136, ActiveColor, ActiveColorSmooth, FONT16); + if (screensaverset) tftPrint(1, myLanguage[language][92], 305, 116, ActiveColor, ActiveColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 116, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, CurrentThemeString, 305, 36, PrimaryColor, PrimaryColorSmooth, FONT16); + + switch (poweroptions) { + case DEEP_SLEEP: tftPrint(1, myLanguage[language][75], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); break; + case LCD_OFF: tftPrint(1, myLanguage[language][76], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); break; + case LCD_BRIGHTNESS_1_PERCENT: tftPrint(1, myLanguage[language][94], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); break; + case LCD_BRIGHTNESS_A_QUARTER: tftPrint(1, myLanguage[language][95], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); break; + case LCD_BRIGHTNESS_HALF: tftPrint(1, myLanguage[language][96], 305, 76, PrimaryColor, PrimaryColorSmooth, FONT16); break; + } + + if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 265, 96, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 265, 96, PrimaryColor, PrimaryColorSmooth, FONT16); + if (screensaverset) tftPrint(1, String(screensaverOptions[screensaverset], DEC), 265, 116, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 116, PrimaryColor, PrimaryColorSmooth, FONT16); + if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 265, 136, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, String(AMLevelOffset, DEC), 265, 136, PrimaryColor, PrimaryColorSmooth, FONT16); + if (af) tftPrint(1, myLanguage[language][42], 305, 176, PrimaryColor, PrimaryColorSmooth, FONT16); else tftPrint(1, myLanguage[language][30], 305, 176, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, unitString[unit], 305, 156, PrimaryColor, PrimaryColorSmooth, FONT16); + ShowBandSelectionFM(false, true); + ShowBandSelectionAM(false, true); + break; + + case 5: + tftPrint(-1, myLanguage[language][108], 14, 36, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, myLanguage[language][173], 14, 56, ActiveColor, ActiveColorSmooth, FONT16); + + switch (hardwaremodel) { + case BASE_ILI9341: tftPrint(1, myLanguage[language][109], 305, 36, PrimaryColor, PrimaryColorSmooth, FONT16); break; + case PORTABLE_ILI9341: tftPrint(1, myLanguage[language][110 ], 305, 36, PrimaryColor, PrimaryColorSmooth, FONT16); break; + case PORTABLE_TOUCH_ILI9341: tftPrint(1, myLanguage[language][111], 305, 36, PrimaryColor, PrimaryColorSmooth, FONT16); break; + } + switch (batteryoptions) { + case BATTERY_NONE: tftPrint(1, myLanguage[language][30], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); break; + case BATTERY_VALUE: tftPrint(1, myLanguage[language][174], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); break; + case BATTERY_PERCENT: tftPrint(1, myLanguage[language][175], 305, 56, PrimaryColor, PrimaryColorSmooth, FONT16); break; + } + break; + + } + analogWrite(SMETERPIN, 0); +} + +void BuildAdvancedRDS() { + afscreen = false; + afpage = false; + afpagenr = 0; + advancedRDS = true; + ScreensaverTimerSet(OFF); + if (theme == 0) { + tft.fillScreen(BackgroundColor); + tft.drawRect(0, 0, 320, 240, FrameColor); + tft.drawLine(0, 30, 320, 30, FrameColor); + tft.drawLine(0, 68, 320, 68, FrameColor); + tft.drawLine(0, 104, 320, 104, FrameColor); + tft.drawLine(0, 126, 320, 126, FrameColor); + tft.drawLine(64, 30, 64, 0, FrameColor); + tft.drawLine(210, 30, 210, 240, FrameColor); + tft.drawLine(108, 30, 108, 0, FrameColor); + tft.drawLine(137, 30, 137, 0, FrameColor); + tft.drawLine(175, 30, 175, 0, FrameColor); + tft.drawLine(268, 30, 268, 0, FrameColor); + tft.drawLine(0, 140, 210, 140, FrameColor); + tft.drawLine(0, 166, 210, 166, FrameColor); + tft.drawLine(0, 193, 210, 193, FrameColor); + tft.drawLine(210, 191, 320, 191, FrameColor); + tft.drawLine(0, 217, 210, 217, FrameColor); + tft.drawRect(0, 0, 320, 240, FrameColor); + + tftPrint(-1, "ERRORS", 3, 34, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, unitString[unit], 310, 51, ActiveColor, ActiveColorSmooth, FONT16); + if (region == 0) tftPrint(-1, "PI", 216, 81, ActiveColor, ActiveColorSmooth, FONT16); + if (region == 1) tftPrint(-1, "ID", 216, 81, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "PS", 3, 81, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "PTY", 3, 109, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "RT+", 3, 147, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "AF", 3, 199, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "EON", 3, 174, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "RT", 3, 222, ActiveColor, ActiveColorSmooth, FONT16); + + tftPrint(-1, "A:", 66, 34, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "B:", 104, 34, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "C:", 142, 34, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "D:", 180, 34, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "ECC", 214, 193, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "LIC", 214, 208, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "PIN", 214, 223, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, "Dynamic PTY", 300, 130, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, "Artif. head", 300, 145, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, "Compressed", 300, 160, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, "Has stereo", 300, 175, ActiveColor, ActiveColorSmooth, FONT16); + + tft.fillCircle(86, 41, 5, SignificantColor); + tft.fillCircle(124, 41, 5, SignificantColor); + tft.fillCircle(162, 41, 5, SignificantColor); + tft.fillCircle(200, 41, 5, SignificantColor); + + tft.fillCircle(310, 137, 5, SignificantColor); + tft.fillCircle(310, 153, 5, SignificantColor); + tft.fillCircle(310, 168, 5, SignificantColor); + tft.fillCircle(310, 183, 5, SignificantColor); + + for (int i = 0; i < 33; i++) tft.fillCircle((6 * i) + 10, 133, 2, GreyoutColor); + + tftPrint(-1, "kHz", 222, 4, ActiveColor, ActiveColorSmooth, FONT28); + + tft.drawCircle(81, 15, 10, GreyoutColor); + tft.drawCircle(81, 15, 9, GreyoutColor); + tft.drawCircle(91, 15, 10, GreyoutColor); + tft.drawCircle(91, 15, 9, GreyoutColor); + tft.drawBitmap(139, 5, RDSLogo, 35, 22, GreyoutColor); + + if (StereoToggle == false) { + tft.drawCircle(86, 15, 10, SecondaryColor); + tft.drawCircle(86, 15, 9, SecondaryColor); + } + + if (radio.rds.hasCT) tftPrint(1, rds_clockold, 205, 109, SecondaryColor, SecondaryColorSmooth, FONT16); + tftPrint(-1, "TP", 6, 51, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "TA", 28, 51, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "AF", 50, 51, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "CT", 72, 51, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "TMC", 90, 51, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "RT+", 124, 51, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "EON", 153, 51, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "M", 185, 51, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "S", 198, 51, GreyoutColor, BackgroundColor, FONT16); + } + + RDSstatusold = false; + ShowFreq(0); + Stereostatusold = false; + SStatusold = 2000; + SStatus = 100; + rssiold = 2000; + rdsblockold = 33; + batteryold = 6; + + strcpy(programTypePrevious, "0"); + strcpy(radioIdPrevious, "0"); + programServicePrevious = "0"; + ptynold = " "; + MSold = 0; + ECCold = 254; + licold = 254; + af_counterold = 254; + TAold = false; + TPold = false; + hastmcold = false; + errorAold = true; + errorBold = true; + errorCold = true; + errorDold = true; + dynamicPTYold = false; + artheadold = false; + compressedold = false; + rdsstereoold = false; + hasafold = false; + haseonold = false; + BWreset = true; + pinstringold = ""; + ShowMemoryPos(); +} + +void BuildDisplay() { + afscreen = false; + advancedRDS = false; + int bandColor; + if (theme == 0) { + tft.fillScreen(BackgroundColor); + tft.drawRect(0, 0, 320, 240, FrameColor); + tft.drawLine(0, 30, 320, 30, FrameColor); + tft.drawLine(0, 100, 320, 100, FrameColor); + tft.drawLine(64, 30, 64, 0, FrameColor); + tft.drawLine(210, 100, 210, 217, FrameColor); + tft.drawLine(268, 30, 268, 0, FrameColor); + tft.drawLine(0, 160, 210, 160, FrameColor); + tft.drawLine(0, 180, 320, 180, FrameColor); + tft.drawLine(0, 217, 320, 217, FrameColor); + tft.drawLine(108, 30, 108, 0, FrameColor); + tft.drawLine(137, 30, 137, 0, FrameColor); + tft.drawLine(175, 30, 175, 0, FrameColor); + tft.drawLine(20, 114, 204, 114, TFT_DARKGREY); + if (!showmodulation) tft.drawLine(20, 143, 204, 143, GreyoutColor); else tft.drawLine(20, 143, 204, 143, TFT_DARKGREY); + for (byte segments = 0; segments < 94; segments++) { + if (segments > 54) { + if (((segments - 53) % 10) == 0) { + tft.fillRect(16 + (2 * segments), 112, 2, 2, BarSignificantColor); + if (!showmodulation) tft.fillRect(16 + (2 * segments), 141, 2, 2, GreyoutColor); else tft.fillRect(16 + (2 * segments), 141, 2, 2, BarSignificantColor); + } + } else { + if (((segments + 1) % 6) == 0) { + tft.fillRect(16 + (2 * segments), 112, 2, 2, BarInsignificantColor); + if (!showmodulation) tft.fillRect(16 + (2 * segments), 141, 2, 2, GreyoutColor); else tft.fillRect(16 + (2 * segments), 141, 2, 2, BarInsignificantColor); + } + } + } + if (showsquelch) tftPrint(-1, "SQ:", 212, 145, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(1, "C/N", 270, 163, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "dB", 300, 163, ActiveColor, ActiveColorSmooth, FONT16); + if (region == 0) tftPrint(-1, "PI:", 216, 193, ActiveColor, ActiveColorSmooth, FONT16); + if (region == 1) tftPrint(-1, "ID:", 216, 193, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "PS:", 6, 193, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "RT:", 6, 221, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "PTY:", 6, 163, ActiveColor, ActiveColorSmooth, FONT16); + + tftPrint(0, "S", 7, 103, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "1", 24, 115, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "3", 48, 115, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "5", 72, 115, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "7", 96, 115, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "9", 120, 115, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "+10", 134, 115, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "+30", 174, 115, ActiveColor, ActiveColorSmooth, FONT16); + + if (!showmodulation) { + tftPrint(0, "M", 7, 132, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "10", 27, 144, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "30", 57, 144, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "50", 87, 144, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "70", 117, 144, GreyoutColor, BackgroundColor, FONT16); + tftPrint(-1, "100", 164, 144, GreyoutColor, BackgroundColor, FONT16); + } else { + tftPrint(0, "M", 7, 132, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "10", 27, 144, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "30", 57, 144, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "50", 87, 144, ActiveColor, ActiveColorSmooth, FONT16); + tftPrint(-1, "70", 117, 144, ActiveColor, BackgroundColor, FONT16); + tftPrint(-1, "100", 164, 144, ActiveColor, ActiveColorSmooth, FONT16); + } + + tftPrint(-1, "kHz", 222, 4, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(-1, unitString[unit], 282, 145, ActiveColor, ActiveColorSmooth, FONT16); + + if (band < BAND_GAP) tftPrint(-1, "MHz", 258, 76, ActiveColor, ActiveColorSmooth, FONT28); else tftPrint(-1, "kHz", 258, 76, ActiveColor, ActiveColorSmooth, FONT28); + + tft.drawRoundRect(248, 56, 32, 20, 5, GreyoutColor); + if (band > BAND_GAP) tftPrint(0, "iMS", 265, 59, GreyoutColor, BackgroundColor, FONT16); + tft.drawRoundRect(286, 56, 32, 20, 5, GreyoutColor); + if (band > BAND_GAP) tftPrint(0, "EQ", 303, 59, GreyoutColor, BackgroundColor, FONT16); + + tft.drawCircle(81, 15, 10, GreyoutColor); + tft.drawCircle(81, 15, 9, GreyoutColor); + tft.drawCircle(91, 15, 10, GreyoutColor); + tft.drawCircle(91, 15, 9, GreyoutColor); + tft.drawBitmap(139, 5, RDSLogo, 35, 22, GreyoutColor); + if (StereoToggle == false) { + tft.drawCircle(86, 15, 10, SecondaryColor); + tft.drawCircle(86, 15, 9, SecondaryColor); + } + + if (bandforbidden) bandColor = GreyoutColor; else bandColor = SecondaryColor; + switch (band) { + case BAND_LW: tftPrint(-1, myLanguage[language][102], 70, 32, bandColor, SecondaryColorSmooth, FONT16); break; + case BAND_MW: tftPrint(-1, myLanguage[language][103], 70, 32, bandColor, SecondaryColorSmooth, FONT16); break; + case BAND_SW: tftPrint(-1, myLanguage[language][104], 70, 32, bandColor, SecondaryColorSmooth, FONT16); break; + case BAND_FM: tftPrint(-1, myLanguage[language][105], 70, 32, bandColor, SecondaryColorSmooth, FONT16); break; + case BAND_OIRT: tftPrint(-1, myLanguage[language][106], 70, 32, bandColor, SecondaryColorSmooth, FONT16); break; + } + } + RDSstatusold = false; + Stereostatusold = false; + LowLevelInit = true; + ShowFreq(0); + ShowTuneMode(); + updateBW(); + ShowStepSize(); + ShowMemoryPos(); + updateiMS(); + updateEQ(); + Squelchold = -2; + SStatusold = 2000; + SStatus = 100; + rssiold = 2000; + SNRold = 254; + af_counterold = 254; + batteryold = 6; + strcpy(programTypePrevious, "0"); + strcpy(radioIdPrevious, "0"); + programServicePrevious = "0"; + BWreset = true; + if (band < BAND_GAP) tftPrint(-1, "MHz", 258, 76, ActiveColor, ActiveColorSmooth, FONT28); else tftPrint(-1, "kHz", 258, 76, ActiveColor, ActiveColorSmooth, FONT28); +} + +void MenuUp() { + if (menuopen == false) { + tft.drawRoundRect(8, menuoption + 3, 302, 21, 5, BackgroundColor); + if (hardwaremodel == BASE_ILI9341) { + menuoption += 20; + if (menuoption > 210) { + menupage++; + if (menupage > menupagestotal) menupage = 1; + menuoption = 30; + BuildMenu(); + } + } else { + menuoption -= 20; + if (menuoption < 30) { + menupage--; + if (menupage == 0) menupage = menupagestotal; + menuoption = 210; + BuildMenu(); + } + } + tft.drawRoundRect(8, menuoption + 3, 302, 21, 5, ActiveColor); + } else { + switch (menupage) { + case 1: + switch (menuoption) { + case 30: + if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(VolSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + VolSet++; + if (VolSet > 10) VolSet = 10; + if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(VolSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setVolume(VolSet); + break; + + case 50: + tftPrint(1, String(ConverterSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + ConverterSet++; + if (ConverterSet > 2400 || ConverterSet <= 200) { + if (ConverterSet == 1) ConverterSet = 200; else ConverterSet = 0; + } + if (ConverterSet >= 200) { + Wire.beginTransmission(0x12); + Wire.write(ConverterSet >> 8); + Wire.write(ConverterSet & (0xFF)); + Wire.endTransmission(); + } + tftPrint(1, String(ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 70: + tftPrint(1, String(LowEdgeSet / 10 + ConverterSet, DEC) + "." + String(LowEdgeSet % 10 + ConverterSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + LowEdgeSet ++; + if (LowEdgeSet > 1070) LowEdgeSet = 650; + tftPrint(1, String(LowEdgeSet / 10 + ConverterSet, DEC) + "." + String(LowEdgeSet % 10 + ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 90: + tftPrint(1, String(HighEdgeSet / 10 + ConverterSet, DEC) + "." + String(HighEdgeSet % 10 + ConverterSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + HighEdgeSet ++; + if (HighEdgeSet > 1080) HighEdgeSet = 660; + tftPrint(1, String(HighEdgeSet / 10 + ConverterSet, DEC) + "." + String(HighEdgeSet % 10 + ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 110: + if (LevelOffset > 0) tftPrint(1, "+" + String(LevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(LevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + LevelOffset++; + if (LevelOffset > 15) LevelOffset = -25; + if (LevelOffset > 0) tftPrint(1, "+" + String(LevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(LevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setOffset(LevelOffset); + change2 = true; + break; + + case 130: + if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, BackgroundColor, BackgroundColor, FONT28); + StereoLevel ++; + if (StereoLevel > 60 || StereoLevel <= 30) { + if (StereoLevel == 1) StereoLevel = 30; else StereoLevel = 0; + } + if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setStereoLevel(StereoLevel); + break; + + case 150: + tftPrint(1, String(HighCutLevel * 100, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + HighCutLevel ++; + if (HighCutLevel > 70) HighCutLevel = 15; + tftPrint(1, String(HighCutLevel * 100, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setHighCutLevel(HighCutLevel); + break; + + case 170: + if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + HighCutOffset ++; + if (HighCutOffset > 60 || HighCutOffset <= 20) { + if (HighCutOffset == 1) HighCutOffset = 20; else HighCutOffset = 0; + } + if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setHighCutOffset(HighCutOffset); + break; + + case 190: + tftPrint(1, String(LowLevelSet, DEC), 145, 118, BackgroundColor, BackgroundColor, FONT28); + LowLevelSet++; + if (LowLevelSet > 30) LowLevelSet = -15; + tftPrint(1, String(LowLevelSet, DEC), 145, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 210: + tftPrint(1, String(ContrastSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + ContrastSet ++; + if (ContrastSet > 100) ContrastSet = 1; + tftPrint(1, String(ContrastSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); + break; + } + break; + + case 2: + switch (menuoption) { + case 30: + tftPrint(0, myLanguage[language][0], 155, 118, BackgroundColor, BackgroundColor, FONT28); + language ++; + if (language == (sizeof (myLanguage) / sizeof (myLanguage[0]))) language = 0; + tftPrint(0, myLanguage[language][0], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 50: + if (showrdserrors) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (showrdserrors) showrdserrors = false; else showrdserrors = true; + if (showrdserrors) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 70: + if (softmutefm) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (softmutefm) softmutefm = false; else softmutefm = true; + if (softmutefm) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setSoftmuteFM(softmutefm); + break; + + case 90: + if (softmuteam) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (softmuteam) softmuteam = false; else softmuteam = true; + if (softmuteam) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setSoftmuteAM(softmuteam); + break; + + case 110: + if (edgebeep) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (edgebeep) edgebeep = false; else edgebeep = true; + if (edgebeep) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 130: + if (region == 0) tftPrint(0, myLanguage[language][47], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (region == 1) tftPrint(0, myLanguage[language][48], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (region == 0) region = 1; else region = 0; + if (region == 0) tftPrint(0, myLanguage[language][47], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (region == 1) tftPrint(0, myLanguage[language][48], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + regionold = region; + if (region == 0) radio.setDeemphasis(1); + if (region == 1) radio.setDeemphasis(2); + radio.rds.region = region; + break; + + case 150: + if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (radio.rds.underscore) radio.rds.underscore = false; else radio.rds.underscore = true; + if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 170: + if (USBmode) tftPrint(0, "RDS Spy", 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, "XDRGTK", 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (USBmode) USBmode = false; else USBmode = true; + if (USBmode) tftPrint(0, "RDS Spy", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, "XDRGTK", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 190: + if (wifi) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (wifi) wifi = false; else wifi = true; + if (wifi) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + } + break; + + case 3: + switch (menuoption) { + case 30: + tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + subnetclient ++; + if (subnetclient > 254) subnetclient = 1; + tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 50: + if (showSWMIBand) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (showSWMIBand) showSWMIBand = false; else showSWMIBand = true; + if (showSWMIBand) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 70: + if (radio.rds.filter) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (radio.rds.filter) radio.rds.filter = false; else radio.rds.filter = true; + if (radio.rds.filter) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 90: + if (radio.rds.pierrors) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (radio.rds.pierrors) radio.rds.pierrors = false; else radio.rds.pierrors = true; + if (radio.rds.pierrors) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 110: + if (showsquelch) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (showsquelch) showsquelch = false; else showsquelch = true; + if (showsquelch) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 130: + if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (showmodulation) showmodulation = false; else showmodulation = true; + if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 150: + if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (amnb != 0) tftPrint(-1, "%", 170, 118, BackgroundColor, BackgroundColor, FONT28); + amnb ++; + if (amnb > 150 || amnb <= 50) { + if (amnb == 1) amnb = 50; else amnb = 0; + } + if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (amnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setAMNoiseBlanker(amnb); + break; + + case 170: + if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (fmnb != 0) tftPrint(-1, "%", 170, 118, BackgroundColor, BackgroundColor, FONT28); + fmnb ++; + if (fmnb > 150 || fmnb <= 50) { + if (fmnb == 1) fmnb = 50; else fmnb = 0; + } + if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (fmnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setFMNoiseBlanker(fmnb); + break; + + case 190: + if (audiomode) tftPrint(0, "MPX", 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, "Stereo", 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (audiomode) audiomode = false; else audiomode = true; + if (audiomode) tftPrint(0, "MPX", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, "Stereo", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setAudio(audiomode); + break; + + case 210: + if (touchrotating) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (touchrotating) touchrotating = 0; else touchrotating = 1; + if (touchrotating) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + } + break; + + case 4: + switch (menuoption) { + case 30: + CurrentTheme ++; + if (CurrentTheme > 10) 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, FONT28); + tftPrint(0, CurrentThemeString, 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 70: + switch (poweroptionsold) { + case DEEP_SLEEP: tftPrint(0, myLanguage[language][75], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case LCD_BRIGHTNESS_1_PERCENT: tftPrint(0, myLanguage[language][94], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case LCD_BRIGHTNESS_A_QUARTER: tftPrint(0, myLanguage[language][95], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case LCD_BRIGHTNESS_HALF: tftPrint(0, myLanguage[language][96], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + } + + poweroptions++; + if (poweroptions > RADIO_POWER_MODE_CNT - 1) poweroptions = 0; + + switch (poweroptions) { + case DEEP_SLEEP: tftPrint(0, myLanguage[language][75], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case LCD_BRIGHTNESS_1_PERCENT: tftPrint(0, myLanguage[language][94], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case LCD_BRIGHTNESS_A_QUARTER: tftPrint(0, myLanguage[language][95], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case LCD_BRIGHTNESS_HALF: tftPrint(0, myLanguage[language][96], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + } + poweroptionsold = poweroptions; + break; + + case 90: + if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (fmdefaultstepsize) fmdefaultstepsize = 0; else fmdefaultstepsize = 1; + if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 110: + if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, BackgroundColor, BackgroundColor, FONT28); + if (!screensaverset) tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, BackgroundColor, BackgroundColor, FONT28); + screensaverset ++; + if (screensaverset > sizeof(screensaverOptions) / sizeof(screensaverOptions[0]) - 1) screensaverset = 0; + if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (!screensaverset) tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 130: + if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(AMLevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + AMLevelOffset++; + if (AMLevelOffset > 15) AMLevelOffset = -50; + if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(AMLevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setAMOffset(AMLevelOffset); + break; + + case 150: + tftPrint(0, String(unitString[unit]), 155, 118, BackgroundColor, BackgroundColor, FONT28); + unit ++; + if (unit > 2) unit = 0; + tftPrint(0, String(unitString[unit]), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 170: + if (af) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (af) af = false; else af = true; + if (af) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 190: + ShowBandSelectionFM(true, REVERSE); + bandFM++; + if (bandFM > FM_BAND_CNT - 1) bandFM = FM_BAND_ALL; + ShowBandSelectionFM(true, true); + break; + + case 210: + ShowBandSelectionAM(true, REVERSE); + bandAM++; + if (bandAM > AM_BAND_CNT - 1) bandAM = AM_BAND_ALL; + ShowBandSelectionAM(true, true); + break; + + } + break; + + case 5: + switch (menuoption) { + case 30: + switch (hardwaremodelold) { + case BASE_ILI9341: tftPrint(0, myLanguage[language][109], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case PORTABLE_ILI9341: tftPrint(0, myLanguage[language][110], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case PORTABLE_TOUCH_ILI9341: tftPrint(0, myLanguage[language][111], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + } + + hardwaremodel++; + if (hardwaremodel > RADIO_HARDWARE_CNT - 1) hardwaremodel = 0; + + switch (hardwaremodel) { + case BASE_ILI9341: tftPrint(0, myLanguage[language][109], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case PORTABLE_ILI9341: tftPrint(0, myLanguage[language][110], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case PORTABLE_TOUCH_ILI9341: tftPrint(0, myLanguage[language][111], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + } + hardwaremodelold = hardwaremodel; + break; + + case 50: + switch (batteryoptionsold) { + case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case BATTERY_VALUE: tftPrint(0, myLanguage[language][174], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case BATTERY_PERCENT: tftPrint(0, myLanguage[language][175], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + } + + batteryoptions++; + if (batteryoptions > RADIO_BATTERY_CNT - 1) batteryoptions = 0; + + switch (batteryoptions) { + case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case BATTERY_VALUE: tftPrint(0, myLanguage[language][174], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case BATTERY_PERCENT: tftPrint(0, myLanguage[language][175], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + } + batteryoptionsold = batteryoptions; + break; + } + break; + } + } +} + +void MenuDown() { + if (menuopen == false) { + tft.drawRoundRect(8, menuoption + 3, 302, 21, 5, BackgroundColor); + if (hardwaremodel == BASE_ILI9341) { + menuoption -= 20; + if (menuoption < 30) { + menupage--; + if (menupage == 0) menupage = menupagestotal; + menuoption = 210; + BuildMenu(); + } + } else { + menuoption += 20; + if (menuoption > 210) { + menupage++; + if (menupage > menupagestotal) menupage = 1; + menuoption = 30; + BuildMenu(); + } + } + tft.drawRoundRect(8, menuoption + 3, 302, 21, 5, ActiveColor); + } else { + switch (menupage) { + case 1: + switch (menuoption) { + case 30: + if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(VolSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + VolSet--; + if (VolSet < -10) VolSet = -10; + if (VolSet > 10) VolSet = 10; + if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(VolSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setVolume(VolSet); + break; + + case 50: + tftPrint(1, String(ConverterSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + ConverterSet--; + if (ConverterSet < 200 || ConverterSet > 2400) { + if (ConverterSet > 2400) ConverterSet = 2400; else ConverterSet = 0; + } + if (ConverterSet >= 200) { + Wire.beginTransmission(0x12); + Wire.write(ConverterSet >> 8); + Wire.write(ConverterSet & (0xFF)); + Wire.endTransmission(); + } + tftPrint(1, String(ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 70: + tftPrint(1, String(LowEdgeSet / 10 + ConverterSet, DEC) + "." + String(LowEdgeSet % 10 + ConverterSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + LowEdgeSet -= 10; + if (LowEdgeSet < 650) LowEdgeSet = 1079; + tftPrint(1, String(LowEdgeSet / 10 + ConverterSet, DEC) + "." + String(LowEdgeSet % 10 + ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 90: + tftPrint(1, String(HighEdgeSet / 10 + ConverterSet, DEC) + "." + String(HighEdgeSet % 10 + ConverterSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + HighEdgeSet -= 10; + if (HighEdgeSet < 660) HighEdgeSet = 1080; + tftPrint(1, String(HighEdgeSet / 10 + ConverterSet, DEC) + "." + String(HighEdgeSet % 10 + ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + + case 110: + if (LevelOffset > 0) tftPrint(1, "+" + String(LevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(LevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + LevelOffset--; + if (LevelOffset < -25) LevelOffset = 15; + if (LevelOffset > 0) tftPrint(1, "+" + String(LevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(LevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); radio.setOffset(LevelOffset); + change2 = true; + break; + + case 130: + if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, BackgroundColor, BackgroundColor, FONT28); + StereoLevel --; + if (StereoLevel < 30 || StereoLevel > 60) { + if (StereoLevel > 60) StereoLevel = 60; else StereoLevel = 0; + } + if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setStereoLevel(StereoLevel); + break; + + case 150: + tftPrint(1, String(HighCutLevel * 100, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + HighCutLevel --; + if (HighCutLevel < 15 || HighCutLevel > 70) HighCutLevel = 70; + tftPrint(1, String(HighCutLevel * 100, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setHighCutLevel(HighCutLevel); + break; + + case 170: + if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + HighCutOffset --; + if (HighCutOffset < 20 || HighCutOffset > 60) { + if (HighCutOffset > 60) HighCutOffset = 60; else HighCutOffset = 0; + } + if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setHighCutOffset(HighCutOffset); + break; + + case 190: + tftPrint(1, String(LowLevelSet, DEC), 145, 118, BackgroundColor, BackgroundColor, FONT28); + LowLevelSet--; + if (LowLevelSet < -15) LowLevelSet = 30; + tftPrint(1, String(LowLevelSet, DEC), 145, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + + case 210: + tftPrint(1, String(ContrastSet, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + ContrastSet --; + if (ContrastSet < 1) ContrastSet = 100; + tftPrint(1, String(ContrastSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); + break; + } + break; + + case 2: + switch (menuoption) { + case 30: + tftPrint(0, myLanguage[language][0], 155, 118, BackgroundColor, BackgroundColor, FONT28); + language --; + if (language > (sizeof (myLanguage) / sizeof (myLanguage[0]))) language = (sizeof (myLanguage) / sizeof (myLanguage[0])) - 1; + tftPrint(0, myLanguage[language][0], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 50: + if (showrdserrors) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (showrdserrors) showrdserrors = false; else showrdserrors = true; + if (showrdserrors) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 70: + if (softmutefm) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (softmutefm) softmutefm = false; else softmutefm = true; + if (softmutefm) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setSoftmuteFM(softmutefm); + break; + + case 90: + if (softmuteam) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (softmuteam) softmuteam = false; else softmuteam = true; + if (softmuteam) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setSoftmuteAM(softmuteam); + break; + + case 110: + if (edgebeep) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (edgebeep) edgebeep = false; else edgebeep = true; + if (edgebeep) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 130: + if (region == 0) tftPrint(0, myLanguage[language][47], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (region == 1) tftPrint(0, myLanguage[language][48], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (region == 0) region = 1; else region = 0; + if (region == 0) tftPrint(0, myLanguage[language][47], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (region == 1) tftPrint(0, myLanguage[language][48], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + regionold = region; + if (region == 0) radio.setDeemphasis(1); + if (region == 1) radio.setDeemphasis(2); + radio.rds.region = region; + break; + + case 150: + if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (radio.rds.underscore) radio.rds.underscore = false; else radio.rds.underscore = true; + if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 170: + if (USBmode) tftPrint(0, "RDS Spy", 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, "XDRGTK", 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (USBmode) USBmode = false; else USBmode = true; + if (USBmode) tftPrint(0, "RDS Spy", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, "XDRGTK", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 190: + if (wifi) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (wifi) wifi = false; else wifi = true; + if (wifi) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + } + break; + + case 3: + switch (menuoption) { + case 30: + tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + subnetclient --; + if (subnetclient < 1) subnetclient = 254; + tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 50: + if (showSWMIBand) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (showSWMIBand) showSWMIBand = false; else showSWMIBand = true; + if (showSWMIBand) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 70: + if (radio.rds.filter) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (radio.rds.filter) radio.rds.filter = false; else radio.rds.filter = true; + if (radio.rds.filter) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 90: + if (radio.rds.pierrors) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (radio.rds.pierrors) radio.rds.pierrors = false; else radio.rds.pierrors = true; + if (radio.rds.pierrors) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 110: + if (showsquelch) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (showsquelch) showsquelch = false; else showsquelch = true; + if (showsquelch) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 130: + if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (showmodulation) showmodulation = false; else showmodulation = true; + if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 150: + if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (amnb != 0) tftPrint(-1, "%", 170, 118, BackgroundColor, BackgroundColor, FONT28); + amnb --; + if (amnb > 150 || amnb <= 50) { + if (amnb > 150) amnb = 150; else amnb = 0; + } + if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (amnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setAMNoiseBlanker(amnb); + break; + + case 170: + if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (fmnb != 0) tftPrint(-1, "%", 170, 118, BackgroundColor, BackgroundColor, FONT28); + fmnb --; + if (fmnb > 150 || fmnb <= 50) { + if (fmnb > 150) fmnb = 150; else fmnb = 0; + } + if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (fmnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setFMNoiseBlanker(fmnb); + break; + + case 190: + if (audiomode) tftPrint(0, "MPX", 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, "Stereo", 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (audiomode) audiomode = false; else audiomode = true; + if (audiomode) tftPrint(0, "MPX", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, "Stereo", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setAudio(audiomode); + break; + case 210: + if (touchrotating) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (touchrotating) touchrotating = 0; else touchrotating = 1; + if (touchrotating) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + } + break; + case 4: + switch (menuoption) { + case 30: + CurrentTheme --; + if (CurrentTheme > 10) CurrentTheme = 10; + 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, FONT28); + tftPrint(0, CurrentThemeString, 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 70: + switch (poweroptionsold) { + case DEEP_SLEEP: tftPrint(0, myLanguage[language][75], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case LCD_BRIGHTNESS_1_PERCENT: tftPrint(0, myLanguage[language][94], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case LCD_BRIGHTNESS_A_QUARTER: tftPrint(0, myLanguage[language][95], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case LCD_BRIGHTNESS_HALF: tftPrint(0, myLanguage[language][96], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + } + + poweroptions--; + if (poweroptions > RADIO_POWER_MODE_CNT - 1) poweroptions = RADIO_POWER_MODE_CNT - 1; + + switch (poweroptions) { + case DEEP_SLEEP: tftPrint(0, myLanguage[language][75], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case LCD_BRIGHTNESS_1_PERCENT: tftPrint(0, myLanguage[language][94], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case LCD_BRIGHTNESS_A_QUARTER: tftPrint(0, myLanguage[language][95], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case LCD_BRIGHTNESS_HALF: tftPrint(0, myLanguage[language][96], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + } + poweroptionsold = poweroptions; + break; + + case 90: + if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (fmdefaultstepsize) fmdefaultstepsize = 0; else fmdefaultstepsize = 1; + if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 110: + if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, BackgroundColor, BackgroundColor, FONT28); + if (!screensaverset) tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, BackgroundColor, BackgroundColor, FONT28); + 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, FONT28); + if (!screensaverset) tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(screensaverOptions[screensaverset]), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 130: + if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(1, String(AMLevelOffset, DEC), 155, 118, BackgroundColor, BackgroundColor, FONT28); + AMLevelOffset--; + if (AMLevelOffset < -50) AMLevelOffset = 15; + if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(AMLevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + radio.setAMOffset(AMLevelOffset); + break; + + case 150: + tftPrint(0, String(unitString[unit]), 155, 118, BackgroundColor, BackgroundColor, FONT28); + unit --; + if (unit > 2) unit = 2; + tftPrint(0, String(unitString[unit]), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 170: + if (af) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); + if (af) af = false; else af = true; + if (af) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 190: + ShowBandSelectionFM(true, REVERSE); + bandFM--; + if (bandFM > FM_BAND_CNT) bandFM = FM_BAND_FM; + ShowBandSelectionFM(true, true); + break; + + case 210: + ShowBandSelectionAM(true, REVERSE); + bandAM--; + if (bandAM > AM_BAND_CNT) bandAM = AM_BAND_SW; + ShowBandSelectionAM(true, true); + break; + + } + break; + + case 5: + switch (menuoption) { + case 30: + switch (hardwaremodelold) { + case BASE_ILI9341: tftPrint(0, myLanguage[language][109], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case PORTABLE_ILI9341: tftPrint(0, myLanguage[language][110], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case PORTABLE_TOUCH_ILI9341: tftPrint(0, myLanguage[language][111], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + } + + hardwaremodel--; + if (hardwaremodel > RADIO_HARDWARE_CNT - 1) hardwaremodel = RADIO_HARDWARE_CNT - 1; + + switch (hardwaremodel) { + case BASE_ILI9341: tftPrint(0, myLanguage[language][109], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case PORTABLE_ILI9341: tftPrint(0, myLanguage[language][110], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case PORTABLE_TOUCH_ILI9341: tftPrint(0, myLanguage[language][111], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + } + hardwaremodelold = hardwaremodel; + break; + + case 50: + switch (batteryoptionsold) { + case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case BATTERY_VALUE: tftPrint(0, myLanguage[language][174], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + case BATTERY_PERCENT: tftPrint(0, myLanguage[language][175], 155, 118, BackgroundColor, BackgroundColor, FONT28); break; + } + + batteryoptions--; + if (batteryoptions > RADIO_BATTERY_CNT - 1) batteryoptions = RADIO_BATTERY_CNT - 1; + + switch (batteryoptions) { + case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case BATTERY_VALUE: tftPrint(0, myLanguage[language][174], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case BATTERY_PERCENT: tftPrint(0, myLanguage[language][175], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + } + batteryoptionsold = batteryoptions; + break; + } + break; + } + } +} + +void DoMenu() { + if (menuopen == false) { + menuopen = true; + tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); + tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); + switch (menupage) { + case 1: + switch (menuoption) { + case 30: + tftPrint(0, myLanguage[language][10], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); + if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(VolSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 50: + tftPrint(0, myLanguage[language][11], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(-1, "MHz", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(1, String(ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 70: + tftPrint(0, myLanguage[language][12], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(-1, "MHz", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(1, String(LowEdgeSet / 10 + ConverterSet, DEC) + "." + String(LowEdgeSet % 10 + ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 90: + tftPrint(0, myLanguage[language][13], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(-1, "MHz", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(1, String(HighEdgeSet / 10 + ConverterSet, DEC) + "." + String(HighEdgeSet % 10 + ConverterSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 110: + tftPrint(0, myLanguage[language][14], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(-1, "dBμV", 190, 165, ActiveColor, ActiveColorSmooth, FONT28); + if (LevelOffset > 0) tftPrint(1, "+" + String(LevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(LevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + SStatusold = 2000; + change2 = true; + break; + + case 130: + tftPrint(0, myLanguage[language][15], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (StereoLevel != 0) tftPrint(-1, "dBμV", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); + if (StereoLevel != 0) tftPrint(1, String(StereoLevel, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 150: + tftPrint(0, myLanguage[language][16], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (HighCutLevel != 0) tftPrint(-1, "Hz", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); + if (HighCutLevel != 0) tftPrint(1, String(HighCutLevel * 100, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 170: + tftPrint(0, myLanguage[language][17], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); + if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 190: + tftPrint(0, myLanguage[language][18], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(-1, "dBμV", 155, 118, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(1, String(LowLevelSet, DEC), 145, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 210: + tftPrint(0, myLanguage[language][19], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(-1, "%", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(1, String(ContrastSet, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + } + break; + + case 2: + switch (menuoption) { + case 30: + tftPrint(0, myLanguage[language][40], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(0, myLanguage[language][0], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 50: + tftPrint(0, myLanguage[language][38], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (showrdserrors) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 70: + tftPrint(0, myLanguage[language][43], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (softmutefm) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 90: + tftPrint(0, myLanguage[language][44], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (softmuteam) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 110: + tftPrint(0, myLanguage[language][45], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (edgebeep) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 130: + tftPrint(0, myLanguage[language][46], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (region == 0) tftPrint(0, myLanguage[language][47], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (region == 1) tftPrint(0, myLanguage[language][48], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 150: + tftPrint(0, myLanguage[language][49], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 170: + tftPrint(0, myLanguage[language][50], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (USBmode) tftPrint(0, "RDS Spy", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, "XDRGTK", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 190: + tftPrint(0, myLanguage[language][51], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (wifi) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 210: + tftPrint(0, myLanguage[language][53], 155, 58, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(0, "ESP_" + String(ESP_getChipId()), 155, 98, PrimaryColor, PrimaryColorSmooth, FONT28); + tftPrint(0, myLanguage[language][54], 155, 138, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(0, "http://192.168.4.1", 155, 174, PrimaryColor, PrimaryColorSmooth, FONT16); + char key [9]; + XDRGTK_key.toCharArray(key, 9); + WiFiConnectParam XDRGTK_key_text("Set XDRGTK Password: (max 8 characters)"); + WiFiConnectParam XDRGTK_key_input("XDRGTK_key", "Password", key, 9); + wc.addParameter(&XDRGTK_key_text); + wc.addParameter(&XDRGTK_key_input); + wc.startConfigurationPortal(AP_WAIT); + XDRGTK_key = XDRGTK_key_input.getValue(); + EEPROM.writeString(EE_STRING_XDRGTK_KEY, XDRGTK_key); + EEPROM.commit(); + tryWiFi(); + delay(2000); + BuildMenu(); + break; + } + break; + + case 3: + switch (menuoption) { + case 30: + tftPrint(0, myLanguage[language][58], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 50: + tftPrint(0, myLanguage[language][59], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (showSWMIBand) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 70: + tftPrint(0, myLanguage[language][60], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (radio.rds.filter) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 90: + tftPrint(0, myLanguage[language][61], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (radio.rds.pierrors) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 110: + tftPrint(0, myLanguage[language][62], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (showsquelch) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 130: + tftPrint(0, myLanguage[language][63], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (showmodulation) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 150: + tftPrint(0, myLanguage[language][64], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (amnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (amnb != 0) tftPrint(1, String(amnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 170: + tftPrint(0, myLanguage[language][65], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (fmnb != 0) tftPrint(-1, "%", 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 190: + tftPrint(0, myLanguage[language][67], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (audiomode) tftPrint(0, "MPX", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, "Stereo", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 210: + tftPrint(0, myLanguage[language][107], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (touchrotating) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + } + break; + + case 4: + switch (menuoption) { + case 30: + tftPrint(0, myLanguage[language][77], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(0, CurrentThemeString, 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 50: + tftPrint(0, myLanguage[language][71], 155, 38, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(0, myLanguage[language][72], 155, 88, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(0, "PE5PVB", 155, 68, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, "ohmytime", 145, 118, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, "HyperDX", 145, 133, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(-1, "MCelliotG", 155, 118, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(-1, "andimik", 155, 133, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, "DXHR05", 145, 148, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(1, "NoobishSVK", 145, 163, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(-1, "yo2ldk", 155, 148, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(-1, "Justin_Peng(Portable)", 155, 163, PrimaryColor, PrimaryColorSmooth, FONT16); + tftPrint(0, "github.com/PE5PVB/TEF6686_ESP32", 155, 183, ActiveColor, ActiveColorSmooth, FONT16); + break; + + case 70: + tftPrint(0, myLanguage[language][74], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + switch (poweroptions) { + case DEEP_SLEEP: tftPrint(0, myLanguage[language][75], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case LCD_OFF: tftPrint(0, myLanguage[language][76], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case LCD_BRIGHTNESS_1_PERCENT: tftPrint(0, myLanguage[language][94], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case LCD_BRIGHTNESS_A_QUARTER: tftPrint(0, myLanguage[language][95], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case LCD_BRIGHTNESS_HALF: tftPrint(0, myLanguage[language][96], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + } + poweroptionsold = poweroptions; + break; + + case 90: + tftPrint(-1, "KHz", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(0, myLanguage[language][90], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 110: + tftPrint(0, myLanguage[language][91], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (screensaverset) tftPrint(-1, myLanguage[language][92], 170, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + if (!screensaverset) tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(screensaverOptions[screensaverset], DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 130: + tftPrint(0, myLanguage[language][97], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(-1, "dB", 170, 118, ActiveColor, ActiveColorSmooth, FONT28); + if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(1, String(AMLevelOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 150: + tftPrint(0, myLanguage[language][98], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + tftPrint(0, unitString[unit], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + + case 170: + tftPrint(0, myLanguage[language][99], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + if (af) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); + break; + case 190: + tftPrint(0, myLanguage[language][100], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + ShowBandSelectionFM(true, true); + break; + case 210: + tftPrint(0, myLanguage[language][101], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + ShowBandSelectionAM(true, true); + break; + } + break; + + case 5: + switch (menuoption) { + case 30: + tftPrint(0, myLanguage[language][108], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + switch (hardwaremodel) { + case BASE_ILI9341: tftPrint(0, myLanguage[language][109], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case PORTABLE_ILI9341: tftPrint(0, myLanguage[language][110], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case PORTABLE_TOUCH_ILI9341: tftPrint(0, myLanguage[language][111], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + } + hardwaremodelold = hardwaremodel; + break; + + case 50: + tftPrint(0, myLanguage[language][173], 155, 78, ActiveColor, ActiveColorSmooth, FONT28); + switch (batteryoptions) { + case BATTERY_NONE: tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case BATTERY_VALUE: tftPrint(0, myLanguage[language][174], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + case BATTERY_PERCENT: tftPrint(0, myLanguage[language][175], 155, 118, PrimaryColor, PrimaryColorSmooth, FONT28); break; + } + batteryoptionsold = batteryoptions; + break; + } + break; + + } + } else { + if (menupage == 2 && menuoption == 190 && wifi == true) { + tryWiFi(); + delay(2000); + } + if (menupage == 2 && menuoption == 30) { + doTheme(); + } + menuopen = false; + BuildMenu(); + } +} diff --git a/src/gui.h b/src/gui.h new file mode 100644 index 0000000..77f1243 --- /dev/null +++ b/src/gui.h @@ -0,0 +1,149 @@ +#ifndef GUI_H +#define GUI_H + +#include +#include +#include "TEF6686.h" +#include "WiFiConnect.h" +#include "WiFiConnectParam.h" + +#define SMETERPIN 27 +#define CONTRASTPIN 2 + +extern bool advancedRDS; +extern bool af; +extern bool afpage; +extern bool afscreen; +extern bool artheadold; +extern bool BWreset; +extern bool change2; +extern bool compressedold; +extern bool dynamicPTYold; +extern bool edgebeep; +extern bool errorAold; +extern bool errorBold; +extern bool errorCold; +extern bool errorDold; +extern bool hasafold; +extern bool haseonold; +extern bool hastmcold; +extern bool LowLevelInit; +extern bool menuopen; +extern bool RDSstatus; +extern bool RDSstatusold; +extern bool rdsstereoold; +extern bool showrdserrors; +extern bool showsquelch; +extern bool softmuteam; +extern bool softmutefm; +extern bool Stereostatusold; +extern bool StereoToggle; +extern bool TAold; +extern bool TPold; +extern bool USBmode; +extern bool wifi; +extern byte af_counterold; +extern byte afpagenr; +extern byte amnb; +extern byte audiomode; +extern byte band; +extern byte bandAM; +extern byte bandFM; +extern byte bandforbidden; +extern byte batteryold; +extern byte batteryoptions; +extern byte batteryoptionsold; +extern byte ContrastSet; +extern byte CurrentTheme; +extern byte ECCold; +extern byte fmdefaultstepsize; +extern byte fmnb; +extern byte hardwaremodel; +extern byte hardwaremodelold; +extern byte HighCutLevel; +extern byte HighCutOffset; +extern byte language; +extern byte licold; +extern byte menupage; +extern byte menupagestotal; +extern byte MSold; +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; +extern byte showSWMIBand; +extern byte SNRold; +extern byte StereoLevel; +extern byte StereoLevel; +extern byte subnetclient; +extern byte theme; +extern byte touchrotating; +extern byte unit; +extern char programTypePrevious[18]; +extern char radioIdPrevious[6]; +extern int ActiveColor; +extern int ActiveColorSmooth; +extern int AMLevelOffset; +extern int BackgroundColor; +extern int BackgroundColorSmooth; +extern int BarInsignificantColor; +extern int BarSignificantColor; +extern int FrameColor; +extern int GreyoutColor; +extern int menuoption; +extern int PrimaryColor; +extern int PrimaryColorSmooth; +extern int rssiold; +extern int SecondaryColor; +extern int SecondaryColorSmooth; +extern int SignificantColor; +extern int Squelchold; +extern int SStatusold; +extern int16_t SStatus; +extern int8_t LevelOffset; +extern int8_t LowLevelSet; +extern int8_t VolSet; +extern String CurrentThemeString; +extern String eonpsold[11]; +extern String pinstringold; +extern String programServicePrevious; +extern String ptynold; +extern String rds_clockold; +extern String XDRGTK_key; +extern unsigned int ConverterSet; +extern unsigned int HighEdgeSet; +extern unsigned int LowEdgeSet; +extern unsigned int mappedfreqold[20]; + +extern TFT_eSPI tft; +extern TEF6686 radio; +extern WiFiConnect wc; + +void BuildAFScreen(); +void BuildMenu(); +void BuildAdvancedRDS(); +void BuildDisplay(); +void MenuUp(); +void MenuDown(); +void DoMenu(); + +// Extern: +void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, const uint8_t* font); +void ShowFreq(int mode); +void ShowBandSelectionFM(bool notglanceview, bool normaldisplay); +void ShowBandSelectionAM(bool notglanceview, bool normaldisplay); +void ScreensaverTimerSet(byte value); +void ShowMemoryPos(); +void ShowTuneMode(); +void updateBW(); +void ShowStepSize(); +void updateiMS(); +void updateEQ(); +void doTheme(); +void tryWiFi(); + +#endif \ No newline at end of file