diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 7b7a80e..5f8d4d0 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -343,6 +343,8 @@ String RabbitearsPassword; String RabbitearsUser; String rds_clock; String rds_clockold; +String rds_date; +String rds_dateold; String RDSSPYRDS; String RDSSPYRDSold; String RTold; @@ -1002,7 +1004,7 @@ void loop() { if (shouldScan) { if (scanmute && scanholdonsignal) { radio.setMute(); - if (!screenmute) tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + if (!screenmute && !afscreen) tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); SQ = true; } scanholdflag = false; @@ -1044,7 +1046,7 @@ void loop() { if (scanmute && scanholdonsignal) { radio.setUnMute(); SQ = false; - if (!screenmute) tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !afscreen) tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); } } @@ -1100,7 +1102,7 @@ void loop() { if (radio.af_counter == 0) { if (findMemoryAF && radio.rds.correctPI != 0 && tunemode == TUNE_MEM && (USN > 250 || WAM > 250)) { radio.setMute(); - tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); SQ = true; if (!screenmute) { if (advancedRDS) { @@ -1144,7 +1146,7 @@ void loop() { radio.setUnMute(); SQ = false; - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); } findMemoryAF = false; } else { @@ -2350,7 +2352,7 @@ void SelectBand() { } if (band > BAND_GAP) { - if (!screenmute) tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !afscreen) tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); if (tunemode == TUNE_MI_BAND && band != BAND_SW) tunemode = TUNE_MAN; BWreset = true; BWset = BWsetAM; @@ -2479,7 +2481,7 @@ void BWButtonPress() { } else { if (!usesquelch) radio.setUnMute(); if (!BWtune && !menu) { - if (!screenmute) tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !afscreen) tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); unsigned long counterold = millis(); unsigned long counter = millis(); while (digitalRead(BWBUTTON) == LOW && counter - counterold <= 1000) counter = millis(); @@ -2552,8 +2554,8 @@ void ModeButtonPress() { freq_in = 0; } else { if (!BWtune && !menu) { - if (!screenmute) { - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); } memorystore = false; unsigned long counterold = millis(); @@ -2761,7 +2763,7 @@ void ButtonPress() { } } } else { - if (!screenmute) tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !afscreen) tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); unsigned long counterold = millis(); unsigned long counter = millis(); while (digitalRead(ROTARY_BUTTON) == LOW && counter - counterold <= 1000) counter = millis(); @@ -3672,8 +3674,8 @@ void doSquelch() { if ((USN < fmscansens * 30) && (WAM < 230) && (OStatus < 100 && OStatus > -100) && (!scandxmode || (scandxmode && !scanmute))) { if (SQ || BWreset) { if (!seek) radio.setUnMute(); - if (!screenmute && !seek) { - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !seek && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); } autosquelchtimer = millis(); SQ = false; @@ -3681,8 +3683,8 @@ void doSquelch() { } else { if ((!SQ || BWreset) && (millis() >= autosquelchtimer + 1000)) { radio.setMute(); - if (!screenmute && !seek) { - tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + if (!screenmute && !seek && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); } autosquelchtimer = millis(); SQ = true; @@ -3691,14 +3693,14 @@ void doSquelch() { } else { if ((USN < amscansens * 30) && (OStatus < 2 && OStatus > -2) && (!scandxmode || (scandxmode && !scanmute))) { if (!seek) radio.setUnMute(); - if (!screenmute && !seek) { - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !seek && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); } SQ = false; } else { radio.setMute(); - if (!screenmute && !seek) { - tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + if (!screenmute && !seek && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); } SQ = true; } @@ -3731,28 +3733,28 @@ void doSquelch() { if (Squelch != -1) { if (Squelch < SStatus || Squelch == -100 || Squelch == 0) { if (!seek) radio.setUnMute(); - if (!screenmute && !seek) { - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !seek && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); } SQ = false; } else { radio.setMute(); - if (!screenmute && !seek) { - tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + if (!screenmute && !seek && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); } SQ = true; } } else { if (Stereostatus) { radio.setUnMute(); - if (!screenmute && !seek) { - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !seek && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); } SQ = false; } else { radio.setMute(); - if (!screenmute && !seek) { - tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + if (!screenmute && !seek && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); } SQ = true; } @@ -3780,28 +3782,28 @@ void doSquelch() { if (Squelch != 920) { if (Squelch < SStatus || Squelch == -100 || Squelch == 0) { if (!seek) radio.setUnMute(); - if (!screenmute && !seek) { - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !seek && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); } SQ = false; } else { radio.setMute(); - if (!screenmute && !seek) { - tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + if (!screenmute && !seek && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); } SQ = true; } } else { if (Stereostatus) { if (!seek) radio.setUnMute(); - if (!screenmute && !seek) { - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !seek && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); } SQ = false; } else { radio.setMute(); - if (!screenmute && !seek) { - tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + if (!screenmute && !seek && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); } SQ = true; } @@ -4403,13 +4405,13 @@ void EdgeBeeper() { radio.tone(50, -5, 2000); if (radio.mute) { radio.setMute(); - if (!screenmute) { - tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + if (!screenmute && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); } } else { radio.setUnMute(); - if (!screenmute) { - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); } } } @@ -4425,8 +4427,8 @@ void Seek(bool mode) { seekinit = false; } - if (!screenmute) { - tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + if (!screenmute && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); } if (!mode) TuneDown(); else TuneUp(); delay(50); @@ -4441,8 +4443,8 @@ void Seek(bool mode) { if ((USN < fmscansens * 30) && (WAM < 230) && (OStatus < 80 && OStatus > -80) && (Squelch < SStatus || Squelch == 920)) { seek = false; radio.setUnMute(); - if (!screenmute) { - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); } store = true; } else { @@ -4455,8 +4457,8 @@ void Seek(bool mode) { if ((USN < amscansens * 30) && (OStatus < 2 && OStatus > -2) && (Squelch < SStatus || Squelch == 920)) { seek = false; radio.setUnMute(); - if (!screenmute) { - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !afscreen) { + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); } store = true; } else { @@ -4830,7 +4832,7 @@ void cancelDXScan() { scandxmode = false; if (scanmute) { radio.setUnMute(); - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); if (!flashing) { tft.fillRoundRect(2, 80, 40, 18, 2, SecondaryColor); @@ -4995,7 +4997,7 @@ void startFMDXScan() { } if (scanmute) { radio.setMute(); - tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); SQ = true; Squelchold = -2; } diff --git a/src/comms.cpp b/src/comms.cpp index aa258c0..64f5eac 100644 --- a/src/comms.cpp +++ b/src/comms.cpp @@ -732,7 +732,7 @@ void XDRGTKRoutine() { case '\0': radio.setMute(); - if (!screenmute) tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + if (!screenmute && !afscreen) tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); if (!screenmute) { tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); @@ -761,7 +761,7 @@ void XDRGTKRoutine() { XDRScan = false; if (VolSet != 0) { radio.setUnMute(); - if (!screenmute) tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !afscreen) tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); radio.setVolume(((VolSet * 10) - 40) / 10); } break; @@ -799,12 +799,12 @@ void XDRGTKRoutine() { VolSet = atoi(buff + 1); if (VolSet == 0) { radio.setMute(); - if (!screenmute) tft.drawBitmap(253, 140, Speaker, 26, 22, PrimaryColor); + if (!screenmute && !afscreen) tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, PrimaryColor); XDRMute = true; SQ = true; } else { radio.setUnMute(); - if (!screenmute) tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !afscreen) tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); radio.setVolume((VolSet - 40) / 10); XDRMute = false; } @@ -831,7 +831,7 @@ void XDRGTKRoutine() { store = true; XDRMute = false; radio.setUnMute(); - if (!screenmute) tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + if (!screenmute && !afscreen) tft.drawBitmap((advancedRDS ? 215 : 253), (advancedRDS ? 45: 140), Speaker, 21, 20, GreyoutColor); VolSet = EEPROM.readByte(EE_BYTE_VOLSET); LowLevelSet = EEPROM.readByte(EE_BYTE_LOWLEVELSET); softmuteam = EEPROM.readByte(EE_BYTE_SOFTMUTEAM); diff --git a/src/constants.h b/src/constants.h index 73fc82f..053a1f5 100644 --- a/src/constants.h +++ b/src/constants.h @@ -493,28 +493,26 @@ static const uint8_t RDSLogo[] PROGMEM = { }; static const uint8_t Speaker[] PROGMEM = { - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x00, 0x00, - 0x00, 0x38, 0x00, 0x00, - 0x00, 0xf8, 0x00, 0x00, - 0x01, 0xf8, 0x00, 0x00, - 0xff, 0xf8, 0x00, 0x00, - 0xff, 0xf8, 0x40, 0x80, - 0xff, 0xf8, 0xe1, 0xc0, - 0xff, 0xf8, 0x73, 0x80, - 0xff, 0xf8, 0x3f, 0x00, - 0xff, 0xf8, 0x1e, 0x00, - 0xff, 0xf8, 0x1e, 0x00, - 0xff, 0xf8, 0x3f, 0x00, - 0xff, 0xf8, 0x73, 0x80, - 0xff, 0xf8, 0xe1, 0xc0, - 0xff, 0xf8, 0x40, 0x80, - 0xff, 0xf8, 0x00, 0x00, - 0x01, 0xf8, 0x00, 0x00, - 0x00, 0xf8, 0x00, 0x00, - 0x00, 0x38, 0x00, 0x00, - 0x00, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, 0x00, + 0x00, 0x20, 0x00, + 0x00, 0x60, 0x00, + 0x01, 0xe0, 0x00, + 0x03, 0xe0, 0x00, + 0x07, 0xe0, 0x00, + 0xff, 0xe2, 0x10, + 0xff, 0xe7, 0x38, + 0xff, 0xe3, 0xf0, + 0xff, 0xe1, 0xe0, + 0xff, 0xe1, 0xe0, + 0xff, 0xe3, 0xf0, + 0xff, 0xe7, 0x38, + 0xff, 0xe2, 0x10, + 0x07, 0xe0, 0x00, + 0x03, 0xe0, 0x00, + 0x01, 0xe0, 0x00, + 0x00, 0x60, 0x00, + 0x00, 0x20, 0x00, + 0x00, 0x00, 0x00 }; static const uint8_t WiFi1[] PROGMEM = { diff --git a/src/gui.cpp b/src/gui.cpp index eb19475..5e0de13 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -2886,7 +2886,7 @@ void BuildAdvancedRDS() { tftPrint(-1, "kHz", 203, 4, ActiveColor, ActiveColorSmooth, 28); tft.drawBitmap(70, 5, RDSLogo, 35, 22, GreyoutColor); - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + tft.drawBitmap(215, 45, Speaker, 21, 20, GreyoutColor); if (!StereoToggle) { tft.drawCircle(48, 15, 10, SecondaryColor); @@ -3021,7 +3021,7 @@ void BuildDisplay() { tftPrint(-1, unitString[unit], 282, 145, ActiveColor, ActiveColorSmooth, 16); tft.drawBitmap(70, 5, RDSLogo, 35, 22, GreyoutColor); - tft.drawBitmap(253, 140, Speaker, 26, 22, GreyoutColor); + tft.drawBitmap(253, 140, Speaker, 21, 20, GreyoutColor); if (!StereoToggle) { tft.drawCircle(48, 15, 10, SecondaryColor); diff --git a/src/rds.cpp b/src/rds.cpp index a7e1615..34e1f14 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -356,13 +356,6 @@ void readRds() { tft.fillCircle(200, 41, 5, SignificantColor); } - if (radio.rds.hasCT) { - if (advancedRDS) { - tftPrint(1, rds_clock, 208, 109, RDSDropoutColor, RDSDropoutColorSmooth, 16); - } else { - tftPrint(1, rds_clock, 208, 163, RDSDropoutColor, RDSDropoutColorSmooth, 16); - } - } dropout = true; } } else { @@ -423,13 +416,6 @@ void readRds() { tft.fillCircle(203, 234, 2, GreyoutColor); } - if (radio.rds.hasCT) { - if (advancedRDS) { - tftPrint(1, rds_clock, 208, 109, RDSColor, RDSColorSmooth, 16); - } else { - tftPrint(1, rds_clock, 208, 163, RDSColor, RDSColorSmooth, 16); - } - } dropout = false; memreset = false; } @@ -783,8 +769,9 @@ void showPS() { } void showCT() { - // Temporary string buffer for time formatting - char str[6]; + // Temporary string buffers for time and date formatting + char timeStr[6]; // HH:MM + char dateStr[9]; // DD-MM-YY time_t t; // Determine the current time source @@ -811,7 +798,6 @@ void showCT() { // Format the time based on region if (clockampm) { // USA region: 12-hour AM/PM format - // Determine AM/PM and adjust hour format int hour = localtime(&t)->tm_hour; String ampm = (hour >= 12) ? "PM" : "AM"; if (hour == 0) { @@ -819,19 +805,20 @@ void showCT() { } else if (hour > 12) { hour -= 12; // Convert PM hours } - - // Format the time string with leading zeros for minutes - char formattedTime[10]; - sprintf(formattedTime, "%d:%02d%s", hour, localtime(&t)->tm_min, ampm.c_str()); - - rds_clock = String(formattedTime); + sprintf(timeStr, "%d:%02d%s", hour, localtime(&t)->tm_min, ampm.c_str()); } else { // Other regions: 24-hour format - strftime(str, sizeof(str), "%H:%M", localtime(&t)); - rds_clock = String(str); + strftime(timeStr, sizeof(timeStr), "%H:%M", localtime(&t)); } + // Store formatted time in rds_clock + rds_clock = String(timeStr); + + // Format the date as DD-MM-YY + strftime(dateStr, sizeof(dateStr), "%d-%m-%y", localtime(&t)); + rds_date = String(dateStr); + // Check if the clock or RDS CT status has changed - if (!screenmute && showclock && (rds_clock != rds_clockold || hasCTold != radio.rds.hasCT)) { + if (!screenmute && showclock && (rds_clock != rds_clockold || rds_date != rds_dateold || hasCTold != radio.rds.hasCT)) { // Update RTC if RDS CT is available or NTP was updated if ((radio.rds.hasCT && RDSstatus) || NTPupdated) { @@ -840,21 +827,25 @@ void showCT() { rtc.setTime(radio.rds.time); } - // Display the updated time + // Display the updated time and date tftReplace(0, rds_clockold, rds_clock, 135, 1, RDSColor, RDSColorSmooth, BackgroundColor, 16); + tftReplace(0, rds_dateold, rds_date, 135, 16, RDSColor, RDSColorSmooth, BackgroundColor, 16); } else { // Handle dropout scenarios - if (rtcset) { // Display dropout message if RTC was set tftReplace(0, rds_clockold, rds_clock, 135, 1, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); - } else { // Clear and reprint the clock + tftReplace(0, rds_dateold, rds_date, 135, 16, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); + } else { // Clear and reprint the clock and date tftPrint(0, rds_clockold, 135, 1, BackgroundColor, BackgroundColor, 16); tftPrint(0, rds_clock, 135, 1, BackgroundColor, BackgroundColor, 16); + tftPrint(0, rds_dateold, 135, 16, BackgroundColor, BackgroundColor, 16); + tftPrint(0, rds_date, 135, 16, BackgroundColor, BackgroundColor, 16); } } } - // Update previous clock and RDS CT status + // Update previous clock, date, and RDS CT status rds_clockold = rds_clock; + rds_dateold = rds_date; hasCTold = radio.rds.hasCT; } diff --git a/src/rds.h b/src/rds.h index 1e6c3dc..eb36440 100644 --- a/src/rds.h +++ b/src/rds.h @@ -109,6 +109,8 @@ extern String ptynold; extern String PTYold; extern String rds_clock; extern String rds_clockold; +extern String rds_date; +extern String rds_dateold; extern String RDSSPYRDS; extern String RDSSPYRDSold; extern String RTold;