From 2612a2782e85757598a324974cce004d17c19a46 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Sun, 4 Feb 2024 16:18:32 +0100 Subject: [PATCH] Added option to disable display when XDRGTK is connected --- TEF6686_ESP32.ino | 6 ++++- src/comms.cpp | 12 ++++++---- src/comms.h | 2 +- src/constants.h | 13 ++++++----- src/gui.cpp | 21 ++++++++++++++++- src/gui.h | 1 + src/language.h | 58 +++++++++++++++++++++++++++++++---------------- 7 files changed, 80 insertions(+), 33 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 6878d99..3aab2cf 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -105,6 +105,7 @@ bool TAold; bool TPold; bool tuned; bool USBmode = 1; +bool XDRGTKMuteScreen; bool wifi; bool wificonnected; bool XDRGTKdata; @@ -462,6 +463,7 @@ void setup() { fmscansens = EEPROM.readByte(EE_BYTE_FMSCANSENS); freqfont = EEPROM.readByte(EE_BYTE_FREQFONT); CurrentSkin = EEPROM.readByte(EE_BYTE_SKIN); + XDRGTKMuteScreen = EEPROM.readByte(EE_BYTE_XDRGTKMUTE); if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000); else tft.setSPISpeed(spispeed * 10); LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN; @@ -743,7 +745,7 @@ void setup() { void loop() { Communication(); - + if (tot != 0) { unsigned long totprobe = tot * 60000; if (millis() >= tottimer + totprobe) deepSleep(); @@ -1949,6 +1951,7 @@ void ModeButtonPress() { EEPROM.writeByte(EE_BYTE_FMSCANSENS, fmscansens); EEPROM.writeByte(EE_BYTE_FREQFONT, freqfont); EEPROM.writeByte(EE_BYTE_SKIN, CurrentSkin); + EEPROM.writeByte(EE_BYTE_XDRGTKMUTE, XDRGTKMuteScreen); EEPROM.commit(); if (af == 2) radio.rds.afreg = true; else radio.rds.afreg = false; if (!usesquelch) radio.setUnMute(); @@ -3601,6 +3604,7 @@ void DefaultSettings(byte userhardwaremodel) { EEPROM.writeByte(EE_BYTE_FMSCANSENS, 4); EEPROM.writeByte(EE_BYTE_FREQFONT, 3); EEPROM.writeByte(EE_BYTE_SKIN, 0); + EEPROM.writeByte(EE_BYTE_XDRGTKMUTE, 0); EEPROM.commit(); } diff --git a/src/comms.cpp b/src/comms.cpp index 6f84d06..0d4f1f4 100644 --- a/src/comms.cpp +++ b/src/comms.cpp @@ -119,6 +119,7 @@ void Communication() { SelectBand(); } XDRGTKTCP = true; + if (XDRGTKMuteScreen) MuteScreen(1); RemoteClient.print("o1,0\n"); RemoteClient.print("G" + String(!EQset) + String(!iMSset) + "\n"); store = true; @@ -159,6 +160,7 @@ void Communication() { } Serial.print("OK\nT" + String(frequency * 10) + "\nG" + String(!EQset) + String(!iMSset) + "\n"); XDRGTKUSB = true; + if (XDRGTKMuteScreen) MuteScreen(1); } } @@ -500,6 +502,7 @@ void XDRGTKRoutine() { case 'x': DataPrint("OK\nT" + String(frequency * 10) + "\n"); + if (XDRGTKMuteScreen) MuteScreen(1); break; case 'X': @@ -517,6 +520,7 @@ void XDRGTKRoutine() { radio.setSoftmuteFM(softmutefm); radio.setSoftmuteAM(softmuteam); if (!usesquelch) radio.setUnMute(); + if (XDRGTKMuteScreen) MuteScreen(0); break; case 'Z': @@ -524,19 +528,19 @@ void XDRGTKRoutine() { ANT = atol(buff + 1); switch (ANT) { case 0: - // Antenna A + // Antenna A break; case 1: - // Antenna B + // Antenna B break; case 2: - // Antenna C + // Antenna C break; case 3: - // Antenna D + // Antenna D break; } DataPrint("Z" + String(ANT) + "\n"); diff --git a/src/comms.h b/src/comms.h index ce463b1..c2494bb 100644 --- a/src/comms.h +++ b/src/comms.h @@ -35,7 +35,7 @@ extern bool wificonnected; extern bool XDRGTKdata; extern bool XDRGTKTCP; extern bool XDRGTKUSB; -extern bool XDRMute; +extern bool XDRGTKMuteScreen; extern bool XDRMute; extern byte band; extern byte BWset; diff --git a/src/constants.h b/src/constants.h index 21d826a..001f937 100644 --- a/src/constants.h +++ b/src/constants.h @@ -196,9 +196,9 @@ // EEPROM index defines #define EE_PRESETS_CNT 99 -#define EE_CHECKBYTE_VALUE 2 // 0 ~ 255,add new entry, change for new value +#define EE_CHECKBYTE_VALUE 3 // 0 ~ 255,add new entry, change for new value -#define EE_TOTAL_CNT 823 +#define EE_TOTAL_CNT 824 #define EE_UINT16_FREQUENCY_FM 0 #define EE_BYTE_VOLSET 4 #define EE_BYTE_STEREO 5 @@ -278,10 +278,11 @@ #define EE_BYTE_FMSCANSENS 123 #define EE_BYTE_FREQFONT 124 #define EE_BYTE_SKIN 125 -#define EE_PRESETS_BAND_START 126 -#define EE_PRESET_BW_START 226 -#define EE_PRESET_MS_START 326 -#define EE_PRESETS_START 426 +#define EE_BYTE_XDRGTKMUTE 126 +#define EE_PRESETS_BAND_START 127 +#define EE_PRESET_BW_START 227 +#define EE_PRESET_MS_START 327 +#define EE_PRESETS_START 427 #define EE_PRESETS_FREQUENCY 0 // End of EEPROM index defines diff --git a/src/gui.cpp b/src/gui.cpp index d40239d..90e1030 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -8,7 +8,7 @@ byte menuitem; -byte items[8] = {8, static_cast(dynamicspi ? 5 : 4), 7, 10, 9, 10, 10, 5}; +byte items[8] = {8, static_cast(dynamicspi ? 5 : 4), 7, 10, 9, 10, 10, 6}; void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/ switch (CurrentTheme) { @@ -714,12 +714,14 @@ void BuildMenu() { tftPrint(-1, myLanguage[language][52], 8, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][58], 8, ITEM4 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][197], 8, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][205], 8, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16); if (USBmode) tftPrint(1, "RDS Spy", 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, "XDRGTK", 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (wifi) tftPrint(1, myLanguage[language][42], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(1, ">", 310, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (wifi) tftPrint(1, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, "-", 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(1, String(stationlistid, DEC), 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); + if (XDRGTKMuteScreen) tftPrint(1, myLanguage[language][42], 310, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; } @@ -1577,6 +1579,12 @@ void MenuUp() { if (stationlistid > 10) stationlistid = 1; tftPrint(0, String(stationlistid, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; + + case ITEM6: + if (XDRGTKMuteScreen) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); + if (XDRGTKMuteScreen) XDRGTKMuteScreen = false; else XDRGTKMuteScreen = true; + if (XDRGTKMuteScreen) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; } break; } @@ -2168,6 +2176,12 @@ void MenuDown() { if (stationlistid == 0) stationlistid = 10; tftPrint(0, String(stationlistid, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; + + case ITEM6: + if (XDRGTKMuteScreen) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); + if (XDRGTKMuteScreen) XDRGTKMuteScreen = false; else XDRGTKMuteScreen = true; + if (XDRGTKMuteScreen) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; } break; } @@ -2664,6 +2678,11 @@ void DoMenu() { Infoboxprint(myLanguage[language][197]); tftPrint(0, String(stationlistid, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; + + case ITEM6: + Infoboxprint(myLanguage[language][205]); + if (XDRGTKMuteScreen) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; } break; } diff --git a/src/gui.h b/src/gui.h index df4eaee..2674108 100644 --- a/src/gui.h +++ b/src/gui.h @@ -58,6 +58,7 @@ extern bool StereoToggle; extern bool TAold; extern bool TPold; extern bool USBmode; +extern bool XDRGTKMuteScreen; extern bool wifi; extern byte af; extern byte af_counterold; diff --git a/src/language.h b/src/language.h index fa429db..ce6cdd0 100644 --- a/src/language.h +++ b/src/language.h @@ -1,11 +1,11 @@ #ifndef LANGUAGE_H #define LANGUAGE_H -#define VERSION "v2.00.3" +#define VERSION "v2.00.4" // [number of languages][number of texts] // *** means the text is the same as in English -static const char* const myLanguage[18][205] = { +static const char* const myLanguage[18][206] = { { "English", // English "Rotary direction changed", // 1 "Please release button", // 2 @@ -210,7 +210,8 @@ static const char* const myLanguage[18][205] = { "Large", // 201 "All", // 202 "Fast PS", // 203 - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Nederlands", // Dutch @@ -417,7 +418,8 @@ static const char* const myLanguage[18][205] = { "Middel", // 201 "Alles", // 202 "Snelle PS", // 203 - "Standaard" // 204 + "Standaard", // 204 + "Scherm uit bij\nXDRGTK verbinding" // 205 }, { "Polski", // Polish @@ -624,7 +626,8 @@ static const char* const myLanguage[18][205] = { "Duże", // 201 "Wszystkie", // 202 "Szybki PS", // 203 - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Hrvatski", // Croatian @@ -831,7 +834,8 @@ static const char* const myLanguage[18][205] = { "Veliko", // 201 "Sve", // 202 "Brzi PS", // 203 - "Zadano" // 204 + "Zadano", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Ελληνικά", // Greek @@ -1038,7 +1042,8 @@ static const char* const myLanguage[18][205] = { "Μεγάλο", // 201 "Όλα", // 202 "Γρήγορο PS", // 203 - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Română", // Romanian @@ -1245,7 +1250,8 @@ static const char* const myLanguage[18][205] = { "Mare", // 201 "Tot", // 202 "PS rapid", // 203 - "Mod implicit" // 204 + "Mod implicit", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Deutsch", // German @@ -1452,7 +1458,8 @@ static const char* const myLanguage[18][205] = { "Viel", // 201 "Maximal", // 202 "Schnelles PS", // 203 - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Český", // Czech @@ -1659,7 +1666,8 @@ static const char* const myLanguage[18][205] = { "Velký", // 201 "Vše", // 202 "Rychlé načtení PS", // 203 - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Slovenský", // Slovak @@ -1866,7 +1874,8 @@ static const char* const myLanguage[18][205] = { "Veľký", // 201 "Všetko", // 202 "Rýchle načítanie PS", // 203 - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Français", // French @@ -2073,7 +2082,8 @@ static const char* const myLanguage[18][205] = { "Grosses", // 201 "Toutes", // 202 "PS rapide", // 203 - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Български", // Bulgarian @@ -2280,7 +2290,8 @@ static const char* const myLanguage[18][205] = { "Large", // 201 *** "Всички", // 202 "Fast PS", // 203 *** - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Русский", // Russian @@ -2487,7 +2498,8 @@ static const char* const myLanguage[18][205] = { "Больше", // 201 "Все", // 202 "Быстрый PS", // 203 - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Українська", // Ukranian @@ -2694,7 +2706,8 @@ static const char* const myLanguage[18][205] = { "Багато", // 201 "Усе", // 202 "Швидкий PS", // 203 - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Italiano", // Italian @@ -2901,7 +2914,8 @@ static const char* const myLanguage[18][205] = { "Grande", // 201 *** "Tutto", // 202 *** "PS veloce", // 203 *** - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Simplified Chinese", // Simplified Chinese @@ -3108,7 +3122,8 @@ static const char* const myLanguage[18][205] = { "大量", // 201 "全部", // 202 "快速 PS", // 203 - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Norsk", // Norwegian @@ -3315,7 +3330,8 @@ static const char* const myLanguage[18][205] = { "Mye", // 201 "Alt", // 202 "Rask PS", // 203 - "Standard" // 204 + "Standard", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Español", // Spanish @@ -3522,7 +3538,8 @@ static const char* const myLanguage[18][205] = { "Grande", // 201 "Todo", // 202 "PS rápido", // 203 - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 }, { "Português", // Portuguese @@ -3729,7 +3746,8 @@ static const char* const myLanguage[18][205] = { "Grande", // 201 "Tudo", // 202 "PS rápido", // 203 - "Default" // 204 + "Default", // 204 + "Mute screen on\nXDRGTK connection" // 205 } }; #endif \ No newline at end of file