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