Reduced sprites to save RAM

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-10-29 15:08:25 +01:00
parent 460e3a282a
commit a365267ad9
4 changed files with 40 additions and 71 deletions
+3 -9
View File
@@ -2439,9 +2439,6 @@ void Infoboxprint(const char* input) {
}
}
MenuInfobox.fillSprite(BackgroundColor);
MenuInfobox.setTextColor(ActiveColor, ActiveColorSmooth, false);
if (newlineIndex != -1) {
char* line1 = (char*)malloc((newlineIndex + 1) * sizeof(char));
strncpy(line1, input, newlineIndex);
@@ -2450,14 +2447,11 @@ void Infoboxprint(const char* input) {
char* line2 = (char*)malloc((length - newlineIndex) * sizeof(char));
strcpy(line2, input + newlineIndex + 1);
MenuInfobox.drawString(line1, 146, 15);
MenuInfobox.drawString(line2, 146, 45);
tftPrint(0, line1, 155, 48, ActiveColor, ActiveColorSmooth, 28);
tftPrint(0, line2, 155, 78, ActiveColor, ActiveColorSmooth, 28);
free(line1);
free(line2);
} else {
MenuInfobox.drawString(input, 146, 15);
tftPrint(0, input, 155, 78, ActiveColor, ActiveColorSmooth, 28);
}
MenuInfobox.pushSprite(14, 34);
}
+24 -24
View File
@@ -72,10 +72,10 @@ void ShowAdvancedRDS() {
if (afstring.length() < 20) {
if (afstringold != afstring) {
xPos2 = 0;
AFSprite.fillSprite(BackgroundColor);
AFSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
AFSprite.drawString(afstring, xPos2, 2);
AFSprite.pushSprite(35, 197);
RDSSprite.fillSprite(BackgroundColor);
RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
RDSSprite.drawString(afstring, xPos2, 2);
RDSSprite.pushSprite(35, 197);
}
} else {
if (millis() - afticker >= 15) {
@@ -89,10 +89,10 @@ void ShowAdvancedRDS() {
aftickerhold = millis();
}
if (xPos2 < -tft.textWidth(afstring) + (charWidth * 14)) xPos2 = 0;
AFSprite.fillSprite(BackgroundColor);
AFSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
AFSprite.drawString(afstring, xPos2, 2);
AFSprite.pushSprite(35, 197);
RDSSprite.fillSprite(BackgroundColor);
RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
RDSSprite.drawString(afstring, xPos2, 2);
RDSSprite.pushSprite(35, 197);
afticker = millis();
}
}
@@ -109,10 +109,10 @@ void ShowAdvancedRDS() {
if (eonstring.length() < 20) {
if (eonstringold != eonstring) {
xPos3 = 0;
EONSprite.fillSprite(BackgroundColor);
EONSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
EONSprite.drawString(eonstring, xPos3, 2);
EONSprite.pushSprite(35, 172);
RDSSprite.fillSprite(BackgroundColor);
RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
RDSSprite.drawString(eonstring, xPos3, 2);
RDSSprite.pushSprite(35, 172);
}
} else {
if (millis() - eonticker >= 15) {
@@ -126,10 +126,10 @@ void ShowAdvancedRDS() {
eontickerhold = millis();
}
if (xPos3 < -tft.textWidth(eonstring) + (charWidth * 14)) xPos3 = 0;
EONSprite.fillSprite(BackgroundColor);
EONSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
EONSprite.drawString(eonstring, xPos3, 2);
EONSprite.pushSprite(35, 172);
RDSSprite.fillSprite(BackgroundColor);
RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
RDSSprite.drawString(eonstring, xPos3, 2);
RDSSprite.pushSprite(35, 172);
eonticker = millis();
}
}
@@ -146,10 +146,10 @@ void ShowAdvancedRDS() {
if (rtplusstring.length() < 20) {
if (rtplusstringold != rtplusstring) {
xPos4 = 0;
RTPlusSprite.fillSprite(BackgroundColor);
RTPlusSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
RTPlusSprite.drawString(rtplusstring, xPos4, 2);
RTPlusSprite.pushSprite(35, 146);
RDSSprite.fillSprite(BackgroundColor);
RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
RDSSprite.drawString(rtplusstring, xPos4, 2);
RDSSprite.pushSprite(35, 146);
}
} else {
if (millis() - rtplusticker >= 15) {
@@ -163,10 +163,10 @@ void ShowAdvancedRDS() {
rtplustickerhold = millis();
}
if (xPos4 < -tft.textWidth(rtplusstring) + (charWidth * 14)) xPos4 = 0;
RTPlusSprite.fillSprite(BackgroundColor);
RTPlusSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
RTPlusSprite.drawString(rtplusstring, xPos4, 2);
RTPlusSprite.pushSprite(35, 146);
RDSSprite.fillSprite(BackgroundColor);
RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
RDSSprite.drawString(rtplusstring, xPos4, 2);
RDSSprite.pushSprite(35, 146);
rtplusticker = millis();
}
}
+1 -3
View File
@@ -110,9 +110,7 @@ extern WiFiClient RemoteClient;
extern WiFiUDP Udp;
extern TFT_eSprite RadiotextSprite;
extern TFT_eSprite AdvRadiotextSprite;
extern TFT_eSprite EONSprite;
extern TFT_eSprite RTPlusSprite;
extern TFT_eSprite AFSprite;
extern TFT_eSprite RDSSprite;
void ShowAdvancedRDS();
void readRds();