massive changes in sprite and fonts
This commit is contained in:
+3
-6
@@ -346,14 +346,11 @@ extern mem presets[EE_PRESETS_CNT];
|
||||
extern TEF6686 radio;
|
||||
|
||||
extern TFT_eSprite FrequencySprite;
|
||||
extern TFT_eSprite RDSSprite;
|
||||
extern TFT_eSprite SquelchSprite;
|
||||
extern TFT_eSprite FullLineSprite;
|
||||
extern TFT_eSprite OneBigLineSprite;
|
||||
extern TFT_eSprite SignalSprite;
|
||||
extern TFT_eSprite PSSprite;
|
||||
extern TFT_eSprite PTYSprite;
|
||||
extern TFT_eSprite CTSprite;
|
||||
extern TFT_eSprite SettingsSprite;
|
||||
extern TFT_eSprite General16Sprite;
|
||||
extern TFT_eSprite General28Sprite;
|
||||
|
||||
extern WiFiConnect wc;
|
||||
extern WiFiServer Server;
|
||||
|
||||
+3
-1
@@ -15,4 +15,6 @@ void timeToDateTime(time_t t, struct RX8010SJ::DateTime* dateTime);
|
||||
time_t dateTimeToTime(const struct RX8010SJ::DateTime* dateTime);
|
||||
|
||||
void sync_to_rx_rtc(int32_t offset = 0);
|
||||
void sync_from_rx_rtc(int32_t offset = 0);
|
||||
void sync_from_rx_rtc(int32_t offset = 0);
|
||||
time_t get_time();
|
||||
void set_time(time_t time);
|
||||
@@ -9,6 +9,8 @@ private:
|
||||
int yPos;
|
||||
int maxWidth;
|
||||
int xPos;
|
||||
int usedX;
|
||||
int usedY;
|
||||
int textWidth;
|
||||
unsigned long lastTick;
|
||||
unsigned long holdTick;
|
||||
@@ -19,9 +21,9 @@ private:
|
||||
static const unsigned long HOLD_DURATION = 2000;
|
||||
|
||||
public:
|
||||
ScrollingTextDisplay(TFT_eSprite* spr, int y, int maxW)
|
||||
ScrollingTextDisplay(TFT_eSprite* spr, int y, int maxW, int spriteX, int spriteY)
|
||||
: sprite(spr), yPos(y), maxWidth(maxW),
|
||||
xPos(0), textWidth(0), lastTick(0), holdTick(0), isScrolling(false), postDrawCallback(nullptr) {}
|
||||
xPos(0), usedX(spriteX), usedY(spriteY), textWidth(0), lastTick(0), holdTick(0), isScrolling(false), postDrawCallback(nullptr) {}
|
||||
|
||||
void setPostDrawCallback(std::function<void(TFT_eSprite*, bool)> callback) {
|
||||
postDrawCallback = callback;
|
||||
@@ -71,12 +73,15 @@ public:
|
||||
|
||||
private:
|
||||
void drawText(const String& text, bool status, uint16_t activeColor, uint16_t activeSmooth, uint16_t dropoutColor, uint16_t dropoutSmooth, uint16_t backgroundColor) {
|
||||
sprite->fillSprite(backgroundColor);
|
||||
sprite->fillSprite(TFT_TRANSPARENT);
|
||||
sprite->setViewport(0, 0, usedX, usedY);
|
||||
sprite->fillRect(0, 0, usedX, usedY, backgroundColor);
|
||||
if(status) sprite->setTextColor(activeColor, activeSmooth, false);
|
||||
else sprite->setTextColor(dropoutColor, dropoutSmooth, false);
|
||||
sprite->drawString(text, xPos, 0);
|
||||
if(isScrolling) sprite->drawString(text, xPos + textWidth, 0);
|
||||
if(postDrawCallback) postDrawCallback(sprite, false);
|
||||
sprite->pushSprite(35, yPos);
|
||||
sprite->pushSprite(35, yPos, TFT_TRANSPARENT);
|
||||
sprite->resetViewport();
|
||||
}
|
||||
};
|
||||
+4
-6
@@ -1212,7 +1212,7 @@ void TEF6686::readRDS(byte showrdserrors) {
|
||||
|
||||
case RDS_GROUP_4A: {
|
||||
if (!rdsBerrorThreshold && !rdsCerrorThreshold && !rdsDerrorThreshold && rds.ctupdate && (rds.PICTlock == pi || rds.PICTlock == 0)) {
|
||||
auto rtc_time = rtc.getEpoch();
|
||||
auto rtc_time = get_time();
|
||||
uint32_t mjd = (rds.rdsB & 0x03) << 15 | ((rds.rdsC >> 1) & 0x7FFF);
|
||||
uint16_t hour, minute, day = 5, month = 1, year = 2026;
|
||||
int32_t timeoffset;
|
||||
@@ -1254,12 +1254,10 @@ void TEF6686::readRDS(byte showrdserrors) {
|
||||
rtcset = true;
|
||||
|
||||
time_t rds_utc_time = rdstime + timeoffset;
|
||||
rds.clock_correction = rtc_time - rds_utc_time;
|
||||
time_t new_correction = rtc_time - rds_utc_time;
|
||||
rds.clock_correction = (rds.clock_correction * 3 + new_correction) / 4;
|
||||
|
||||
if (!NTPupdated) {
|
||||
rtc.setTime(rds_utc_time);
|
||||
sync_to_rx_rtc();
|
||||
}
|
||||
if (!NTPupdated) set_time(rds_utc_time+rds.clock_correction);
|
||||
} else rds.hasCT = false;
|
||||
lastrdstime = rdstime;
|
||||
lasttimeoffset = timeoffset;
|
||||
|
||||
+9
-14
@@ -332,21 +332,16 @@ mem presets[EE_PRESETS_CNT];
|
||||
TEF6686 radio;
|
||||
|
||||
// FrequencySprite.createSprite(200, 50);
|
||||
// RDSSprite.createSprite(165, 19);
|
||||
// PSSprite.createSprite(150, 32);
|
||||
// PTYSprite.createSprite(160, 19);
|
||||
// SquelchSprite.createSprite(27, 19);
|
||||
// FullLineSprite.createSprite(308, 19);
|
||||
// SettingsSprite.createSprite(150, 32);
|
||||
// General16Sprite.createSprite(308, 28);
|
||||
// OneBigLineSprite.createSprite(270, 30);
|
||||
|
||||
TFT_eSprite FrequencySprite = TFT_eSprite(&tft);
|
||||
TFT_eSprite RDSSprite = TFT_eSprite(&tft);
|
||||
TFT_eSprite PTYSprite = TFT_eSprite(&tft);
|
||||
TFT_eSprite General16Sprite = TFT_eSprite(&tft);
|
||||
TFT_eSprite SignalSprite = TFT_eSprite(&tft);
|
||||
TFT_eSprite SquelchSprite = TFT_eSprite(&tft);
|
||||
TFT_eSprite FullLineSprite = TFT_eSprite(&tft);
|
||||
TFT_eSprite OneBigLineSprite = TFT_eSprite(&tft);
|
||||
TFT_eSprite PSSprite = TFT_eSprite(&tft);
|
||||
TFT_eSprite SettingsSprite = TFT_eSprite(&tft);
|
||||
TFT_eSprite General28Sprite = TFT_eSprite(&tft);
|
||||
|
||||
WiFiConnect wc;
|
||||
WiFiServer Server(7373);
|
||||
@@ -354,7 +349,7 @@ WiFiClient RemoteClient;
|
||||
WiFiUDP Udp;
|
||||
WebServer webserver(80);
|
||||
|
||||
ScrollingTextDisplay rtplusDisplay(&RDSSprite, 147, 180);
|
||||
ScrollingTextDisplay eonDisplay(&RDSSprite, 174, 180);
|
||||
ScrollingTextDisplay eccDisplay(&FullLineSprite, 198, 270);
|
||||
ScrollingTextDisplay rtDisplay(&FullLineSprite, 220, 270);
|
||||
ScrollingTextDisplay rtplusDisplay(&General16Sprite, 147, 180, 165, 19);
|
||||
ScrollingTextDisplay eonDisplay(&General16Sprite, 174, 180, 165, 19);
|
||||
ScrollingTextDisplay eccDisplay(&General16Sprite, 198, 270, 308, 19);
|
||||
ScrollingTextDisplay rtDisplay(&General16Sprite, 220, 270, 308, 19);
|
||||
+1239
-1239
File diff suppressed because it is too large
Load Diff
+43
-64
@@ -981,8 +981,6 @@ void NumpadProcess(int num) {
|
||||
if (spispeed == 7) tft.setSPISpeed(40);
|
||||
submenu = true;
|
||||
menu = true;
|
||||
PSSprite.unloadFont();
|
||||
if (language == LANGUAGE_CHS) PSSprite.loadFont(FONT16_CHS); else PSSprite.loadFont(FONT16);
|
||||
BuildMenu();
|
||||
} else if (num == 13) {
|
||||
if (freq_in != 0) {
|
||||
@@ -1068,9 +1066,6 @@ void endMenu() {
|
||||
if (USBmode) Serial.begin(19200); else Serial.begin(115200);
|
||||
|
||||
leave = true;
|
||||
PSSprite.unloadFont();
|
||||
if (language == LANGUAGE_CHS) PSSprite.loadFont(FONT28_CHS); else PSSprite.loadFont(FONT28);
|
||||
PSSprite.setTextDatum(TL_DATUM);
|
||||
BuildDisplay();
|
||||
SelectBand();
|
||||
}
|
||||
@@ -1290,20 +1285,13 @@ void setup() {
|
||||
FrequencySprite.setTextDatum(TR_DATUM);
|
||||
FrequencySprite.setSwapBytes(true);
|
||||
|
||||
RDSSprite.createSprite(165, 19);
|
||||
RDSSprite.setSwapBytes(true);
|
||||
General16Sprite.createSprite(308, 28);
|
||||
General16Sprite.setSwapBytes(true);
|
||||
|
||||
PTYSprite.createSprite(160, 19);
|
||||
PTYSprite.setSwapBytes(true);
|
||||
|
||||
PSSprite.createSprite(150, 32);
|
||||
PSSprite.setSwapBytes(true);
|
||||
|
||||
SquelchSprite.createSprite(27, 19);
|
||||
SquelchSprite.setSwapBytes(true);
|
||||
|
||||
FullLineSprite.createSprite(308, 19);
|
||||
FullLineSprite.setSwapBytes(true);
|
||||
General28Sprite.createSprite(150, 32);
|
||||
General28Sprite.setSwapBytes(true);
|
||||
SettingsSprite.createSprite(150, 32);
|
||||
SettingsSprite.setSwapBytes(true);
|
||||
|
||||
OneBigLineSprite.createSprite(270, 30);
|
||||
OneBigLineSprite.setSwapBytes(true);
|
||||
@@ -2421,8 +2409,6 @@ void ModeButtonPress() {
|
||||
menupage = INDEX;
|
||||
menuitem = 0;
|
||||
if (spispeed == 7) tft.setSPISpeed(40);
|
||||
PSSprite.unloadFont();
|
||||
if (language == LANGUAGE_CHS) PSSprite.loadFont(FONT16_CHS); else PSSprite.loadFont(FONT16);
|
||||
BuildMenu();
|
||||
freq_in = 0;
|
||||
menu = true;
|
||||
@@ -2465,8 +2451,6 @@ void ModeButtonPress() {
|
||||
menuoption = ITEM1;
|
||||
menupage = INDEX;
|
||||
menuitem = 0;
|
||||
PSSprite.unloadFont();
|
||||
if (language == LANGUAGE_CHS) PSSprite.loadFont(FONT16_CHS); else PSSprite.loadFont(FONT16);
|
||||
BuildMenu();
|
||||
freq_in = 0;
|
||||
}
|
||||
@@ -2982,14 +2966,16 @@ void ShowFreq(int mode) {
|
||||
if (!rdsflagreset && !screenmute && !afscreen && !rdsstatscreen) {
|
||||
ShowRDSLogo(false);
|
||||
if (!advancedRDS) {
|
||||
FullLineSprite.fillSprite(BackgroundColor);
|
||||
FullLineSprite.drawLine(283, 0, 283, 19, FrameColor);
|
||||
FullLineSprite.pushSprite(36, 220);
|
||||
General16Sprite.fillSprite(TFT_TRANSPARENT);
|
||||
General16Sprite.fillRect(0, 0, 308, 19, BackgroundColor);
|
||||
General16Sprite.drawLine(283, 0, 283, 19, FrameColor);
|
||||
General16Sprite.pushSprite(36, 220, TFT_TRANSPARENT);
|
||||
tft.fillCircle(314, 223, 2, GreyoutColor);
|
||||
tft.fillCircle(314, 234, 2, GreyoutColor);
|
||||
} else {
|
||||
RDSSprite.fillSprite(BackgroundColor);
|
||||
RDSSprite.pushSprite(36, 220);
|
||||
General16Sprite.fillSprite(TFT_TRANSPARENT);
|
||||
General16Sprite.fillRect(0, 0, 165, 19, BackgroundColor);
|
||||
General16Sprite.pushSprite(36, 220, TFT_TRANSPARENT);
|
||||
tft.fillCircle(314, 223, 2, GreyoutColor);
|
||||
tft.fillCircle(314, 234, 2, GreyoutColor);
|
||||
}
|
||||
@@ -3311,17 +3297,16 @@ void doSquelch() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (language == LANGUAGE_CHS) SquelchSprite.loadFont(FONT16_CHS); else SquelchSprite.loadFont(FONT16);
|
||||
|
||||
if (!XDRGTKUSB && !XDRGTKTCP && usesquelch && (!scandxmode || (scandxmode && !scanmute))) {
|
||||
if (!screenmute && usesquelch && !advancedRDS && !afscreen && !rdsstatscreen) {
|
||||
if (!BWtune && !menu && (Squelch > Squelchold + 2 || Squelch < Squelchold - 2)) {
|
||||
SquelchSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
SquelchSprite.fillSprite(BackgroundColor);
|
||||
if (Squelch == -100) SquelchSprite.drawString("--", 0, 0);
|
||||
else if (Squelch == 920) SquelchSprite.drawString("ST", 0, 0);
|
||||
else SquelchSprite.drawString(String(SquelchShow), 0, 0);
|
||||
SquelchSprite.pushSprite(223, 147);
|
||||
General16Sprite.fillSprite(TFT_TRANSPARENT);
|
||||
General16Sprite.fillRect(0, 0, 27, 19, BackgroundColor);
|
||||
General16Sprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
if (Squelch == -100) General16Sprite.drawString("--", 0, 0);
|
||||
else if (Squelch == 920) General16Sprite.drawString("ST", 0, 0);
|
||||
else General16Sprite.drawString(String(SquelchShow), 0, 0);
|
||||
General16Sprite.pushSprite(223, 147, TFT_TRANSPARENT);
|
||||
Squelchold = Squelch;
|
||||
}
|
||||
}
|
||||
@@ -3352,13 +3337,14 @@ void doSquelch() {
|
||||
}
|
||||
if (!screenmute && usesquelch && !advancedRDS && !afscreen && !rdsstatscreen) {
|
||||
if (Squelch != Squelchold) {
|
||||
SquelchSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
SquelchSprite.fillSprite(BackgroundColor);
|
||||
General16Sprite.fillSprite(TFT_TRANSPARENT);
|
||||
General16Sprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
General16Sprite.fillRect(0, 0, 27, 19, BackgroundColor);
|
||||
|
||||
if (Squelch == -1) SquelchSprite.drawString("ST", 0, 0);
|
||||
else if (Squelch == 0) SquelchSprite.drawString("--", 0, 0);
|
||||
else SquelchSprite.drawString(String(SquelchShow), 0, 0);
|
||||
if (Squelch != Squelchold) SquelchSprite.pushSprite(223, 147);
|
||||
if (Squelch == -1) General16Sprite.drawString("ST", 0, 0);
|
||||
else if (Squelch == 0) General16Sprite.drawString("--", 0, 0);
|
||||
else General16Sprite.drawString(String(SquelchShow), 0, 0);
|
||||
if (Squelch != Squelchold) General16Sprite.pushSprite(223, 147, TFT_TRANSPARENT);
|
||||
Squelchold = Squelch;
|
||||
}
|
||||
}
|
||||
@@ -3387,7 +3373,6 @@ void doSquelch() {
|
||||
}
|
||||
}
|
||||
}
|
||||
SquelchSprite.unloadFont();
|
||||
}
|
||||
|
||||
void doBW() {
|
||||
@@ -3927,32 +3912,25 @@ void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int colo
|
||||
void UpdateFonts(byte mode) {
|
||||
switch (mode) {
|
||||
case 0:
|
||||
RDSSprite.unloadFont();
|
||||
PTYSprite.unloadFont();
|
||||
PSSprite.unloadFont();
|
||||
FullLineSprite.unloadFont();
|
||||
General28Sprite.unloadFont();
|
||||
SettingsSprite.unloadFont();
|
||||
OneBigLineSprite.unloadFont();
|
||||
|
||||
if (language == LANGUAGE_CHS) {
|
||||
RDSSprite.loadFont(FONT16_CHS);
|
||||
PTYSprite.loadFont(FONT16_CHS);
|
||||
if (menu) PSSprite.loadFont(FONT16_CHS); else PSSprite.loadFont(FONT28_CHS);
|
||||
FullLineSprite.loadFont(FONT16_CHS);
|
||||
General28Sprite.loadFont(FONT28_CHS);
|
||||
SettingsSprite.loadFont(FONT16_CHS);
|
||||
OneBigLineSprite.loadFont(FONT28_CHS);
|
||||
} else {
|
||||
RDSSprite.loadFont(FONT16);
|
||||
PTYSprite.loadFont(FONT16);
|
||||
if (menu) PSSprite.loadFont(FONT16); else PSSprite.loadFont(FONT28);
|
||||
FullLineSprite.loadFont(FONT16);
|
||||
General16Sprite.loadFont(FONT16);
|
||||
General28Sprite.loadFont(FONT28);
|
||||
SettingsSprite.loadFont(FONT16);
|
||||
OneBigLineSprite.loadFont(FONT28);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
FullLineSprite.unloadFont();
|
||||
OneBigLineSprite.unloadFont();
|
||||
RDSSprite.unloadFont();
|
||||
PTYSprite.unloadFont();
|
||||
PSSprite.unloadFont();
|
||||
General28Sprite.unloadFont();
|
||||
SettingsSprite.unloadFont();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4032,12 +4010,12 @@ uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, ui
|
||||
switch (CurrentTheme) {
|
||||
case 7:
|
||||
SignalSprite.pushImage(-107, -95, 292, 170, popupbackground_wo);
|
||||
SquelchSprite.pushImage(-177, -135, 292, 170, popupbackground_wo);
|
||||
General16Sprite.pushImage(-177, -135, 292, 170, popupbackground_wo);
|
||||
break;
|
||||
|
||||
default:
|
||||
SignalSprite.pushImage(-107, -95, 292, 170, popupbackground);
|
||||
SquelchSprite.pushImage(-177, -135, 292, 170, popupbackground);
|
||||
General16Sprite.pushImage(-177, -135, 292, 170, popupbackground);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4048,10 +4026,11 @@ uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, ui
|
||||
SignalSprite.unloadFont();
|
||||
SignalSprite.pushSprite(120, 125);
|
||||
|
||||
if (language == LANGUAGE_CHS) SquelchSprite.loadFont(FONT16_CHS); else SquelchSprite.loadFont(FONT16);
|
||||
SquelchSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
SquelchSprite.drawString(String(counter), 0, 0);
|
||||
SquelchSprite.pushSprite(200, 155);
|
||||
General16Sprite.fillSprite(TFT_TRANSPARENT);
|
||||
General16Sprite.fillRect(0, 0, 27, 19, BackgroundColor);
|
||||
General16Sprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
General16Sprite.drawString(String(counter), 0, 0);
|
||||
General16Sprite.pushSprite(200, 155, TFT_TRANSPARENT);
|
||||
|
||||
tft.fillRect(60, 110, 2 * percent, 6, BarInsignificantColor);
|
||||
|
||||
|
||||
+60
-69
@@ -158,10 +158,10 @@ void readRds() {
|
||||
}
|
||||
|
||||
if (!radio.rds.hasLongPS) {
|
||||
PSSprite.fillSprite(BackgroundColor);
|
||||
PSSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
|
||||
PSSprite.drawString(PSold, 0, 2);
|
||||
PSSprite.pushSprite(36, advancedRDS ? 72 : 185);
|
||||
General28Sprite.fillSprite(BackgroundColor);
|
||||
General28Sprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
|
||||
General28Sprite.drawString(PSold, 0, 2);
|
||||
General28Sprite.pushSprite(36, advancedRDS ? 72 : 185);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,18 +189,18 @@ void readRds() {
|
||||
}
|
||||
|
||||
if (!radio.rds.hasLongPS) {
|
||||
PSSprite.fillSprite(BackgroundColor);
|
||||
General28Sprite.fillSprite(BackgroundColor);
|
||||
if ((ps12errorold || ps34errorold || ps56errorold || ps78errorold) && radio.ps_process) {
|
||||
for (uint8_t i = 0; i < 7; i++) {
|
||||
bool error = (i < 2 && ps12errorold) || (i < 4 && ps34errorold) || (i < 6 && ps56errorold) || ps78errorold;
|
||||
PSSprite.setTextColor(error ? RDSDropoutColor : RDSColor, RDSColorSmooth, false);
|
||||
PSSprite.drawString(radio.rds.stationName.substring(i, i + 1), i == 0 ? 0 : lengths[i - 1], 2);
|
||||
General28Sprite.setTextColor(error ? RDSDropoutColor : RDSColor, RDSColorSmooth, false);
|
||||
General28Sprite.drawString(radio.rds.stationName.substring(i, i + 1), i == 0 ? 0 : lengths[i - 1], 2);
|
||||
}
|
||||
} else {
|
||||
PSSprite.setTextColor(RDSColor, RDSColorSmooth, false);
|
||||
PSSprite.drawString(PSold, 0, 2);
|
||||
General28Sprite.setTextColor(RDSColor, RDSColorSmooth, false);
|
||||
General28Sprite.drawString(PSold, 0, 2);
|
||||
}
|
||||
PSSprite.pushSprite(36, advancedRDS ? 72 : 185);
|
||||
General28Sprite.pushSprite(36, advancedRDS ? 72 : 185);
|
||||
}
|
||||
|
||||
tft.fillCircle(314, 223, 2, GreyoutColor);
|
||||
@@ -406,14 +406,15 @@ void showPI() {
|
||||
void showPTY() {
|
||||
if(radio.rds.PTY.changed(0)) {
|
||||
String PTYString = String(radio.rds.PTY) + "/" + (radio.rds.region != 0 ? (radio.rds.region == 0 ? PTY_EU[radio.rds.PTY] : PTY_USA[radio.rds.PTY]) : textUI(228 + radio.rds.PTY));
|
||||
PTYSprite.fillSprite(BackgroundColor);
|
||||
if(RDSstatus) PTYSprite.setTextColor(RDSColor, RDSColorSmooth, false);
|
||||
else PTYSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
|
||||
if(band < BAND_GAP) PTYSprite.drawString(PTYString, 0, 2); // only draw it on fm
|
||||
General16Sprite.fillSprite(TFT_TRANSPARENT);
|
||||
General16Sprite.fillRect(0, 0, 160, 19, BackgroundColor);
|
||||
if(RDSstatus) General16Sprite.setTextColor(RDSColor, RDSColorSmooth, false);
|
||||
else General16Sprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
|
||||
if(band < BAND_GAP) General16Sprite.drawString(PTYString, 0, 2); // only draw it on fm
|
||||
|
||||
if (!screenmute) {
|
||||
if (advancedRDS) PTYSprite.pushSprite(35, 107);
|
||||
else PTYSprite.pushSprite(35, 161);
|
||||
if (advancedRDS) General16Sprite.pushSprite(35, 107, TFT_TRANSPARENT);
|
||||
else General16Sprite.pushSprite(35, 161, TFT_TRANSPARENT);
|
||||
}
|
||||
|
||||
if (wifi) {
|
||||
@@ -433,16 +434,16 @@ void showPS() {
|
||||
if (radio.rds.hasLongPS && showlongps) {
|
||||
String stationNameLongString = String(radio.rds.stationNameLong) + " ";
|
||||
if (stationNameLongString != stationNameLongOld) {
|
||||
PSLongWidth = PSSprite.textWidth(stationNameLongString); // Measure new width
|
||||
PSLongWidth = General28Sprite.textWidth(stationNameLongString); // Measure new width
|
||||
stationNameLongOld = stationNameLongString;
|
||||
}
|
||||
|
||||
// Handle scrolling logic for long PS
|
||||
if (PSSprite.textWidth(trimTrailingSpaces(radio.rds.stationNameLong)) < 150) {
|
||||
if (General28Sprite.textWidth(trimTrailingSpaces(radio.rds.stationNameLong)) < 150) {
|
||||
xPos2 = 0;
|
||||
PSSprite.fillSprite(BackgroundColor);
|
||||
PSSprite.setTextColor(RDSstatus ? RDSColor : RDSDropoutColor, RDSstatus ? RDSColorSmooth : RDSDropoutColorSmooth, false);
|
||||
PSSprite.drawString(stationNameLongString, xPos2, 2);
|
||||
General28Sprite.fillSprite(BackgroundColor);
|
||||
General28Sprite.setTextColor(RDSstatus ? RDSColor : RDSDropoutColor, RDSstatus ? RDSColorSmooth : RDSDropoutColorSmooth, false);
|
||||
General28Sprite.drawString(stationNameLongString, xPos2, 2);
|
||||
} else {
|
||||
if (millis() - pslongticker >= 5) {
|
||||
if (xPos2 == 0 && millis() - pslongtickerhold < 2000) {
|
||||
@@ -456,17 +457,17 @@ void showPS() {
|
||||
pslongticker = millis();
|
||||
}
|
||||
|
||||
PSSprite.fillSprite(BackgroundColor);
|
||||
PSSprite.setTextColor(RDSstatus ? RDSColor : RDSDropoutColor, RDSstatus ? RDSColorSmooth : RDSDropoutColorSmooth, false);
|
||||
PSSprite.drawString(stationNameLongString, xPos2 + 8, 2);
|
||||
PSSprite.drawString(stationNameLongString, xPos2 + PSLongWidth, 2);
|
||||
General28Sprite.fillSprite(BackgroundColor);
|
||||
General28Sprite.setTextColor(RDSstatus ? RDSColor : RDSDropoutColor, RDSstatus ? RDSColorSmooth : RDSDropoutColorSmooth, false);
|
||||
General28Sprite.drawString(stationNameLongString, xPos2 + 8, 2);
|
||||
General28Sprite.drawString(stationNameLongString, xPos2 + PSLongWidth, 2);
|
||||
}
|
||||
} else {
|
||||
xPos2 = 0;
|
||||
PSSprite.fillSprite(BackgroundColor);
|
||||
General28Sprite.fillSprite(BackgroundColor);
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
lengths[i] = PSSprite.textWidth(radio.rds.stationName.substring(0, i + 1));
|
||||
lengths[i] = General28Sprite.textWidth(radio.rds.stationName.substring(0, i + 1));
|
||||
if (i > 0 && lengths[i] <= lengths[i - 1]) lengths[i] = lengths[i - 1] + 23;
|
||||
}
|
||||
|
||||
@@ -476,22 +477,22 @@ void showPS() {
|
||||
if (ps78errorold) ps78errorold = radio.rds.ps78error;
|
||||
|
||||
if (!RDSstatus || band > BAND_GAP) {
|
||||
PSSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
|
||||
PSSprite.drawString(radio.rds.stationName, 0, 2);
|
||||
General28Sprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
|
||||
General28Sprite.drawString(radio.rds.stationName, 0, 2);
|
||||
} else if ((ps12errorold || ps34errorold || ps56errorold || ps78errorold) && radio.ps_process) {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
PSSprite.setTextColor((i < 2 && ps12errorold) || (i < 4 && ps34errorold) || (i < 6 && ps56errorold) || ps78errorold ? RDSDropoutColor : RDSColor, RDSColorSmooth, false);
|
||||
PSSprite.drawString(radio.rds.stationName.substring(i, i + 1), i == 0 ? 0 : lengths[i - 1], 2);
|
||||
General28Sprite.setTextColor((i < 2 && ps12errorold) || (i < 4 && ps34errorold) || (i < 6 && ps56errorold) || ps78errorold ? RDSDropoutColor : RDSColor, RDSColorSmooth, false);
|
||||
General28Sprite.drawString(radio.rds.stationName.substring(i, i + 1), i == 0 ? 0 : lengths[i - 1], 2);
|
||||
}
|
||||
} else {
|
||||
PSSprite.setTextColor(RDSColor, RDSColorSmooth, false);
|
||||
PSSprite.drawString(radio.rds.stationName, 0, 2);
|
||||
General28Sprite.setTextColor(RDSColor, RDSColorSmooth, false);
|
||||
General28Sprite.drawString(radio.rds.stationName, 0, 2);
|
||||
}
|
||||
|
||||
if (PSold != radio.rds.stationName) ps12errorold = ps34errorold = ps56errorold = ps78errorold = true;
|
||||
}
|
||||
|
||||
if (!screenmute) PSSprite.pushSprite(36, advancedRDS ? 72 : 185);
|
||||
if (!screenmute) General28Sprite.pushSprite(36, advancedRDS ? 72 : 185);
|
||||
|
||||
if (wifi && radio.rds.stationName.length() > 0 && PSold != radio.rds.stationName) {
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
@@ -514,14 +515,15 @@ void showPS() {
|
||||
void showCT() {
|
||||
char timeStr[16];
|
||||
char dateStr[9];
|
||||
time_t t = rtc.getEpoch() + (NTPupdated ? 0 : radio.rds.offset);
|
||||
|
||||
time_t t = get_time();
|
||||
|
||||
if (NTPupdated) {
|
||||
t += NTPoffset * 3600; // Convert offset from hours to seconds
|
||||
if (autoDST && isDST(t)) t += 3600;
|
||||
}
|
||||
|
||||
auto localtm = localtime(&t);
|
||||
auto localtm = gmtime(&t);
|
||||
|
||||
if (clockampm) { // USA region: 12-hour AM/PM format
|
||||
int hour = localtm->tm_hour;
|
||||
@@ -546,27 +548,16 @@ void showCT() {
|
||||
else strftime(dateStr, sizeof(dateStr), "%d-%m-%y", localtm);
|
||||
rds_date = String(dateStr);
|
||||
|
||||
if (!screenmute && showclock && (rds_clock != rds_clockold || rds_date != rds_dateold || radio.rds.hasCT.changed(0))) {
|
||||
|
||||
if ((radio.rds.hasCT && RDSstatus) || NTPupdated) {
|
||||
rtcset = true;
|
||||
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(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(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);
|
||||
}
|
||||
}
|
||||
if (!screenmute && showclock && (rds_clock != rds_clockold || rds_date != rds_dateold)) {
|
||||
General16Sprite.fillSprite(TFT_TRANSPARENT);
|
||||
General16Sprite.fillRect(0, 0, 54, 58, BackgroundColor);
|
||||
General16Sprite.setTextColor(RDSColor, RDSColorSmooth);
|
||||
General16Sprite.drawString(rds_clock, 0, 0);
|
||||
General16Sprite.drawString(rds_date, 0, 14);
|
||||
General16Sprite.pushSprite(108, 2, TFT_TRANSPARENT);
|
||||
rds_clockold = rds_clock;
|
||||
rds_dateold = rds_date;
|
||||
}
|
||||
|
||||
rds_clockold = rds_clock;
|
||||
rds_dateold = rds_date;
|
||||
}
|
||||
|
||||
void showRadioText() {
|
||||
@@ -772,18 +763,18 @@ void ShowAFEON() {
|
||||
|
||||
if (AIDStringTemp != AIDStringold) {
|
||||
AIDString = String(textUI(33)) + " - " + String(textUI(79)) + ": " + AIDStringTemp + " ";
|
||||
AIDWidth = FullLineSprite.textWidth(AIDString);
|
||||
AIDWidth = General16Sprite.textWidth(AIDString);
|
||||
AIDStringold = AIDString;
|
||||
}
|
||||
}
|
||||
|
||||
if (FullLineSprite.textWidth(trimTrailingSpaces(AIDString)) < 270) {
|
||||
if (General16Sprite.textWidth(trimTrailingSpaces(AIDString)) < 270) {
|
||||
xPos = 0;
|
||||
FullLineSprite.fillSprite(BackgroundColor);
|
||||
FullLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
|
||||
FullLineSprite.drawString(AIDString, xPos, 2);
|
||||
FullLineSprite.drawLine(283, 0, 283, 19, FrameColor);
|
||||
FullLineSprite.pushSprite(5, 220);
|
||||
General16Sprite.fillSprite(BackgroundColor);
|
||||
General16Sprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
|
||||
General16Sprite.drawString(AIDString, xPos, 2);
|
||||
General16Sprite.drawLine(283, 0, 283, 19, FrameColor);
|
||||
General16Sprite.pushSprite(5, 220);
|
||||
} else {
|
||||
if (millis() - rtticker >= 5) {
|
||||
if (xPos < -AIDWidth) xPos = 0;
|
||||
@@ -796,12 +787,12 @@ void ShowAFEON() {
|
||||
xPos--;
|
||||
rttickerhold = millis();
|
||||
}
|
||||
FullLineSprite.fillSprite(BackgroundColor);
|
||||
FullLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
|
||||
FullLineSprite.drawString(AIDString, xPos, 2);
|
||||
FullLineSprite.drawString(AIDString, xPos + AIDWidth, 2);
|
||||
FullLineSprite.drawLine(314, 0, 314, 19, FrameColor);
|
||||
FullLineSprite.pushSprite(5, 220);
|
||||
General16Sprite.fillSprite(BackgroundColor);
|
||||
General16Sprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
|
||||
General16Sprite.drawString(AIDString, xPos, 2);
|
||||
General16Sprite.drawString(AIDString, xPos + AIDWidth, 2);
|
||||
General16Sprite.drawLine(314, 0, 314, 19, FrameColor);
|
||||
General16Sprite.pushSprite(5, 220);
|
||||
rtticker = millis();
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -55,4 +55,19 @@ void sync_from_rx_rtc(int32_t offset) {
|
||||
if(!rx_rtc_avail) return;
|
||||
RX8010SJ::DateTime dateTime = rx_rtc.readDateTime();
|
||||
rtc.setTime(dateTimeToTime(&dateTime) + offset);
|
||||
}
|
||||
|
||||
time_t get_time() {
|
||||
if(!rx_rtc_avail) return rtc.getEpoch();
|
||||
RX8010SJ::DateTime dateTime = rx_rtc.readDateTime();
|
||||
return dateTimeToTime(&dateTime);
|
||||
}
|
||||
|
||||
void set_time(time_t time) {
|
||||
rtc.setTime(time);
|
||||
if(rx_rtc_avail) {
|
||||
RX8010SJ::DateTime rx_currenttime = RX8010SJ::DateTime();
|
||||
timeToDateTime(time, &rx_currenttime);
|
||||
rx_rtc.writeDateTime(rx_currenttime);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user