Update speaker icon and added date

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