From 1bca1c09c958f841a5be620c65b97448f0d67a3e Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Tue, 16 Sep 2025 11:48:10 +0200 Subject: [PATCH] Converted text offset value to a define to make it easier to read and use --- TEF6686_ESP32.ino | 242 ++++++++++++++++++++++---------------------- src/comms.cpp | 10 +- src/constants.h | 60 +++++------ src/gui.cpp | 250 +++++++++++++++++++++++----------------------- src/rds.cpp | 202 ++++++++++++++++++------------------- src/touch.cpp | 3 +- 6 files changed, 385 insertions(+), 382 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 755aa2a..b615111 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -754,7 +754,7 @@ void setup() { EEPROM.commit(); analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255)); Infoboxprint(textUI(1)); - tftPrint(0, textUI(2), 155, 130, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(2), 155, 130, ActiveColor, ActiveColorSmooth, 28); while (digitalRead(BWBUTTON) == LOW) delay(50); } @@ -778,7 +778,7 @@ void setup() { EEPROM.commit(); analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255)); Infoboxprint(textUI(3)); - tftPrint(0, textUI(2), 155, 130, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(2), 155, 130, ActiveColor, ActiveColorSmooth, 28); while (digitalRead(MODEBUTTON) == LOW) delay(50); } @@ -786,7 +786,7 @@ void setup() { analogWrite(SMETERPIN, 511); analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255)); Infoboxprint(textUI(4)); - tftPrint(0, textUI(2), 155, 130, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(2), 155, 130, ActiveColor, ActiveColorSmooth, 28); while (digitalRead(BANDBUTTON) == LOW) delay(50); analogWrite(SMETERPIN, 0); } @@ -802,7 +802,7 @@ void setup() { } EEPROM.writeByte(EE_BYTE_OPTENC, optenc); EEPROM.commit(); - tftPrint(0, textUI(2), 155, 130, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(2), 155, 130, ActiveColor, ActiveColorSmooth, 28); while (digitalRead(ROTARY_BUTTON) == LOW) delay(50); } @@ -810,7 +810,7 @@ void setup() { analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255)); DefaultSettings(); Infoboxprint(textUI(66)); - tftPrint(0, textUI(2), 155, 130, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(2), 155, 130, ActiveColor, ActiveColorSmooth, 28); while (digitalRead(ROTARY_BUTTON) == LOW && digitalRead(BWBUTTON) == LOW) delay(50); ESP.restart(); } @@ -818,7 +818,7 @@ void setup() { if (digitalRead(BWBUTTON) == LOW && digitalRead(ROTARY_BUTTON) == HIGH && digitalRead(MODEBUTTON) == LOW && digitalRead(BANDBUTTON) == HIGH) { analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255)); Infoboxprint(textUI(282)); - tftPrint(0, textUI(283), 155, 100, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(283), 155, 100, ActiveColor, ActiveColorSmooth, 28); tft.calibrateTouch(TouchCalData, PrimaryColor, BackgroundColor, 30); EEPROM.writeUInt(EE_UINT16_CALTOUCH1, TouchCalData[0]); EEPROM.writeUInt(EE_UINT16_CALTOUCH2, TouchCalData[1]); @@ -831,7 +831,7 @@ void setup() { if (digitalRead(BWBUTTON) == LOW && digitalRead(ROTARY_BUTTON) == HIGH && digitalRead(MODEBUTTON) == HIGH && digitalRead(BANDBUTTON) == LOW) { analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255)); Infoboxprint(textUI(69)); - tftPrint(0, textUI(2), 155, 130, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(2), 155, 130, ActiveColor, ActiveColorSmooth, 28); invertdisplay = !invertdisplay; tft.invertDisplay(!invertdisplay); while (digitalRead(BWBUTTON) == LOW && digitalRead(BANDBUTTON) == LOW) delay(50); @@ -842,8 +842,8 @@ void setup() { tft.setTouch(TouchCalData); tft.fillScreen(BackgroundColor); - tftPrint(0, textUI(8), 160, 3, PrimaryColor, PrimaryColorSmooth, 28); - tftPrint(0, "Software " + String(VERSION), 160, 152, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ACENTER, textUI(8), 160, 3, PrimaryColor, PrimaryColorSmooth, 28); + tftPrint(ACENTER, "Software " + String(VERSION), 160, 152, PrimaryColor, PrimaryColorSmooth, 16); tft.fillRect(120, 230, 16, 6, GreyoutColor); tft.fillRect(152, 230, 16, 6, GreyoutColor); @@ -876,30 +876,30 @@ void setup() { fmsi = false; chipmodel = 0; tft.fillRect(152, 230, 16, 6, PrimaryColor); - tftPrint(0, "TEF6686 Lithio", 160, 172, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, "TEF6686 Lithio", 160, 172, ActiveColor, ActiveColorSmooth, 28); } else if (lowByte(device) == 1) { fullsearchrds = true; chipmodel = 1; tft.fillRect(152, 230, 16, 6, PrimaryColor); - tftPrint(0, "TEF6687 Lithio FMSI", 160, 172, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, "TEF6687 Lithio FMSI", 160, 172, ActiveColor, ActiveColorSmooth, 28); } else if (lowByte(device) == 9) { fullsearchrds = false; chipmodel = 2; fmsi = false; tft.fillRect(152, 230, 16, 6, PrimaryColor); - tftPrint(0, "TEF6688 Lithio DR", 160, 172, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, "TEF6688 Lithio DR", 160, 172, ActiveColor, ActiveColorSmooth, 28); } else if (lowByte(device) == 3) { fullsearchrds = true; chipmodel = 3; tft.fillRect(152, 230, 16, 6, PrimaryColor); - tftPrint(0, "TEF6689 Lithio FMSI DR", 160, 172, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, "TEF6689 Lithio FMSI DR", 160, 172, ActiveColor, ActiveColorSmooth, 28); } else { - tftPrint(0, textUI(9), 160, 172, SignificantColor, SignificantColorSmooth, 28); + tftPrint(ACENTER, textUI(9), 160, 172, SignificantColor, SignificantColorSmooth, 28); tft.fillRect(152, 230, 16, 6, SignificantColor); while (true); for (;;); } - tftPrint(0, "Patch: v" + String(TEF), 160, 202, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, "Patch: v" + String(TEF), 160, 202, ActiveColor, ActiveColorSmooth, 28); Wire.beginTransmission(0x20); Wire.write(0x06); @@ -1067,10 +1067,10 @@ void loop() { flashing = !flashing; if (flashing) { tft.fillRoundRect(2, 80, 40, 18, 2, SecondaryColor); - tftPrint(0, "MEM", 22, 82, BackgroundColor, SecondaryColor, 16); + tftPrint(ACENTER, "MEM", 22, 82, BackgroundColor, SecondaryColor, 16); } else { tft.fillRoundRect(2, 80, 40, 18, 2, GreyoutColor); - tftPrint(0, "MEM", 22, 82, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "MEM", 22, 82, BackgroundColor, GreyoutColor, 16); } flashingtimer = millis(); } @@ -1121,7 +1121,7 @@ void loop() { if (advancedRDS) { tft.drawRoundRect(10, 30, 300, 170, 2, ActiveColor); tft.fillRoundRect(12, 32, 296, 166, 2, BackgroundColor); - tftPrint(0, textUI(34), 160, 100, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(34), 160, 100, ActiveColor, ActiveColorSmooth, 28); } else { ShowFreq(1); } @@ -1230,12 +1230,12 @@ void loop() { if ((SStatus / 10 > LowLevelSet) && !LowLevelInit && !BWtune && !menu && band < BAND_GAP) { if (!screenmute && !advancedRDS && !rdsstatscreen && !afscreen) { if (showmodulation) { - tftPrint(-1, "10", 24, 144, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "30", 54, 144, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "50", 84, 144, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "70", 114, 144, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "100", 160, 144, ActiveColor, ActiveColorSmooth, 16); - tftPrint(0, "A", 7, 128, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "10", 24, 144, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "30", 54, 144, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "50", 84, 144, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "70", 114, 144, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "100", 160, 144, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ACENTER, "A", 7, 128, ActiveColor, ActiveColorSmooth, 16); for (byte segments = 0; segments < 94; segments++) { if (segments > 54) { if (((segments - 53) % 10) == 0) tft.fillRect(16 + (2 * segments), 141, 2, 2, BarSignificantColor); @@ -1245,14 +1245,14 @@ void loop() { } } if (radio.rds.region == 0) { - tftPrint(-1, "PI:", 212, 193, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PI:", 212, 193, ActiveColor, ActiveColorSmooth, 16); } else { - tftPrint(-1, "PI:", 212, 184, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "ID:", 212, 201, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PI:", 212, 184, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "ID:", 212, 201, ActiveColor, ActiveColorSmooth, 16); } - tftPrint(-1, "PS:", 3, 193, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "RT:", 3, 221, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "PTY:", 3, 163, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PS:", 3, 193, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "RT:", 3, 221, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PTY:", 3, 163, ActiveColor, ActiveColorSmooth, 16); if (!showmodulation) tft.drawLine(16, 143, 203, 143, GreyoutColor); else tft.drawLine(16, 143, 203, 143, ActiveColor); } LowLevelInit = true; @@ -1269,23 +1269,23 @@ void loop() { } } if (showmodulation) { - tftPrint(-1, "10", 24, 144, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "30", 54, 144, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "50", 84, 144, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "70", 114, 144, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "100", 160, 144, GreyoutColor, BackgroundColor, 16); - tftPrint(0, "A", 7, 128, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "10", 24, 144, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "30", 54, 144, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "50", 84, 144, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "70", 114, 144, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "100", 160, 144, GreyoutColor, BackgroundColor, 16); + tftPrint(ACENTER, "A", 7, 128, GreyoutColor, BackgroundColor, 16); tft.fillRect(16, 133, 187, 6, GreyoutColor); } if (radio.rds.region == 0) { - tftPrint(-1, "PI:", 212, 193, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "PI:", 212, 193, GreyoutColor, BackgroundColor, 16); } else { - tftPrint(-1, "PI:", 212, 184, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "ID:", 212, 201, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "PI:", 212, 184, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "ID:", 212, 201, GreyoutColor, BackgroundColor, 16); } - tftPrint(-1, "PS:", 3, 193, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "RT:", 3, 221, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "PTY:", 3, 163, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "PS:", 3, 193, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "RT:", 3, 221, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "PTY:", 3, 163, GreyoutColor, BackgroundColor, 16); tft.drawLine(16, 143, 203, 143, GreyoutColor); tft.drawBitmap(68, 5, RDSLogo, 35, 22, GreyoutColor); } @@ -2346,24 +2346,24 @@ void SelectBand() { doBW(); if (!screenmute) { if (radio.rds.region == 0) { - tftPrint(-1, "PI:", 212, 193, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "PI:", 212, 193, GreyoutColor, BackgroundColor, 16); } else { - tftPrint(-1, "PI:", 212, 184, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "ID:", 212, 201, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "PI:", 212, 184, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "ID:", 212, 201, GreyoutColor, BackgroundColor, 16); } - tftPrint(-1, "PS:", 3, 193, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "RT:", 3, 221, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "PTY:", 3, 163, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "PS:", 3, 193, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "RT:", 3, 221, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "PTY:", 3, 163, GreyoutColor, BackgroundColor, 16); tft.drawBitmap(68, 5, RDSLogo, 35, 22, GreyoutColor); tft.fillRoundRect(249, 57, 30, 18, 2, GreyoutColor); - tftPrint(0, "iMS", 265, 59, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "iMS", 265, 59, BackgroundColor, GreyoutColor, 16); tft.fillRoundRect(287, 57, 30, 18, 2, GreyoutColor); - tftPrint(0, "EQ", 301, 59, BackgroundColor, GreyoutColor, 16); - tftReplace(-1, "MHz", "kHz", 258, 76, ActiveColor, ActiveColorSmooth, BackgroundColor, 28); + tftPrint(ACENTER, "EQ", 301, 59, BackgroundColor, GreyoutColor, 16); + tftReplace(ALEFT, "MHz", "kHz", 258, 76, ActiveColor, ActiveColorSmooth, BackgroundColor, 28); // todo - // if (band == AM_BAND_AIR) tftPrint(-1, "MHz", 258, 76, ActiveColor, ActiveColorSmooth, 28); - // else tftPrint(-1, "KHz", 258, 76, ActiveColor, ActiveColorSmooth, 28); + // if (band == AM_BAND_AIR) tftPrint(ALEFT, "MHz", 258, 76, ActiveColor, ActiveColorSmooth, 28); + // else tftPrint(ALEFT, "KHz", 258, 76, ActiveColor, ActiveColorSmooth, 28); } } else { if (tunemode == TUNE_MI_BAND) tunemode = TUNE_MAN; @@ -2381,16 +2381,16 @@ void SelectBand() { if (!externaltune && tunemode != TUNE_MEM) CheckBandForbiddenFM(); doBW(); if (radio.rds.region == 0) { - tftPrint(-1, "PI:", 212, 193, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PI:", 212, 193, ActiveColor, ActiveColorSmooth, 16); } else { - tftPrint(-1, "PI:", 212, 184, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "ID:", 212, 201, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PI:", 212, 184, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "ID:", 212, 201, ActiveColor, ActiveColorSmooth, 16); } - tftPrint(-1, "PS:", 3, 193, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "RT:", 3, 221, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "PTY:", 3, 163, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PS:", 3, 193, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "RT:", 3, 221, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PTY:", 3, 163, ActiveColor, ActiveColorSmooth, 16); - tftReplace(-1, "kHz", "MHz", 258, 76, ActiveColor, ActiveColorSmooth, BackgroundColor, 28); + tftReplace(ALEFT, "kHz", "MHz", 258, 76, ActiveColor, ActiveColorSmooth, BackgroundColor, 28); } if (!leave) radio.clearRDS(fullsearchrds); @@ -2407,25 +2407,25 @@ void SelectBand() { ShowTuneMode(); ShowStepSize(); - tftPrint(-1, textUI(102), 70, 32, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, textUI(103), 70, 32, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, textUI(104), 70, 32, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, textUI(105), 70, 32, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, textUI(106), 70, 32, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, textUI(102), 70, 32, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, textUI(103), 70, 32, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, textUI(104), 70, 32, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, textUI(105), 70, 32, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, textUI(106), 70, 32, BackgroundColor, BackgroundColor, 16); #ifdef HAS_AIR_BAND - tftPrint(-1, textUI(223), 70, 32, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, textUI(223), 70, 32, BackgroundColor, BackgroundColor, 16); #endif switch (band) { - case BAND_LW: tftPrint(-1, textUI(102), 70, 32, (bandforbidden ? GreyoutColor : PrimaryColor), (bandforbidden ? BackgroundColor : PrimaryColorSmooth), 16); break; - case BAND_MW: tftPrint(-1, textUI(103), 70, 32, (bandforbidden ? GreyoutColor : PrimaryColor), (bandforbidden ? BackgroundColor : PrimaryColorSmooth), 16); break; - case BAND_SW: tftPrint(-1, textUI(104), 70, 32, (bandforbidden ? GreyoutColor : PrimaryColor), (bandforbidden ? BackgroundColor : PrimaryColorSmooth), 16); break; - case BAND_FM: tftPrint(-1, textUI(105), 70, 32, (bandforbidden ? GreyoutColor : PrimaryColor), (bandforbidden ? BackgroundColor : PrimaryColorSmooth), 16); break; - case BAND_OIRT: tftPrint(-1, textUI(106), 70, 32, (bandforbidden ? GreyoutColor : PrimaryColor), (bandforbidden ? BackgroundColor : PrimaryColorSmooth), 16); break; + case BAND_LW: tftPrint(ALEFT, textUI(102), 70, 32, (bandforbidden ? GreyoutColor : PrimaryColor), (bandforbidden ? BackgroundColor : PrimaryColorSmooth), 16); break; + case BAND_MW: tftPrint(ALEFT, textUI(103), 70, 32, (bandforbidden ? GreyoutColor : PrimaryColor), (bandforbidden ? BackgroundColor : PrimaryColorSmooth), 16); break; + case BAND_SW: tftPrint(ALEFT, textUI(104), 70, 32, (bandforbidden ? GreyoutColor : PrimaryColor), (bandforbidden ? BackgroundColor : PrimaryColorSmooth), 16); break; + case BAND_FM: tftPrint(ALEFT, textUI(105), 70, 32, (bandforbidden ? GreyoutColor : PrimaryColor), (bandforbidden ? BackgroundColor : PrimaryColorSmooth), 16); break; + case BAND_OIRT: tftPrint(ALEFT, textUI(106), 70, 32, (bandforbidden ? GreyoutColor : PrimaryColor), (bandforbidden ? BackgroundColor : PrimaryColorSmooth), 16); break; #ifdef HAS_AIR_BAND - case BAND_AIR: tftPrint(-1, textUI(223), 70, 32, (bandforbidden ? GreyoutColor : PrimaryColor), (bandforbidden ? BackgroundColor : PrimaryColorSmooth), 16); break; + case BAND_AIR: tftPrint(ALEFT, textUI(223), 70, 32, (bandforbidden ? GreyoutColor : PrimaryColor), (bandforbidden ? BackgroundColor : PrimaryColorSmooth), 16); break; #endif } } @@ -2769,8 +2769,8 @@ void ButtonPress() { EEPROM.writeByte(EE_BYTE_BANDAUTOSW, nowToggleSWMIBand); EEPROM.commit(); if (!screenmute) { - tftPrint(0, "AUTO", 22, 60, BackgroundColor, BackgroundColor, 16); - tftPrint(0, "BAND", 22, 60, BackgroundColor, BackgroundColor, 16); + tftPrint(ACENTER, "AUTO", 22, 60, BackgroundColor, BackgroundColor, 16); + tftPrint(ACENTER, "BAND", 22, 60, BackgroundColor, BackgroundColor, 16); } doTuneMode(); ShowTuneMode(); @@ -2999,16 +2999,16 @@ void ShowMemoryPos() { break; } if (advancedRDS) { - tftReplace(-1, String(memoryposold + 1), String(memorypos + 1), 215, 36, SecondaryColor, SecondaryColorSmooth, BackgroundColor, 16); + tftReplace(ALEFT, String(memoryposold + 1), String(memorypos + 1), 215, 36, SecondaryColor, SecondaryColorSmooth, BackgroundColor, 16); } else { - tftReplace(-1, String(memoryposold + 1), String(memorypos + 1), 50, 32, memposcolor, memposcolorsmooth, BackgroundColor, 16); + tftReplace(ALEFT, String(memoryposold + 1), String(memorypos + 1), 50, 32, memposcolor, memposcolorsmooth, BackgroundColor, 16); } memoryposold = memorypos; } else { if (advancedRDS) { - tftPrint(-1, String(memorypos + 1), 215, 36, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, String(memorypos + 1), 215, 36, BackgroundColor, BackgroundColor, 16); } else { - tftPrint(-1, String(memorypos + 1), 50, 32, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, String(memorypos + 1), 50, 32, BackgroundColor, BackgroundColor, 16); } } } @@ -3171,10 +3171,10 @@ void ShowFreq(int mode) { if (!screenmute) { if (advancedRDS) { for (int i = 0; i < 33; i++) tft.fillCircle((6 * i) + 10, 133, 2, GreyoutColor); - tftReplace(1, String(freqold / 100) + "." + (freqold % 100 < 10 ? "0" : "") + String(freqold % 100), String(freq / 100) + "." + (freq % 100 < 10 ? "0" : "") + String(freq % 100), 273, 35, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16); + tftReplace(ARIGHT, String(freqold / 100) + "." + (freqold % 100 < 10 ? "0" : "") + String(freqold % 100), String(freq / 100) + "." + (freq % 100 < 10 ? "0" : "") + String(freq % 100), 273, 35, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16); freqold = freq; } else if (afscreen) { - tftReplace(1, String(freqold / 100) + "." + (freqold % 100 < 10 ? "0" : "") + String(freqold % 100) + " MHz", String(freq / 100) + "." + (freq % 100 < 10 ? "0" : "") + String(freq % 100), 290, 201, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 16); + tftReplace(ARIGHT, String(freqold / 100) + "." + (freqold % 100 < 10 ? "0" : "") + String(freqold % 100) + " MHz", String(freq / 100) + "." + (freq % 100 < 10 ? "0" : "") + String(freq % 100), 290, 201, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 16); freqold = freq; } else { switch (freqfont) { @@ -3286,12 +3286,12 @@ void ShowSignalLevel() { SNRupdatetimer = millis(); if (!advancedRDS) { if (CN > (CNold + 1) || CN < (CNold - 1)) { - if (CNold == 0) tftPrint(1, "--", 234, 165, BackgroundColor, BackgroundColor, 16); else tftPrint(1, String(CNold), 234, 165, BackgroundColor, BackgroundColor, 16); + if (CNold == 0) tftPrint(ARIGHT, "--", 234, 165, BackgroundColor, BackgroundColor, 16); else tftPrint(ARIGHT, String(CNold), 234, 165, BackgroundColor, BackgroundColor, 16); if (tuned) { - if (CN == 0) tftPrint(1, "--", 234, 165, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, String(CN), 234, 165, PrimaryColor, PrimaryColorSmooth, 16); + if (CN == 0) tftPrint(ARIGHT, "--", 234, 165, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(ARIGHT, String(CN), 234, 165, PrimaryColor, PrimaryColorSmooth, 16); CNold = CN; } else { - tftPrint(1, "--", 234, 165, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ARIGHT, "--", 234, 165, PrimaryColor, PrimaryColorSmooth, 16); CNold = 0; } } @@ -3299,7 +3299,7 @@ void ShowSignalLevel() { MPprint = constrain(map(MP, 0, 1000, 0, 99), 0, 99); if (MPprint != MPold) { - tftReplace(1, String(MPold), (band < BAND_GAP ? String(MPprint) : "--"), 299, 165, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16); + tftReplace(ARIGHT, String(MPold), (band < BAND_GAP ? String(MPprint) : "--"), 299, 165, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16); MPold = MPprint; } @@ -3307,7 +3307,7 @@ void ShowSignalLevel() { USprint = constrain(map(US, 0, 1000, 0, 99), 0, 99); if (USprint != USold) { - tftReplace(1, String(USold), (band < BAND_GAP ? String(USprint) : "--"), 299, 147, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16); + tftReplace(ARIGHT, String(USold), (band < BAND_GAP ? String(USprint) : "--"), 299, 147, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16); USold = USprint; } } @@ -3324,15 +3324,15 @@ void ShowSignalLevel() { if (SStatusprint > (SStatusold + 3) || SStatusprint < (SStatusold - 3)) { if (advancedRDS) { - tftReplace(1, String(SStatusold / 10) + "." + String(abs(SStatusold % 10)), + tftReplace(ARIGHT, String(SStatusold / 10) + "." + String(abs(SStatusold % 10)), String(SStatusprint / 10) + "." + String(abs(SStatusprint % 10)), 273, 51, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16); } else { if (SStatusold / 10 != SStatusprint / 10) { - tftReplace(1, String(SStatusold / 10), String(SStatusprint / 10), + tftReplace(ARIGHT, String(SStatusold / 10), String(SStatusprint / 10), 280, 104, FreqColor, FreqColorSmooth, BackgroundColor, 48); } - tftReplace(-1, "." + String(abs(SStatusold % 10)), + tftReplace(ALEFT, "." + String(abs(SStatusold % 10)), "." + String(abs(SStatusprint % 10)), 285, 102, FreqColor, FreqColorSmooth, BackgroundColor, 28); @@ -3533,7 +3533,7 @@ void ShowBW() { } if (BW != BWOld || BWreset) { - if (BWset == 0) tftReplace(1, String (BWOld, DEC), String (BW, DEC), 203, 4, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 28); else tftReplace(1, String (BWOld, DEC), String (BW, DEC), 203, 4, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 28); + if (BWset == 0) tftReplace(ARIGHT, String (BWOld, DEC), String (BW, DEC), 203, 4, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 28); else tftReplace(ARIGHT, String (BWOld, DEC), String (BW, DEC), 203, 4, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 28); BWOld = BW; BWreset = false; if (wifi) { @@ -3786,13 +3786,13 @@ void updateBW() {//todo air if (BWset == 0) { if (!BWtune && !screenmute && !advancedRDS && !afscreen && !rdsstatscreen) { tft.fillRoundRect(248, 36, 69, 18, 2, SecondaryColor); - tftPrint(0, "AUTO BW", 282, 38, BackgroundColor, SecondaryColor, 16); + tftPrint(ACENTER, "AUTO BW", 282, 38, BackgroundColor, SecondaryColor, 16); } radio.setFMABandw(); } else { if (!BWtune && !screenmute && !advancedRDS && !afscreen && !rdsstatscreen) { tft.fillRoundRect(248, 36, 69, 18, 2, GreyoutColor); - tftPrint(0, "AUTO BW", 282, 38, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "AUTO BW", 282, 38, BackgroundColor, GreyoutColor, 16); } } } @@ -3802,13 +3802,13 @@ void updateiMS() { if (iMSset == 0) { if (!screenmute && !advancedRDS && !afscreen && !rdsstatscreen && !BWtune) { tft.fillRoundRect(249, 57, 30, 18, 2, SecondaryColor); - tftPrint(0, "iMS", 265, 59, BackgroundColor, SecondaryColor, 16); + tftPrint(ACENTER, "iMS", 265, 59, BackgroundColor, SecondaryColor, 16); } radio.setiMS(1); } else { if (!screenmute && !advancedRDS && !afscreen && !rdsstatscreen && !BWtune) { tft.fillRoundRect(249, 57, 30, 18, 2, GreyoutColor); - tftPrint(0, "iMS", 265, 59, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "iMS", 265, 59, BackgroundColor, GreyoutColor, 16); } radio.setiMS(0); } @@ -3820,13 +3820,13 @@ void updateEQ() { if (EQset == 0) { if (!screenmute && !advancedRDS && !afscreen && !rdsstatscreen && !BWtune) { tft.fillRoundRect(287, 57, 30, 18, 2, SecondaryColor); - tftPrint(0, "EQ", 301, 59, BackgroundColor, SecondaryColor, 16); + tftPrint(ACENTER, "EQ", 301, 59, BackgroundColor, SecondaryColor, 16); } radio.setEQ(1); } else { if (!screenmute && !advancedRDS && !afscreen && !rdsstatscreen && !BWtune) { tft.fillRoundRect(287, 57, 30, 18, 2, GreyoutColor); - tftPrint(0, "EQ", 301, 59, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "EQ", 301, 59, BackgroundColor, GreyoutColor, 16); } radio.setEQ(0); } @@ -3837,9 +3837,9 @@ void updateCodetect() { if ( band > BAND_GAP && band != BAND_AIR) { if (WAM) { - tftPrint(-1, "CO", 50, 61, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ALEFT, "CO", 50, 61, PrimaryColor, PrimaryColorSmooth, 16); } else { - tftPrint(-1, "CO", 50, 61, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, "CO", 50, 61, BackgroundColor, BackgroundColor, 16); } } } @@ -4008,67 +4008,67 @@ void ShowTuneMode() { switch (tunemode) { case TUNE_MAN: if (band == BAND_SW && nowToggleSWMIBand) { - tftPrint(0, "AUTO", 22, 60, GreyoutColor, GreyoutColor, 16); + tftPrint(ACENTER, "AUTO", 22, 60, GreyoutColor, GreyoutColor, 16); tft.fillRoundRect(2, 58, 40, 18, 2, GreyoutColor); - tftPrint(0, "BAND", 22, 60, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "BAND", 22, 60, BackgroundColor, GreyoutColor, 16); } else { - tftPrint(0, "BAND", 22, 60, GreyoutColor, GreyoutColor, 16); + tftPrint(ACENTER, "BAND", 22, 60, GreyoutColor, GreyoutColor, 16); tft.fillRoundRect(2, 58, 40, 18, 2, GreyoutColor); - tftPrint(0, "AUTO", 22, 60, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "AUTO", 22, 60, BackgroundColor, GreyoutColor, 16); } tft.fillRoundRect(2, 36, 40, 18, 2, SecondaryColor); - tftPrint(0, "MAN", 22, 38, BackgroundColor, SecondaryColor, 16); + tftPrint(ACENTER, "MAN", 22, 38, BackgroundColor, SecondaryColor, 16); tft.fillRoundRect(2, 80, 40, 18, 2, GreyoutColor); - tftPrint(0, "MEM", 22, 82, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "MEM", 22, 82, BackgroundColor, GreyoutColor, 16); break; case TUNE_AUTO: tft.fillRoundRect(2, 58, 40, 18, 2, SecondaryColor); - tftPrint(0, "AUTO", 22, 60, BackgroundColor, SecondaryColor, 16); + tftPrint(ACENTER, "AUTO", 22, 60, BackgroundColor, SecondaryColor, 16); tft.fillRoundRect(2, 36, 40, 18, 2, GreyoutColor); - tftPrint(0, "MAN", 22, 38, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "MAN", 22, 38, BackgroundColor, GreyoutColor, 16); tft.fillRoundRect(2, 80, 40, 18, 2, GreyoutColor); - tftPrint(0, "MEM", 22, 82, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "MEM", 22, 82, BackgroundColor, GreyoutColor, 16); break; case TUNE_MEM: if (band == BAND_SW && nowToggleSWMIBand) { - tftPrint(0, "AUTO", 22, 60, GreyoutColor, GreyoutColor, 16); + tftPrint(ACENTER, "AUTO", 22, 60, GreyoutColor, GreyoutColor, 16); tft.fillRoundRect(2, 58, 40, 18, 2, GreyoutColor); - tftPrint(0, "BAND", 22, 60, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "BAND", 22, 60, BackgroundColor, GreyoutColor, 16); } else { - tftPrint(0, "BAND", 22, 60, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "BAND", 22, 60, BackgroundColor, GreyoutColor, 16); tft.fillRoundRect(2, 58, 40, 18, 2, GreyoutColor); - tftPrint(0, "AUTO", 22, 60, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "AUTO", 22, 60, BackgroundColor, GreyoutColor, 16); } tft.fillRoundRect(2, 36, 40, 18, 2, GreyoutColor); - tftPrint(0, "MAN", 22, 38, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "MAN", 22, 38, BackgroundColor, GreyoutColor, 16); if (memorystore) { tft.fillRoundRect(2, 80, 40, 18, 2, SignificantColor); - tftPrint(0, "MEM", 22, 82, BackgroundColor, SignificantColor, 16); + tftPrint(ACENTER, "MEM", 22, 82, BackgroundColor, SignificantColor, 16); } else { tft.fillRoundRect(2, 80, 40, 18, 2, SecondaryColor); - tftPrint(0, "MEM", 22, 82, BackgroundColor, SecondaryColor, 16); + tftPrint(ACENTER, "MEM", 22, 82, BackgroundColor, SecondaryColor, 16); } break; case TUNE_MI_BAND: tft.fillRoundRect(2, 58, 40, 18, 2, SecondaryColor); - tftPrint(0, "BAND", 22, 60, BackgroundColor, SecondaryColor, 16); + tftPrint(ACENTER, "BAND", 22, 60, BackgroundColor, SecondaryColor, 16); tft.fillRoundRect(2, 36, 40, 18, 2, GreyoutColor); - tftPrint(0, "MAN", 22, 38, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "MAN", 22, 38, BackgroundColor, GreyoutColor, 16); tft.fillRoundRect(2, 80, 40, 18, 2, GreyoutColor); - tftPrint(0, "MEM", 22, 82, BackgroundColor, GreyoutColor, 16); + tftPrint(ACENTER, "MEM", 22, 82, BackgroundColor, GreyoutColor, 16); break; } } @@ -4134,10 +4134,10 @@ void ShowBattery() { float vPer = constrain((batteryV - BATTERY_LOW_VALUE) / (BATTERY_FULL_VALUE - BATTERY_LOW_VALUE), 0.0, 0.99) * 100; if (abs(batteryV - batteryVold) > 0.05 && batteryoptions == BATTERY_VALUE) { - tftPrint(-1, String(batteryV, 2) + "V", 279, 9, BatteryValueColor, BatteryValueColorSmooth, 16); + tftPrint(ALEFT, String(batteryV, 2) + "V", 279, 9, BatteryValueColor, BatteryValueColorSmooth, 16); batteryVold = batteryV; } else if (int(vPer) != int(vPerold) && batteryoptions == BATTERY_PERCENT && abs(vPer - vPerold) > 0.5) { - tftPrint(-1, String(vPer, 0) + "%", 279, 9, BatteryValueColor, BatteryValueColorSmooth, 16); + tftPrint(ALEFT, String(vPer, 0) + "%", 279, 9, BatteryValueColor, BatteryValueColorSmooth, 16); vPerold = vPer; } } @@ -4431,7 +4431,7 @@ void SetTunerPatch() { analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255)); if (TEF != 102 && TEF != 205) { - tftPrint(0, textUI(35), 150, 78, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(35), 150, 78, ActiveColor, ActiveColorSmooth, 28); for (;;); } EEPROM.writeByte(EE_BYTE_TEF, TEF); @@ -4795,7 +4795,7 @@ void cancelDXScan() { if (!flashing) { tft.fillRoundRect(2, 80, 40, 18, 2, SecondaryColor); - tftPrint(0, "MEM", 22, 82, BackgroundColor, SecondaryColor, 16); + tftPrint(ACENTER, "MEM", 22, 82, BackgroundColor, SecondaryColor, 16); } SQ = false; @@ -5074,7 +5074,7 @@ uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, ui tft.drawRect(59, 109, 202, 8, FrameColor); tft.fillRect(60, 110, 200, 6, GreyoutColor); - tftPrint(1, textUI(272), 120, 155, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ARIGHT, textUI(272), 120, 155, ActiveColor, ActiveColorSmooth, 16); for (frequency = startfreq * 10; frequency <= stopfreq * 10; frequency += 10) { if (stopScanning) { diff --git a/src/comms.cpp b/src/comms.cpp index 57b861e..cc46560 100644 --- a/src/comms.cpp +++ b/src/comms.cpp @@ -554,14 +554,14 @@ void XDRGTKRoutine() { if (autosquelch) { DataPrint("H1\n"); if (!screenmute) { - tftPrint(-1, "SQ:", 212, 145, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "SQ:", 212, 145, ActiveColor, ActiveColorSmooth, 16); showAutoSquelch(1); } } else { DataPrint("H0\n"); if (!screenmute) { if (!usesquelch) { - tftPrint(-1, "SQ:", 212, 145, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, "SQ:", 212, 145, BackgroundColor, BackgroundColor, 16); showAutoSquelch(0); } else { Squelch = -150; @@ -804,7 +804,7 @@ void XDRGTKRoutine() { if (!screenmute) { tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); - tftPrint(0, textUI(34), 160, 100, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(34), 160, 100, ActiveColor, ActiveColorSmooth, 28); } DataPrint("U"); @@ -985,9 +985,9 @@ void tryWiFi() { webserver.begin(); NTPupdate(); remoteip = IPAddress (WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient); - if (!setupmode) tftPrint(0, textUI(57), 155, 128, InsignificantColor, InsignificantColorSmooth, 28); + if (!setupmode) tftPrint(ACENTER, textUI(57), 155, 128, InsignificantColor, InsignificantColorSmooth, 28); } else { - if (!setupmode) tftPrint(0, textUI(56), 155, 128, SignificantColor, SignificantColorSmooth, 28); + if (!setupmode) tftPrint(ACENTER, textUI(56), 155, 128, SignificantColor, SignificantColorSmooth, 28); Server.end(); webserver.stop(); Udp.stop(); diff --git a/src/constants.h b/src/constants.h index 8c652ec..1ef9a19 100644 --- a/src/constants.h +++ b/src/constants.h @@ -3,9 +3,13 @@ #define VERSION "v2.20.4" -#define ON 1 -#define OFF 0 -#define REVERSE false +#define ON 1 +#define OFF 0 +#define REVERSE false + +#define ALEFT -1 +#define ACENTER 0 +#define ARIGHT 1 #define MAX(x, y) ((x) < (y) ? (y) : (x)) #define MIN(X, Y) ({\ @@ -649,31 +653,31 @@ static const uint8_t WiFi2[] PROGMEM = { }; static const uint8_t WiFi3[] PROGMEM = { - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x07, 0x80, 0x00, - 0x00, 0x3f, 0xf0, 0x00, - 0x00, 0x7f, 0xfc, 0x00, - 0x01, 0xff, 0xfe, 0x00, - 0x03, 0xff, 0xff, 0x00, - 0x03, 0xff, 0xff, 0x80, - 0x07, 0xff, 0xff, 0x80, - 0x0f, 0xff, 0xff, 0xc0, - 0x0f, 0xff, 0xff, 0xc0, - 0x07, 0xff, 0xff, 0x80, - 0x03, 0xff, 0xff, 0x00, - 0x01, 0xff, 0xfe, 0x00, - 0x00, 0xff, 0xfc, 0x00, - 0x00, 0x7f, 0xf8, 0x00, - 0x00, 0x3f, 0xf0, 0x00, - 0x00, 0x1f, 0xc0, 0x00, - 0x00, 0x0f, 0x80, 0x00, - 0x00, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x80, 0x00, + 0x00, 0x3f, 0xf0, 0x00, + 0x00, 0x7f, 0xfc, 0x00, + 0x01, 0xff, 0xfe, 0x00, + 0x03, 0xff, 0xff, 0x00, + 0x03, 0xff, 0xff, 0x80, + 0x07, 0xff, 0xff, 0x80, + 0x0f, 0xff, 0xff, 0xc0, + 0x0f, 0xff, 0xff, 0xc0, + 0x07, 0xff, 0xff, 0x80, + 0x03, 0xff, 0xff, 0x00, + 0x01, 0xff, 0xfe, 0x00, + 0x00, 0xff, 0xfc, 0x00, + 0x00, 0x7f, 0xf8, 0x00, + 0x00, 0x3f, 0xf0, 0x00, + 0x00, 0x1f, 0xc0, 0x00, + 0x00, 0x0f, 0x80, 0x00, + 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; static const uint8_t WiFi4[] PROGMEM = { diff --git a/src/gui.cpp b/src/gui.cpp index e336e80..c531c72 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -502,15 +502,15 @@ void BuildRDSStatScreen() { tft.drawLine(240, 50, 240, 218, FrameColor); // --- Column headers --- - tftPrint(-1, "kHz", 205, 4, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ALEFT, "kHz", 205, 4, ActiveColor, ActiveColorSmooth, 28); // --- Labels above packet columns --- - tftPrint(-1, "ERRORS", 3, 34, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "A:", 66, 34, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "B:", 104, 34, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "C:", 142, 34, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "D:", 180, 34, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "BER", 250, 34, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "ERRORS", 3, 34, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "A:", 66, 34, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "B:", 104, 34, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "C:", 142, 34, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "D:", 180, 34, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "BER", 250, 34, ActiveColor, ActiveColorSmooth, 16); // --- Group labels setup --- const uint16_t xcol[4] = {10, 90, 170, 250}; // column X positions @@ -528,8 +528,8 @@ void BuildRDSStatScreen() { for (uint8_t col = 0; col < 4; col++) { // 4 columns for (uint8_t row = 0; row < 4; row++) { // 4 groups per column uint8_t g = col * 4 + row; // group index 0..15 - tftPrint(-1, groups[g][0], xcol[col], rowY[row * 2], ActiveColor, ActiveColorSmooth, 16); // A - tftPrint(-1, groups[g][1], xcol[col], rowY[row * 2 + 1], ActiveColor, ActiveColorSmooth, 16); // B + tftPrint(ALEFT, groups[g][0], xcol[col], rowY[row * 2], ActiveColor, ActiveColorSmooth, 16); // A + tftPrint(ALEFT, groups[g][1], xcol[col], rowY[row * 2 + 1], ActiveColor, ActiveColorSmooth, 16); // B } } @@ -537,8 +537,8 @@ void BuildRDSStatScreen() { const uint16_t pctX[4] = {70, 150, 230, 310}; for (uint8_t c = 0; c < 4; c++) { for (uint8_t y = 56; y < 216; y += 20) { - tftPrint(1, "0.0", pctX[c] - 10, y, GreyoutColor, BackgroundColor, 16); // placeholder value - tftPrint(0, "%", pctX[c], y, GreyoutColor, BackgroundColor, 16); + tftPrint(ARIGHT, "0.0", pctX[c] - 10, y, GreyoutColor, BackgroundColor, 16); // placeholder value + tftPrint(ACENTER, "%", pctX[c], y, GreyoutColor, BackgroundColor, 16); } } @@ -568,7 +568,7 @@ void BuildAFScreen() { if (!afscreen && RDSstatus) { tft.drawRoundRect(20, 30, 274, 170, 5, ActiveColor); tft.fillRoundRect(22, 32, 270, 166, 5, BackgroundColor); - tftPrint(0, textUI(34), 155, 98, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(34), 155, 98, ActiveColor, ActiveColorSmooth, 28); radio.TestAFEON(); } afscreen = true; @@ -585,12 +585,12 @@ void BuildAFScreen() { tft.drawLine(105, 30, 105, 0, FrameColor); tft.drawLine(162, 30, 162, 0, FrameColor); tft.drawLine(248, 30, 248, 0, FrameColor); - tftPrint(-1, "kHz", 205, 4, ActiveColor, ActiveColorSmooth, 28); - tftPrint(0, textUI(33), 160, 222, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "kHz", 205, 4, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(33), 160, 222, ActiveColor, ActiveColorSmooth, 16); if (afpagenr == 1) { - if (!radio.rds.hasAF) tftPrint(-1, textUI(87), 6, 48, PrimaryColor, PrimaryColorSmooth, 16); + if (!radio.rds.hasAF) tftPrint(ALEFT, textUI(87), 6, 48, PrimaryColor, PrimaryColorSmooth, 16); } else if (afpagenr == 2) { - if (!radio.rds.hasEON) tftPrint(-1, textUI(88), 6, 48, PrimaryColor, PrimaryColorSmooth, 16); + if (!radio.rds.hasEON) tftPrint(ALEFT, textUI(88), 6, 48, PrimaryColor, PrimaryColorSmooth, 16); } RDSstatusold = !RDSstatusold; ShowFreq(0); @@ -625,7 +625,7 @@ void BuildAFScreen() { } for (byte i = 0; i < 20; i++) std::memset(eonpicodeold[i], '\0', sizeof(eonpicodeold[i])); - if (afpagenr == 1 && radio.rds.hasDABAF && radio.rds.dabaffreq != 0) tftPrint(1, "DAB: " + String(radio.rds.dabafchannel) + " (" + String(radio.rds.dabafeid) + ")", 166, 32, SecondaryColor, SecondaryColorSmooth, 16); + if (afpagenr == 1 && radio.rds.hasDABAF && radio.rds.dabaffreq != 0) tftPrint(ARIGHT, "DAB: " + String(radio.rds.dabafchannel) + " (" + String(radio.rds.dabafeid) + ")", 166, 32, SecondaryColor, SecondaryColorSmooth, 16); } @@ -2870,7 +2870,7 @@ void BuildBWSelector() { case 7: tft.pushImage (0, 0, 320, 240, configurationbackground_wo); break; default: tft.pushImage (0, 0, 320, 240, configurationbackground); break; } - tftPrint(0, textUI(285), 160, 6, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ACENTER, textUI(285), 160, 6, PrimaryColor, PrimaryColorSmooth, 16); showBWSelector(); } @@ -2898,10 +2898,10 @@ void BuildMenu() { } if (!submenu) { - tftPrint(0, textUI(32), 160, 6, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ACENTER, textUI(32), 160, 6, PrimaryColor, PrimaryColorSmooth, 16); } else { - tftPrint(-1, textUI(184), (hardwaremodel == PORTABLE_TOUCH_ILI9341 ? 20 : 8), 6, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, textUI(189 + menupage - 1), 312, 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, textUI(184), (hardwaremodel == PORTABLE_TOUCH_ILI9341 ? 20 : 8), 6, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ARIGHT, textUI(189 + menupage - 1), 312, 6, ActiveColor, ActiveColorSmooth, 16); } if (hardwaremodel == PORTABLE_TOUCH_ILI9341) { @@ -2961,33 +2961,33 @@ void BuildAdvancedRDS() { tft.drawLine(210, 191, 320, 191, FrameColor); tft.drawLine(248, 30, 248, 0, FrameColor); - tftPrint(-1, "ERRORS", 3, 34, ActiveColor, ActiveColorSmooth, 16); - tftPrint(1, "MHz", 310, 35, ActiveColor, ActiveColorSmooth, 16); - tftPrint(1, unitString[unit], 310, 51, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "ERRORS", 3, 34, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ARIGHT, "MHz", 310, 35, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ARIGHT, unitString[unit], 310, 51, ActiveColor, ActiveColorSmooth, 16); if (radio.rds.region == 0) { - tftPrint(-1, "PI", 216, 81, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PI", 216, 81, ActiveColor, ActiveColorSmooth, 16); } else { - tftPrint(-1, "PI:", 216, 72, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "ID:", 216, 89, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PI:", 216, 72, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "ID:", 216, 89, ActiveColor, ActiveColorSmooth, 16); } - tftPrint(-1, "PS", 3, 81, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "PTY", 3, 109, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "RT+", 3, 147, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "AF", 3, 199, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "EON", 3, 174, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "RT", 3, 222, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PS", 3, 81, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PTY", 3, 109, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "RT+", 3, 147, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "AF", 3, 199, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "EON", 3, 174, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "RT", 3, 222, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "A:", 66, 34, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "B:", 104, 34, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "C:", 142, 34, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "D:", 180, 34, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "ECC", 214, 193, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "LIC", 214, 208, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "PIN", 214, 223, ActiveColor, ActiveColorSmooth, 16); - tftPrint(1, "Dynamic PTY", 300, 130, ActiveColor, ActiveColorSmooth, 16); - tftPrint(1, "Artificial head", 300, 145, ActiveColor, ActiveColorSmooth, 16); - tftPrint(1, "Compressed", 300, 160, ActiveColor, ActiveColorSmooth, 16); - tftPrint(1, "Has stereo", 300, 175, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "A:", 66, 34, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "B:", 104, 34, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "C:", 142, 34, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "D:", 180, 34, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "ECC", 214, 193, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "LIC", 214, 208, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PIN", 214, 223, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ARIGHT, "Dynamic PTY", 300, 130, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ARIGHT, "Artificial head", 300, 145, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ARIGHT, "Compressed", 300, 160, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ARIGHT, "Has stereo", 300, 175, ActiveColor, ActiveColorSmooth, 16); tft.fillCircle(86, 41, 5, SignificantColor); tft.fillCircle(124, 41, 5, SignificantColor); @@ -3001,7 +3001,7 @@ void BuildAdvancedRDS() { for (int i = 0; i < 33; i++) tft.fillCircle((6 * i) + 10, 133, 2, GreyoutColor); - tftPrint(-1, "kHz", 205, 4, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ALEFT, "kHz", 205, 4, ActiveColor, ActiveColorSmooth, 28); tft.drawBitmap(68, 5, RDSLogo, 35, 22, GreyoutColor); tft.drawBitmap(249, 4, Speaker, 28, 24, GreyoutColor); @@ -3012,15 +3012,15 @@ void BuildAdvancedRDS() { tft.drawBitmap(32, 5, Stereo, 32, 22, GreyoutColor); } - tftPrint(-1, "TP", 2, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "TA", 24, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "AF", 50, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "-B", 68, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "TMC", 88, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "RT+", 123, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "EON", 153, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "S", 185, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "M", 196, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "TP", 2, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "TA", 24, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "AF", 50, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "-B", 68, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "TMC", 88, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "RT+", 123, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "EON", 153, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "S", 185, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "M", 196, 51, GreyoutColor, BackgroundColor, 16); RDSstatusold = !RDSstatusold; ShowFreq(0); @@ -3106,41 +3106,41 @@ void BuildDisplay() { } } - if (usesquelch || autosquelch) tftPrint(-1, "SQ:", 197, 147, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "US:", 259, 147, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "MP:", 259, 165, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "CN:", 197, 165, ActiveColor, ActiveColorSmooth, 16); - tftPrint(1, "dB", 255, 165, ActiveColor, ActiveColorSmooth, 16); - tftPrint(1, "%", 316, 165, ActiveColor, ActiveColorSmooth, 16); - tftPrint(1, "%", 316, 147, ActiveColor, ActiveColorSmooth, 16); + if (usesquelch || autosquelch) tftPrint(ALEFT, "SQ:", 197, 147, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "US:", 259, 147, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "MP:", 259, 165, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "CN:", 197, 165, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ARIGHT, "dB", 255, 165, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ARIGHT, "%", 316, 165, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ARIGHT, "%", 316, 147, ActiveColor, ActiveColorSmooth, 16); - tftPrint(0, "S", 7, 101, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "1", 21, 115, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "3", 41, 115, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "5", 61, 115, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "7", 81, 115, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "9", 101, 115, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "+10", 127, 115, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "+30", 160, 115, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ACENTER, "S", 7, 101, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "1", 21, 115, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "3", 41, 115, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "5", 61, 115, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "7", 81, 115, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "9", 101, 115, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "+10", 127, 115, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "+30", 160, 115, ActiveColor, ActiveColorSmooth, 16); if (!showmodulation) { - tftPrint(0, "A", 7, 128, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "10", 24, 144, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "30", 54, 144, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "50", 84, 144, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "70", 114, 144, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "100", 160, 144, GreyoutColor, BackgroundColor, 16); + tftPrint(ACENTER, "A", 7, 128, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "10", 24, 144, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "30", 54, 144, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "50", 84, 144, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "70", 114, 144, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "100", 160, 144, GreyoutColor, BackgroundColor, 16); } else { - tftPrint(0, "A", 7, 128, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "10", 24, 144, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "30", 54, 144, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "50", 84, 144, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, "70", 114, 144, ActiveColor, BackgroundColor, 16); - tftPrint(-1, "100", 160, 144, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ACENTER, "A", 7, 128, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "10", 24, 144, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "30", 54, 144, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "50", 84, 144, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "70", 114, 144, ActiveColor, BackgroundColor, 16); + tftPrint(ALEFT, "100", 160, 144, ActiveColor, ActiveColorSmooth, 16); } - tftPrint(1, "kHz", 246, 4, ActiveColor, ActiveColorSmooth, 28); - tftPrint(1, unitString[unit], 316, 128, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ARIGHT, "kHz", 246, 4, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ARIGHT, unitString[unit], 316, 128, ActiveColor, ActiveColorSmooth, 16); tft.drawBitmap(68, 5, RDSLogo, 35, 22, GreyoutColor); tft.drawBitmap(249, 4, Speaker, 28, 24, GreyoutColor); @@ -4532,11 +4532,11 @@ void showMenuOpenTouchButtons() { if (!submenu && menuoption == ITEM9) { tft.fillRoundRect(240, 36, 60, 40, 6, FrameColor); tft.drawRoundRect(240, 36, 60, 40, 6, ActiveColor); - tftPrint(0, "OK", 270, 44, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); + tftPrint(ACENTER, "OK", 270, 44, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); } else { tft.fillRoundRect(130, 154, 60, 40, 6, FrameColor); tft.drawRoundRect(130, 154, 60, 40, 6, ActiveColor); - tftPrint(0, "OK", 160, 162, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); + tftPrint(ACENTER, "OK", 160, 162, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); } } } @@ -4556,7 +4556,7 @@ void DoMenu() { case 7: tft.pushImage (0, 0, 320, 240, configurationbackground_wo); break; default: tft.pushImage (0, 0, 320, 240, configurationbackground); break; } - tftPrint(0, textUI(189 + menupage - 1), 160, 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ACENTER, textUI(189 + menupage - 1), 160, 6, ActiveColor, ActiveColorSmooth, 16); } } @@ -4647,31 +4647,31 @@ void DoMenu() { menuopen = true; tft.drawRoundRect(10, 6, 300, 230, 5, ActiveColor); tft.fillRoundRect(12, 8, 296, 226, 5, BackgroundColor); - tftPrint(0, textUI(71), 155, 13, ActiveColor, ActiveColorSmooth, 28); - tftPrint(0, textUI(72), 155, 55, ActiveColor, ActiveColorSmooth, 28); - tftPrint(0, "PE5PVB", 155, 38, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, "ohmytime", 145, 80, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, "HyperDX", 145, 95, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, "MCelliotG", 155, 80, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, "andimik", 155, 95, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, "DXHR05", 145, 110, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, "NoobishSVK", 145, 125, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, "yo2ldk", 155, 110, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, "Justin_Peng(Portable)", 155, 125, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, "Overland DX", 145, 140, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, "elektronik232", 155, 140, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, "KOTYA8", 145, 155, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, "mrwish7", 155, 155, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, "lxsxl", 145, 170, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, "leryfm", 155, 170, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, "marsel90-1", 145, 185, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, "lawendel", 155, 185, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, "KB8U", 145, 200, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(0, "github.com/PE5PVB/TEF6686_ESP32", 155, 215, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ACENTER, textUI(71), 155, 13, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, textUI(72), 155, 55, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, "PE5PVB", 155, 38, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ARIGHT, "ohmytime", 145, 80, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ARIGHT, "HyperDX", 145, 95, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ALEFT, "MCelliotG", 155, 80, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ALEFT, "andimik", 155, 95, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ARIGHT, "DXHR05", 145, 110, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ARIGHT, "NoobishSVK", 145, 125, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ALEFT, "yo2ldk", 155, 110, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ALEFT, "Justin_Peng(Portable)", 155, 125, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ARIGHT, "Overland DX", 145, 140, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ALEFT, "elektronik232", 155, 140, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ARIGHT, "KOTYA8", 145, 155, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ALEFT, "mrwish7", 155, 155, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ARIGHT, "lxsxl", 145, 170, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ALEFT, "leryfm", 155, 170, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ARIGHT, "marsel90-1", 145, 185, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ALEFT, "lawendel", 155, 185, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ARIGHT, "KB8U", 145, 200, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ACENTER, "github.com/PE5PVB/TEF6686_ESP32", 155, 215, ActiveColor, ActiveColorSmooth, 16); if (hardwaremodel == PORTABLE_TOUCH_ILI9341) { tft.fillRoundRect(240, 36, 60, 40, 6, FrameColor); tft.drawRoundRect(240, 36, 60, 40, 6, ActiveColor); - tftPrint(0, "OK", 270, 44, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); + tftPrint(ACENTER, "OK", 270, 44, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); } break; } @@ -5329,10 +5329,10 @@ void DoMenu() { break; case ITEM3: { - tftPrint(0, textUI(53), 155, 58, ActiveColor, ActiveColorSmooth, 28); - tftPrint(0, "ESP_" + String(ESP_getChipId()), 155, 98, PrimaryColor, PrimaryColorSmooth, 28); - tftPrint(0, textUI(54), 155, 138, ActiveColor, ActiveColorSmooth, 28); - tftPrint(0, "http://192.168.4.1", 155, 174, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(ACENTER, textUI(53), 155, 58, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, "ESP_" + String(ESP_getChipId()), 155, 98, PrimaryColor, PrimaryColorSmooth, 28); + tftPrint(ACENTER, textUI(54), 155, 138, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, "http://192.168.4.1", 155, 174, PrimaryColor, PrimaryColorSmooth, 16); char key [9]; XDRGTK_key.toCharArray(key, 9); char rabbitearsuser [9]; @@ -5532,7 +5532,7 @@ void DoMenu() { if (hardwaremodel == PORTABLE_TOUCH_ILI9341) { tft.fillRoundRect(130, 154, 60, 40, 6, FrameColor); tft.drawRoundRect(130, 154, 60, 40, 6, ActiveColor); - tftPrint(0, "OK", 160, 162, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); + tftPrint(ACENTER, "OK", 160, 162, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); } break; } @@ -5544,21 +5544,21 @@ void DoMenu() { Infoboxprint(textUI(270)); switch (doAutoMemory(memstartfreq, memstopfreq, memstartpos, memstoppos, mempionly, memdoublepi)) { case 0: - tftPrint(0, textUI(275), 160, 175, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ACENTER, textUI(275), 160, 175, ActiveColor, ActiveColorSmooth, 16); break; case 1: - tftPrint(0, textUI(273), 160, 175, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ACENTER, textUI(273), 160, 175, ActiveColor, ActiveColorSmooth, 16); break; case 2: - tftPrint(0, textUI(274), 160, 175, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ACENTER, textUI(274), 160, 175, ActiveColor, ActiveColorSmooth, 16); break; } if (hardwaremodel == PORTABLE_TOUCH_ILI9341) { tft.fillRoundRect(240, 36, 60, 40, 6, FrameColor); tft.drawRoundRect(240, 36, 60, 40, 6, ActiveColor); - tftPrint(0, "OK", 270, 44, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); + tftPrint(ACENTER, "OK", 270, 44, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); } break; @@ -5641,7 +5641,7 @@ void DoMenu() { if (hardwaremodel == PORTABLE_TOUCH_ILI9341) { tft.fillRoundRect(240, 36, 60, 40, 6, FrameColor); tft.drawRoundRect(240, 36, 60, 40, 6, ActiveColor); - tftPrint(0, "OK", 270, 44, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); + tftPrint(ACENTER, "OK", 270, 44, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); } break; } @@ -5683,11 +5683,11 @@ void Infoboxprint(const char* input) { char* line2 = (char*)malloc((length - newlineIndex) * sizeof(char)); strcpy(line2, input + newlineIndex + 1); if (menu) { - tftPrint(0, line1, 155, 48, ActiveColor, ActiveColorSmooth, 28); - tftPrint(0, line2, 155, 78, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, line1, 155, 48, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, line2, 155, 78, ActiveColor, ActiveColorSmooth, 28); } else if (setupmode) { - tftPrint(0, line1, 155, 40, ActiveColor, ActiveColorSmooth, 28); - tftPrint(0, line2, 155, 70, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, line1, 155, 40, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, line2, 155, 70, ActiveColor, ActiveColorSmooth, 28); } else { FrequencySprite.drawString(line1, 100, 5); FrequencySprite.drawString(line2, 100, 25); @@ -5696,9 +5696,9 @@ void Infoboxprint(const char* input) { free(line2); } else { if (menu) { - tftPrint(0, input, 155, 78, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, input, 155, 78, ActiveColor, ActiveColorSmooth, 28); } else if (setupmode) { - tftPrint(0, input, 155, 70, ActiveColor, ActiveColorSmooth, 28); + tftPrint(ACENTER, input, 155, 70, ActiveColor, ActiveColorSmooth, 28); } else { FrequencySprite.drawString(input, 100, 15); } @@ -5758,7 +5758,7 @@ void drawButton(const char* text, byte button_number, bool active, bool selected if (button_number != 19) tft.fillRect(lineX, lineY, lineWidth, lineHeight, (active ? InsignificantColor : GreyoutColor)); // Draw the button text - tftPrint(0, text, x + buttonWidth / 2, y + (buttonHeight / 4) - 2, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ACENTER, text, x + buttonWidth / 2, y + (buttonHeight / 4) - 2, ActiveColor, ActiveColorSmooth, 16); } String shortLine(String text) { diff --git a/src/rds.cpp b/src/rds.cpp index c7b6324..492ad42 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -42,11 +42,11 @@ void ShowAdvancedRDS() { if (ptynold != radio.rds.PTYN || rdsreset) { if (!screenmute) { if (ptynold != "PTYN N/A" || radio.rds.hasPTYN) { - tftPrint(-1, "PTYN N/A", 216, 109, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, ptynold, 216, 109, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, "PTYN N/A", 216, 109, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, ptynold, 216, 109, BackgroundColor, BackgroundColor, 16); } if (!radio.rds.hasPTYN) radio.rds.PTYN = "PTYN N/A"; - tftPrint(-1, String(radio.rds.PTYN), 216, 109, RDSColor, RDSColorSmooth, 16); + tftPrint(ALEFT, String(radio.rds.PTYN), 216, 109, RDSColor, RDSColorSmooth, 16); ptynold = radio.rds.PTYN; } } @@ -55,10 +55,10 @@ void ShowAdvancedRDS() { if (!screenmute) { if (radio.rds.hasLIC) LICString = (radio.rds.LICtext.length() == 0 ? textUI(73) : radio.rds.LICtext); else LICString = "N/A"; if (LICString != LIColdString) { - tftPrint(-1, "N/A", 242, 208, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, LIColdString, 242, 208, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, "N/A", 242, 208, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, LIColdString, 242, 208, BackgroundColor, BackgroundColor, 16); } - tftPrint(-1, LICString, 242, 208, RDSColor, RDSColorSmooth, 16); + tftPrint(ALEFT, LICString, 242, 208, RDSColor, RDSColorSmooth, 16); LIColdString = LICString; licold = radio.rds.LIC; } @@ -67,10 +67,10 @@ void ShowAdvancedRDS() { String pinstring = String(radio.rds.pinDay) + " " + String(radio.rds.pinHour) + ":" + (radio.rds.pinMin < 10 ? "0" : "") + String(radio.rds.pinMin); if (pinstringold != pinstring) { if (!screenmute) { - tftPrint(-1, "N/A", 242, 223, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, pinstringold, 242, 223, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, "N/A", 242, 223, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, pinstringold, 242, 223, BackgroundColor, BackgroundColor, 16); - if (radio.rds.hasPIN) tftPrint(-1, pinstring, 242, 223, RDSColor, RDSColorSmooth, 16); else tftPrint(-1, "N/A", 242, 223, RDSColor, RDSColorSmooth, 16); + if (radio.rds.hasPIN) tftPrint(ALEFT, pinstring, 242, 223, RDSColor, RDSColorSmooth, 16); else tftPrint(ALEFT, "N/A", 242, 223, RDSColor, RDSColorSmooth, 16); pinstringold = pinstring; } } @@ -79,7 +79,7 @@ void ShowAdvancedRDS() { if (radio.rds.hasAF && radio.af_counter > 0) for (byte i = 0; i < radio.af_counter; i++) afstring += String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10) + (i == radio.af_counter - 1 ? " " : " | "); else afstring = textUI(87); if (hasafold != radio.rds.hasAF) { if (!screenmute) { - if (radio.rds.hasAF) tftPrint(-1, "AF", 50, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(-1, "AF", 50, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasAF) tftPrint(ALEFT, "AF", 50, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(ALEFT, "AF", 50, 51, GreyoutColor, BackgroundColor, 16); } hasafold = radio.rds.hasAF; } @@ -120,7 +120,7 @@ void ShowAdvancedRDS() { if (radio.eon_counter > 0) for (byte i = 0; i < radio.eon_counter; i++) eonstring += String(radio.eon[i].picode) + (radio.eon[i].ps.length() > 0 ? String(": " + String(radio.eon[i].ps)) : "") + (radio.eon[i].mappedfreq > 0 ? String(" " + String(radio.eon[i].mappedfreq / 100) + "." + String((radio.eon[i].mappedfreq % 100) / 10)) : "") + (radio.eon[i].mappedfreq2 > 0 ? String(" / " + String(radio.eon[i].mappedfreq2 / 100) + "." + String((radio.eon[i].mappedfreq2 % 100) / 10)) : "") + (radio.eon[i].mappedfreq3 > 0 ? String(" / " + String(radio.eon[i].mappedfreq3 / 100) + "." + String((radio.eon[i].mappedfreq3 % 100) / 10)) : "") + (i == radio.eon_counter - 1 ? " " : " | "); else eonstring = textUI(88); if (haseonold != radio.rds.hasEON) { if (!screenmute) { - if (radio.eon_counter > 0) tftPrint(-1, "EON", 153, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(-1, "EON", 153, 51, GreyoutColor, BackgroundColor, 16); + if (radio.eon_counter > 0) tftPrint(ALEFT, "EON", 153, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(ALEFT, "EON", 153, 51, GreyoutColor, BackgroundColor, 16); } haseonold = radio.rds.hasEON; } @@ -161,7 +161,7 @@ void ShowAdvancedRDS() { if (radio.rds.hasRDSplus) rtplusstring = (radio.rds.rdsplusTag1 != 169 ? String(textUI(radio.rds.rdsplusTag1)) + ": " + String(radio.rds.RTContent1) : "") + (radio.rds.rdsplusTag2 != 169 ? " - " + String(textUI(radio.rds.rdsplusTag2)) + ": " + String(radio.rds.RTContent2) : "") + " "; else rtplusstring = textUI(89); if (hasrtplusold != radio.rds.hasRDSplus) { if (!screenmute) { - if (radio.rds.hasRDSplus) tftPrint(-1, "RT+", 123, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(-1, "RT+", 123, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasRDSplus) tftPrint(ALEFT, "RT+", 123, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(ALEFT, "RT+", 123, 51, GreyoutColor, BackgroundColor, 16); } hasrtplusold = radio.rds.hasRDSplus; } @@ -200,21 +200,21 @@ void ShowAdvancedRDS() { if (TPold != radio.rds.hasTP) { if (!screenmute) { - if (radio.rds.hasTP) tftPrint(-1, "TP", 2, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(-1, "TP", 2, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasTP) tftPrint(ALEFT, "TP", 2, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(ALEFT, "TP", 2, 51, GreyoutColor, BackgroundColor, 16); } TPold = radio.rds.hasTP; } if (TAold != radio.rds.hasTA) { if (!screenmute) { - if (radio.rds.hasTA) tftPrint(-1, "TA", 24, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(-1, "TA", 24, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasTA) tftPrint(ALEFT, "TA", 24, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(ALEFT, "TA", 24, 51, GreyoutColor, BackgroundColor, 16); } TAold = radio.rds.hasTA; } if (afmethodBold != radio.afmethodB || rdsreset) { if (!screenmute) { - if (radio.afmethodB) tftPrint(-1, "-B", 68, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(-1, "-B", 68, 51, GreyoutColor, BackgroundColor, 16); + if (radio.afmethodB) tftPrint(ALEFT, "-B", 68, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(ALEFT, "-B", 68, 51, GreyoutColor, BackgroundColor, 16); } afmethodBold = radio.afmethodB; } @@ -223,18 +223,18 @@ void ShowAdvancedRDS() { if (!screenmute) { switch (radio.rds.MS) { case 0: - tftPrint(-1, "M", 196, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "S", 185, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "M", 196, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "S", 185, 51, GreyoutColor, BackgroundColor, 16); break; case 1: - tftPrint(-1, "M", 196, 51, RDSColor, RDSColorSmooth, 16); - tftPrint(-1, "S", 185, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "M", 196, 51, RDSColor, RDSColorSmooth, 16); + tftPrint(ALEFT, "S", 185, 51, GreyoutColor, BackgroundColor, 16); break; case 2: - tftPrint(-1, "M", 196, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "S", 185, 51, RDSColor, RDSColorSmooth, 16); + tftPrint(ALEFT, "M", 196, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(ALEFT, "S", 185, 51, RDSColor, RDSColorSmooth, 16); break; } } @@ -249,7 +249,7 @@ void ShowAdvancedRDS() { if (hastmcold != radio.rds.hasTMC) { if (!screenmute) { - if (radio.rds.hasTMC) tftPrint(-1, "TMC", 88, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(-1, "TMC", 88, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasTMC) tftPrint(ALEFT, "TMC", 88, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(ALEFT, "TMC", 88, 51, GreyoutColor, BackgroundColor, 16); } hastmcold = radio.rds.hasTMC; } @@ -285,10 +285,10 @@ void showECC() { if (!screenmute) { if (radio.rds.hasECC) ECCString = (radio.rds.ECCtext.length() == 0 ? textUI(73) : radio.rds.ECCtext); else ECCString = "N/A"; if (ECCString != ECColdString) { - tftPrint(-1, "N/A", 242, 193, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, ECColdString, 242, 193, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, "N/A", 242, 193, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, ECColdString, 242, 193, BackgroundColor, BackgroundColor, 16); } - tftPrint(-1, ECCString, 242, 193, RDSColor, RDSColorSmooth, 16); + tftPrint(ALEFT, ECCString, 242, 193, RDSColor, RDSColorSmooth, 16); } ECColdString = ECCString; } @@ -320,12 +320,12 @@ void readRds() { if (radio.rds.correctPI != 0 && !dropout) { if (!rdsstatscreen) { if (radio.rds.region == 0) { - tftPrint(0, PIold, 275, advancedRDS ? 75 : 187, + tftPrint(ACENTER, PIold, 275, advancedRDS ? 75 : 187, RDSDropoutColor, RDSDropoutColorSmooth, 28); } else { - tftPrint(-1, PIold, 240, advancedRDS ? 72 : 184, + tftPrint(ALEFT, PIold, 240, advancedRDS ? 72 : 184, RDSDropoutColor, RDSDropoutColorSmooth, 16); - tftPrint(-1, stationIDold, 240, advancedRDS ? 89 : 201, + tftPrint(ALEFT, stationIDold, 240, advancedRDS ? 89 : 201, RDSDropoutColor, RDSDropoutColorSmooth, 16); tftPrint( 1, stationStateold, 318, advancedRDS ? 89 : 201, RDSDropoutColor, RDSDropoutColorSmooth, 16); @@ -338,13 +338,13 @@ void readRds() { PSSprite.pushSprite(36, advancedRDS ? 72 : 185); } - tftPrint(-1, PTYold, 34, advancedRDS ? 109 : 163, + tftPrint(ALEFT, PTYold, 34, advancedRDS ? 109 : 163, RDSDropoutColor, RDSDropoutColorSmooth, 16); } if (rdsstatscreen && berPercentold != 100) { - tftReplace(1, String(berPercentold) + "%", "100%", + tftReplace(ARIGHT, String(berPercentold) + "%", "100%", 318, 34, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16); berPercentold = 100; } @@ -362,12 +362,12 @@ void readRds() { if (dropout || memreset) { if (!rdsstatscreen) { if (radio.rds.region == 0) { - tftPrint(0, PIold, 275, advancedRDS ? 75 : 187, + tftPrint(ACENTER, PIold, 275, advancedRDS ? 75 : 187, RDSColor, RDSColorSmooth, 28); } else { - tftPrint(-1, PIold, 240, advancedRDS ? 72 : 184, + tftPrint(ALEFT, PIold, 240, advancedRDS ? 72 : 184, RDSColor, RDSColorSmooth, 16); - tftPrint(-1, stationIDold, 240, advancedRDS ? 89 : 201, + tftPrint(ALEFT, stationIDold, 240, advancedRDS ? 89 : 201, RDSColor, RDSColorSmooth, 16); tftPrint( 1, stationStateold, 318, advancedRDS ? 89 : 201, advancedRDS ? RDSColor : RDSDropoutColor, @@ -396,7 +396,7 @@ void readRds() { PSSprite.pushSprite(36, advancedRDS ? 72 : 185); } - tftPrint(-1, PTYold, 34, advancedRDS ? 109 : 163, + tftPrint(ALEFT, PTYold, 34, advancedRDS ? 109 : 163, RDSColor, RDSColorSmooth, 16); if (!advancedRDS) { @@ -570,40 +570,40 @@ void showPI() { if (advancedRDS) { if (radio.rds.region == 0) { if (!RDSstatus) { - tftReplace(0, PIold, radio.rds.picode, 275, 75, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 28); + tftReplace(ACENTER, PIold, radio.rds.picode, 275, 75, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 28); } else { - tftReplace(0, PIold, radio.rds.picode, 275, 75, RDSColor, RDSColorSmooth, BackgroundColor, 28); + tftReplace(ACENTER, PIold, radio.rds.picode, 275, 75, RDSColor, RDSColorSmooth, BackgroundColor, 28); } } else { if (!RDSstatus) { - if (String(radio.rds.picode) != PIold) tftReplace(-1, PIold, radio.rds.picode, 240, 72, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); - tftReplace(-1, stationIDold, radio.rds.stationIDtext, 240, 89, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); + if (String(radio.rds.picode) != PIold) tftReplace(ALEFT, PIold, radio.rds.picode, 240, 72, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); + tftReplace(ALEFT, stationIDold, radio.rds.stationIDtext, 240, 89, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); } else { - if (String(radio.rds.picode) != PIold) tftReplace(-1, PIold, radio.rds.picode, 240, 72, RDSColor, RDSColorSmooth, BackgroundColor, 16); - tftReplace(-1, stationIDold, radio.rds.stationIDtext, 240, 89, RDSColor, RDSColorSmooth, BackgroundColor, 16); + if (String(radio.rds.picode) != PIold) tftReplace(ALEFT, PIold, radio.rds.picode, 240, 72, RDSColor, RDSColorSmooth, BackgroundColor, 16); + tftReplace(ALEFT, stationIDold, radio.rds.stationIDtext, 240, 89, RDSColor, RDSColorSmooth, BackgroundColor, 16); } - tftReplace(1, stationStateold, radio.rds.stationStatetext, 318, 89, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); + tftReplace(ARIGHT, stationStateold, radio.rds.stationStatetext, 318, 89, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); } } else if (afscreen) { - tftReplace(-1, PIold, radio.rds.picode, 30, 201, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 16); + tftReplace(ALEFT, PIold, radio.rds.picode, 30, 201, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 16); } else if (!rdsstatscreen) { if (radio.rds.region == 0) { if (!RDSstatus) { - tftReplace(0, PIold, radio.rds.picode, 275, 187, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 28); + tftReplace(ACENTER, PIold, radio.rds.picode, 275, 187, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 28); } else { - tftReplace(0, PIold, radio.rds.picode, 275, 187, RDSColor, RDSColorSmooth, BackgroundColor, 28); + tftReplace(ACENTER, PIold, radio.rds.picode, 275, 187, RDSColor, RDSColorSmooth, BackgroundColor, 28); } } else { if (!RDSstatus) { if (String(radio.rds.picode) != PIold || radio.rds.stationIDtext != stationIDold) { - tftReplace(-1, PIold, radio.rds.picode, 240, 184, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); - tftReplace(-1, stationIDold, radio.rds.stationIDtext, 240, 201, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); + tftReplace(ALEFT, PIold, radio.rds.picode, 240, 184, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); + tftReplace(ALEFT, stationIDold, radio.rds.stationIDtext, 240, 201, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); } } else { if (String(radio.rds.picode) != PIold || radio.rds.stationIDtext != stationIDold) { - tftReplace(-1, PIold, radio.rds.picode, 240, 184, RDSColor, RDSColorSmooth, BackgroundColor, 16); - tftReplace(-1, stationIDold, radio.rds.stationIDtext, 240, 201, RDSColor, RDSColorSmooth, BackgroundColor, 16); - tftReplace(1, stationStateold, radio.rds.stationStatetext, 318, 201, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); + tftReplace(ALEFT, PIold, radio.rds.picode, 240, 184, RDSColor, RDSColorSmooth, BackgroundColor, 16); + tftReplace(ALEFT, stationIDold, radio.rds.stationIDtext, 240, 201, RDSColor, RDSColorSmooth, BackgroundColor, 16); + tftReplace(ARIGHT, stationStateold, radio.rds.stationStatetext, 318, 201, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); } } } @@ -630,15 +630,15 @@ void showPTY() { if (!screenmute) { if (advancedRDS) { if (!RDSstatus) { - tftReplace(-1, PTYold, PTYString, 34, 109, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); + tftReplace(ALEFT, PTYold, PTYString, 34, 109, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); } else { - tftReplace(-1, PTYold, PTYString, 34, 109, RDSColor, RDSColorSmooth, BackgroundColor, 16); + tftReplace(ALEFT, PTYold, PTYString, 34, 109, RDSColor, RDSColorSmooth, BackgroundColor, 16); } } else { if (!RDSstatus) { - tftReplace(-1, PTYold, PTYString, 34, 163, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); + tftReplace(ALEFT, PTYold, PTYString, 34, 163, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); } else { - tftReplace(-1, PTYold, PTYString, 34, 163, RDSColor, RDSColorSmooth, BackgroundColor, 16); + tftReplace(ALEFT, PTYold, PTYString, 34, 163, RDSColor, RDSColorSmooth, BackgroundColor, 16); } } } @@ -666,7 +666,7 @@ void showPS() { // Handle AF screen update if (afscreen) { if (!screenmute) { - tftReplace(0, PSold, radio.rds.stationName, 160, 201, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 16); + tftReplace(ACENTER, PSold, radio.rds.stationName, 160, 201, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 16); } } else if (!rdsstatscreen) { // Handle long PS display @@ -844,17 +844,17 @@ void showCT() { } // Display the updated time and date - tftReplace(0, rds_clockold, rds_clock, 134, 1, RDSColor, RDSColorSmooth, BackgroundColor, 16); - tftReplace(0, rds_dateold, rds_date, 134, 15, RDSColor, RDSColorSmooth, BackgroundColor, 16); + tftReplace(ACENTER, rds_clockold, rds_clock, 134, 1, RDSColor, RDSColorSmooth, BackgroundColor, 16); + tftReplace(ACENTER, rds_dateold, rds_date, 134, 15, RDSColor, RDSColorSmooth, BackgroundColor, 16); } else { // Handle dropout scenarios if (rtcset) { // Display dropout message if RTC was set - tftReplace(0, rds_clockold, rds_clock, 134, 1, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); - tftReplace(0, rds_dateold, rds_date, 134, 15, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); + tftReplace(ACENTER, rds_clockold, rds_clock, 134, 1, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); + tftReplace(ACENTER, rds_dateold, rds_date, 134, 15, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); } else { // Clear and reprint the clock and date - tftPrint(0, rds_clockold, 134, 1, BackgroundColor, BackgroundColor, 16); - tftPrint(0, rds_clock, 134, 1, BackgroundColor, BackgroundColor, 16); - tftPrint(0, rds_dateold, 134, 15, BackgroundColor, BackgroundColor, 16); - tftPrint(0, rds_date, 134, 15, BackgroundColor, BackgroundColor, 16); + tftPrint(ACENTER, rds_clockold, 134, 1, BackgroundColor, BackgroundColor, 16); + tftPrint(ACENTER, rds_clock, 134, 1, BackgroundColor, BackgroundColor, 16); + tftPrint(ACENTER, rds_dateold, 134, 15, BackgroundColor, BackgroundColor, 16); + tftPrint(ACENTER, rds_date, 134, 15, BackgroundColor, BackgroundColor, 16); } } } @@ -1000,29 +1000,29 @@ void ShowAFEON() { if (radio.eon_counter > 9) { if (!afpage) { afpage = true; - tftPrint(1, String(afpagenr) + "/2", 315, 201, BackgroundColor, BackgroundColor, 16); + tftPrint(ARIGHT, String(afpagenr) + "/2", 315, 201, BackgroundColor, BackgroundColor, 16); } } - if (afpage) tftPrint(1, String(afpagenr) + "/3", 315, 201, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, String(afpagenr) + "/2", 315, 201, ActiveColor, ActiveColorSmooth, 16); + if (afpage) tftPrint(ARIGHT, String(afpagenr) + "/3", 315, 201, ActiveColor, ActiveColorSmooth, 16); else tftPrint(ARIGHT, String(afpagenr) + "/2", 315, 201, ActiveColor, ActiveColorSmooth, 16); if (radio.rds.hasAF && afpagenr == 1) { if (!hasafold) { - tftPrint(-1, textUI(87), 6, 48, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, "AF:", 4, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, textUI(87), 6, 48, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, "AF:", 4, 32, ActiveColor, ActiveColorSmooth, 16); hasafold = true; } if (af_counterold != radio.af_updatecounter) { tft.fillRect(2, 48, 316, 150, BackgroundColor); for (byte i = 0; i < radio.af_counter; i++) { - tftPrint(-1, (radio.afmethodB && !radio.af[i].regional && radio.af[i].same) ? "S " : (radio.afmethodB && radio.af[i].regional && radio.af[i].same) ? "M " : (radio.afmethodB && radio.af[i].regional && !radio.af[i].same) ? "R " : "", 10 + (i > 9 ? 54 : 0) + (i > 19 ? 54 : 0) + (i > 29 ? 54 : 0) + (i > 39 ? 54 : 0), 48 + (15 * i) - (i > 9 ? 150 : 0) - (i > 19 ? 150 : 0) - (i > 29 ? 150 : 0) - (i > 39 ? 150 : 0), ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, (radio.afmethodB && !radio.af[i].regional && radio.af[i].same) ? "S " : (radio.afmethodB && radio.af[i].regional && radio.af[i].same) ? "M " : (radio.afmethodB && radio.af[i].regional && !radio.af[i].same) ? "R " : "", 10 + (i > 9 ? 54 : 0) + (i > 19 ? 54 : 0) + (i > 29 ? 54 : 0) + (i > 39 ? 54 : 0), 48 + (15 * i) - (i > 9 ? 150 : 0) - (i > 19 ? 150 : 0) - (i > 29 ? 150 : 0) - (i > 39 ? 150 : 0), ActiveColor, ActiveColorSmooth, 16); if (radio.af[i].checked) { - tftPrint(1, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 55 + (i > 9 ? 54 : 0) + (i > 19 ? 54 : 0) + (i > 29 ? 54 : 0) + (i > 39 ? 54 : 0), 48 + (15 * i) - (i > 9 ? 150 : 0) - (i > 19 ? 150 : 0) - (i > 29 ? 150 : 0) - (i > 39 ? 150 : 0), InsignificantColor, InsignificantColorSmooth, 16); + tftPrint(ARIGHT, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 55 + (i > 9 ? 54 : 0) + (i > 19 ? 54 : 0) + (i > 29 ? 54 : 0) + (i > 39 ? 54 : 0), 48 + (15 * i) - (i > 9 ? 150 : 0) - (i > 19 ? 150 : 0) - (i > 29 ? 150 : 0) - (i > 39 ? 150 : 0), InsignificantColor, InsignificantColorSmooth, 16); } else if (!radio.af[i].afvalid) { - tftPrint(1, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 55 + (i > 9 ? 54 : 0) + (i > 19 ? 54 : 0) + (i > 29 ? 54 : 0) + (i > 39 ? 54 : 0), 48 + (15 * i) - (i > 9 ? 150 : 0) - (i > 19 ? 150 : 0) - (i > 29 ? 150 : 0) - (i > 39 ? 150 : 0), SignificantColor, SignificantColorSmooth, 16); + tftPrint(ARIGHT, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 55 + (i > 9 ? 54 : 0) + (i > 19 ? 54 : 0) + (i > 29 ? 54 : 0) + (i > 39 ? 54 : 0), 48 + (15 * i) - (i > 9 ? 150 : 0) - (i > 19 ? 150 : 0) - (i > 29 ? 150 : 0) - (i > 39 ? 150 : 0), SignificantColor, SignificantColorSmooth, 16); } else { - tftPrint(1, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 55 + (i > 9 ? 54 : 0) + (i > 19 ? 54 : 0) + (i > 29 ? 54 : 0) + (i > 39 ? 54 : 0), 48 + (15 * i) - (i > 9 ? 150 : 0) - (i > 19 ? 150 : 0) - (i > 29 ? 150 : 0) - (i > 39 ? 150 : 0), RDSColor, RDSColorSmooth, 16); + tftPrint(ARIGHT, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 55 + (i > 9 ? 54 : 0) + (i > 19 ? 54 : 0) + (i > 29 ? 54 : 0) + (i > 39 ? 54 : 0), 48 + (15 * i) - (i > 9 ? 150 : 0) - (i > 19 ? 150 : 0) - (i > 29 ? 150 : 0) - (i > 39 ? 150 : 0), RDSColor, RDSColorSmooth, 16); } } if (radio.af_counter > 10) tft.drawLine(59, 54, 59, 191, SecondaryColor); @@ -1035,11 +1035,11 @@ void ShowAFEON() { if (radio.eon_counter > 0 && afpagenr > 1) { if (!haseonold) { - tftPrint(-1, textUI(88), 6, 48, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, "PI", 4, 32, ActiveColor, ActiveColorSmooth, 16); - tftPrint(0, "TA", 250, 32, ActiveColor, ActiveColorSmooth, 16); - tftPrint(0, "TP", 276, 32, ActiveColor, ActiveColorSmooth, 16); - tftPrint(0, "PTY", 304, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, textUI(88), 6, 48, BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, "PI", 4, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ACENTER, "TA", 250, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ACENTER, "TP", 276, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ACENTER, "PTY", 304, 32, ActiveColor, ActiveColorSmooth, 16); haseonold = true; } @@ -1077,87 +1077,87 @@ void ShowAFEON() { } if (strcmp(eonpicodeold[i + y], radio.eon[i + y].picode) != 0) { - tftPrint(-1, eonpicodeold[i + y], 4, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, eonpicodeold[i + y], 4, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } - tftPrint(-1, radio.eon[i + y].picode, 4, 48 + (15 * i), RDSColor, RDSColorSmooth, 16); + tftPrint(ALEFT, radio.eon[i + y].picode, 4, 48 + (15 * i), RDSColor, RDSColorSmooth, 16); strcpy(eonpicodeold[i + y], radio.eon[i + y].picode); if (radio.eon[i + y].ps.length() > 0) { - tftPrint(-1, "PS", 46, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "PS", 46, 32, ActiveColor, ActiveColorSmooth, 16); if (strcmp(radio.eon[i + y].ps.c_str(), eonpsold[i + y].c_str()) != 0) { - tftPrint(-1, eonpsold[i + y].c_str(), 46, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, eonpsold[i + y].c_str(), 46, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } - tftPrint(-1, radio.eon[i + y].ps.c_str(), 46, 48 + (15 * i), RDSDropoutColor, RDSDropoutColorSmooth, 16); + tftPrint(ALEFT, radio.eon[i + y].ps.c_str(), 46, 48 + (15 * i), RDSDropoutColor, RDSDropoutColorSmooth, 16); eonpsold[i + y] = radio.eon[i + y].ps; } else { - tftPrint(-1, eonpsold[i + y].c_str(), 46, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, eonpsold[i + y].c_str(), 46, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } if (radio.eon[i + y].mappedfreq > 0) { - tftPrint(-1, "MF", 119, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "MF", 119, 32, ActiveColor, ActiveColorSmooth, 16); if (radio.eon[i + y].mappedfreq != mappedfreqold[i + y]) { char oldFreq[10]; dtostrf(mappedfreqold[i + y] / 100.0, 5, 1, oldFreq); - tftPrint(-1, oldFreq, 115, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, oldFreq, 115, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } char newFreq[10]; dtostrf(radio.eon[i + y].mappedfreq / 100.0, 5, 1, newFreq); - tftPrint(-1, newFreq, 115, 48 + (15 * i), RDSDropoutColor, RDSDropoutColorSmooth, 16); + tftPrint(ALEFT, newFreq, 115, 48 + (15 * i), RDSDropoutColor, RDSDropoutColorSmooth, 16); mappedfreqold[i + y] = radio.eon[i + y].mappedfreq; } else { char oldFreq[10]; dtostrf(mappedfreqold[i + y] / 100.0, 5, 1, oldFreq); - tftPrint(-1, oldFreq, 115, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, oldFreq, 115, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } if (radio.eon[i + y].mappedfreq2 > 0) { - tftPrint(-1, "MF2", 162, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "MF2", 162, 32, ActiveColor, ActiveColorSmooth, 16); if (radio.eon[i + y].mappedfreq2 != mappedfreqold2[i + y]) { char oldFreq2[10]; dtostrf(mappedfreqold2[i + y] / 100.0, 5, 1, oldFreq2); - tftPrint(-1, oldFreq2, 160, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, oldFreq2, 160, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } char newFreq2[10]; dtostrf(radio.eon[i + y].mappedfreq2 / 100.0, 5, 1, newFreq2); - tftPrint(-1, newFreq2, 160, 48 + (15 * i), RDSDropoutColor, RDSDropoutColorSmooth, 16); + tftPrint(ALEFT, newFreq2, 160, 48 + (15 * i), RDSDropoutColor, RDSDropoutColorSmooth, 16); mappedfreqold2[i + y] = radio.eon[i + y].mappedfreq2; } else { char oldFreq2[10]; dtostrf(mappedfreqold2[i + y] / 100.0, 5, 1, oldFreq2); - tftPrint(-1, oldFreq2, 160, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, oldFreq2, 160, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } if (radio.eon[i + y].mappedfreq3 > 0) { - tftPrint(-1, "MF3", 207, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(ALEFT, "MF3", 207, 32, ActiveColor, ActiveColorSmooth, 16); if (radio.eon[i + y].mappedfreq3 != mappedfreqold3[i + y]) { char oldFreq3[10]; dtostrf(mappedfreqold3[i + y] / 100.0, 5, 1, oldFreq3); - tftPrint(-1, oldFreq3, 205, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, oldFreq3, 205, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } char newFreq3[10]; dtostrf(radio.eon[i + y].mappedfreq3 / 100.0, 5, 1, newFreq3); - tftPrint(-1, newFreq3, 205, 48 + (15 * i), RDSDropoutColor, RDSDropoutColorSmooth, 16); + tftPrint(ALEFT, newFreq3, 205, 48 + (15 * i), RDSDropoutColor, RDSDropoutColorSmooth, 16); mappedfreqold3[i + y] = radio.eon[i + y].mappedfreq3; } else { char oldFreq3[10]; dtostrf(mappedfreqold3[i + y] / 100.0, 5, 1, oldFreq3); - tftPrint(-1, oldFreq3, 205, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(ALEFT, oldFreq3, 205, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } if (radio.eon[i + y].ptyset) { if (eonptyold[i + y] != radio.eon[i + y].pty) tft.fillRect(290, 48 + (15 * i), 29, 16, BackgroundColor); - if (radio.eon[i + y].pty != 254) tftPrint(1, String(radio.eon[i + y].pty), 310, 48 + (15 * i), RDSColor, RDSColorSmooth, 16); + if (radio.eon[i + y].pty != 254) tftPrint(ARIGHT, String(radio.eon[i + y].pty), 310, 48 + (15 * i), RDSColor, RDSColorSmooth, 16); eonptyold[i + y] = radio.eon[i + y].pty; } else { tft.fillRect(290, 48 + (15 * i), 29, 16, BackgroundColor); } - if (radio.eon[i + y].ta) tftPrint(0, "O", 250, 48 + (15 * i), RDSColor, RDSColorSmooth, 16); else tftPrint(0, "O", 250, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); - if (radio.eon[i + y].tp) tftPrint(0, "O", 276, 48 + (15 * i), RDSColor, RDSColorSmooth, 16); else tftPrint(0, "O", 276, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + if (radio.eon[i + y].ta) tftPrint(ACENTER, "O", 250, 48 + (15 * i), RDSColor, RDSColorSmooth, 16); else tftPrint(ACENTER, "O", 250, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + if (radio.eon[i + y].tp) tftPrint(ACENTER, "O", 276, 48 + (15 * i), RDSColor, RDSColorSmooth, 16); else tftPrint(ACENTER, "O", 276, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } } } @@ -1245,7 +1245,7 @@ void ShowRDSStatistics() { // --- Update total processed RDS blocks if changed --- if (processed_rdsblocksold[32] != radio.processed_rdsblocks) { - tftReplace(1, String(processed_rdsblocksold[32]), String(radio.processed_rdsblocks), + tftReplace(ARIGHT, String(processed_rdsblocksold[32]), String(radio.processed_rdsblocks), 318, 222, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16); processed_rdsblocksold[32] = radio.processed_rdsblocks; } @@ -1297,9 +1297,9 @@ void ShowRDSStatistics() { } // Update percentage display - tftReplace(1, oldBuf, newBuf, xpos, ypos, + tftReplace(ARIGHT, oldBuf, newBuf, xpos, ypos, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16); - tftPrint(0, "%", xposPct, ypos, + tftPrint(ACENTER, "%", xposPct, ypos, ActiveColor, ActiveColorSmooth, 16); // Draw current dot as "Insignificant" @@ -1341,7 +1341,7 @@ void ShowRDSStatistics() { // Update display if string changed if (HexString != HexStringold) { - tftReplace(0, HexStringold, HexString, + tftReplace(ACENTER, HexStringold, HexString, 160, 222, ActiveColor, ActiveColorSmooth, BackgroundColor, 16); HexStringold = HexString; } @@ -1388,7 +1388,7 @@ void ShowRDSStatistics() { // Update BER display only if value changed if (berPercentold != berPercent) { - tftReplace(1, String(berPercentold) + "%", String(berPercent) + "%", + tftReplace(ARIGHT, String(berPercentold) + "%", String(berPercent) + "%", 318, 34, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16); berPercentold = berPercent; } diff --git a/src/touch.cpp b/src/touch.cpp index f13cf1c..8ee9434 100644 --- a/src/touch.cpp +++ b/src/touch.cpp @@ -196,9 +196,8 @@ void doTouchEvent(uint16_t x, uint16_t y) { if (!BWtune && !menu && advancedRDS && !seek && !afscreen) { // Advanced RDS mode if (x > 0 && x < 320 && y > 120 && y < 170) { // ----------------- leave = true; - BuildDisplay(); + BuildDisplay(); // Switch to normal radio view SelectBand(); -// ScreensaverTimerReopen(); // Switch to normal radio view return; } else if (x > 0 && x < 320 && y > 180 && y < 240) { BuildAFScreen();