Code optimalisation

This commit is contained in:
Sjef Verhoeven PE5PVB
2024-05-26 01:42:32 +02:00
parent 15cc9ec89a
commit d04e05607d
3 changed files with 45 additions and 34 deletions

View File

@@ -484,8 +484,8 @@ void BuildAFScreen() {
}
void ShowOneLine(byte position, byte item, bool selected) {
FullLineSprite.pushImage (-8, -(position + 2), 320, 240, configurationbackground);
if (selected) FullLineSprite.pushImage(0, 0, 304, 20, selector);
FullLineSprite.pushImage (-8, -(position + 2), 320, 240, configurationbackground);
if (selected) FullLineSprite.pushImage(0, 0, 304, 20, selector);
switch (item) {
case 0:
@@ -1736,7 +1736,7 @@ void MenuUp() {
}
}
}
ShowOneLine(menuoption, menuitem, true);
} else {
OneBigLineSprite.pushImage(-11, -88, 292, 170, popupbackground);
@@ -2559,7 +2559,7 @@ void MenuUp() {
void MenuDown() {
if (!menuopen) {
ShowOneLine(menuoption, menuitem, false);
ShowOneLine(menuoption, menuitem, false);
if (hardwaremodel == BASE_ILI9341) {
menuoption -= ITEM_GAP;
@@ -3411,10 +3411,10 @@ void DoMenu() {
if (!menuopen) {
if (menupage != INDEX) {
menuopen = true;
tft.pushImage (13, 30, 292, 170, popupbackground);
tft.pushImage (13, 30, 292, 170, popupbackground);
}
OneBigLineSprite.pushImage(-11, -88, 292, 170, popupbackground);
OneBigLineSprite.pushImage(-11, -88, 292, 170, popupbackground);
OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
OneBigLineSprite.setTextDatum(TC_DATUM);
@@ -4166,7 +4166,7 @@ void DoMenu() {
XDRGTK_key = XDRGTK_key_input.getValue();
EEPROM.writeString(EE_STRING_XDRGTK_KEY, XDRGTK_key);
EEPROM.commit();
UpdateFonts(0);
UpdateFonts(0);
wifi = true;
tryWiFi();
delay(2000);

View File

@@ -47,11 +47,15 @@ void ShowAdvancedRDS() {
}
if (ptynold != radio.rds.PTYN || rdsreset) {
if (!screenmute) tftPrint(-1, "PTYN N/A", 216, 109, BackgroundColor, BackgroundColor, 16);
if (!screenmute) tftPrint(-1, ptynold, 216, 109, BackgroundColor, BackgroundColor, 16);
if (radio.rds.PTYN.length() == 0) radio.rds.PTYN = "PTYN N/A";
if (!screenmute) tftPrint(-1, String(radio.rds.PTYN), 216, 109, RDSColor, RDSColorSmooth, 16);
ptynold = radio.rds.PTYN;
if (!screenmute) {
if (ptynold != "PTYN N/A") {
tftPrint(-1, "PTYN N/A", 216, 109, BackgroundColor, BackgroundColor, 16);
tftPrint(-1, ptynold, 216, 109, BackgroundColor, BackgroundColor, 16);
}
if (radio.rds.PTYN.length() == 0) radio.rds.PTYN = "PTYN N/A";
tftPrint(-1, String(radio.rds.PTYN), 216, 109, RDSColor, RDSColorSmooth, 16);
ptynold = radio.rds.PTYN;
}
}
if (licold != radio.rds.LIC || rdsreset) {
@@ -60,8 +64,8 @@ void ShowAdvancedRDS() {
tftPrint(-1, LIColdString, 242, 208, BackgroundColor, BackgroundColor, 16);
if (radio.rds.hasLIC) tftPrint(-1, (radio.rds.LICtext.length() == 0 ? myLanguage[language][73] : radio.rds.LICtext), 242, 208, RDSColor, RDSColorSmooth, 16); else tftPrint(-1, "N/A", 242, 208, RDSColor, RDSColorSmooth, 16);
if (radio.rds.LICtext.length() == 0) LIColdString = myLanguage[language][73]; else LIColdString = radio.rds.LICtext;
licold = radio.rds.LIC;
}
licold = radio.rds.LIC;
}
String pinstring = String(radio.rds.pinDay) + " " + String(radio.rds.pinHour) + ":" + (radio.rds.pinMin < 10 ? "0" : "") + String(radio.rds.pinMin);
@@ -306,6 +310,7 @@ void readRds() {
radio.readRDS(showrdserrors);
RDSstatus = radio.rds.hasRDS;
ShowRDSLogo(RDSstatus);
if (!screenmute && !afscreen) {
if (!RDSstatus) {
if (radio.rds.correctPI != 0 && !dropout) {
@@ -329,10 +334,11 @@ void readRds() {
}
}
PSSprite.fillSprite(BackgroundColor);
PSSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
PSSprite.drawString(PSold, 0, 0);
if (!radio.rds.hasLongPS) {
PSSprite.fillSprite(BackgroundColor);
PSSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
PSSprite.drawString(PSold, 0, 0);
if (advancedRDS) {
PSSprite.pushSprite(36, 74);
} else {
@@ -384,10 +390,11 @@ void readRds() {
}
}
PSSprite.fillSprite(BackgroundColor);
PSSprite.setTextColor(RDSColor, RDSColorSmooth, false);
PSSprite.drawString(PSold, 0, 0);
if (!radio.rds.hasLongPS) {
PSSprite.fillSprite(BackgroundColor);
PSSprite.setTextColor(RDSColor, RDSColorSmooth, false);
PSSprite.drawString(PSold, 0, 0);
if (advancedRDS) {
PSSprite.pushSprite(36, 74);
} else {
@@ -580,6 +587,7 @@ void showPI() {
if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n");
if (RDSSPYTCP) RemoteClient.print("G:\r\nRESET-------\r\n\r\n");
}
if (!screenmute) {
if (advancedRDS) {
if (region == REGION_EU) {
@@ -628,6 +636,7 @@ void showPI() {
stationIDold = radio.rds.stationIDtext;
stationStateold = radio.rds.stationStatetext;
}
if (wifi) {
Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";PI=" + String(radio.rds.picode, 4));
@@ -654,6 +663,7 @@ void showPTY() {
}
}
PTYold = radio.rds.stationType;
if (wifi) {
Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";PTY=");
@@ -822,6 +832,7 @@ void showRadioText() {
}
}
}
if (radio.rds.hasRT) {
if (!advancedRDS) {
if (radio.rds.rtAB) {