You've already forked TEF6686_ESP32
Reduced sprites to save RAM
This commit is contained in:
@@ -347,11 +347,8 @@ ESP32Time rtc(0);
|
|||||||
TFT_eSprite RadiotextSprite = TFT_eSprite(&tft);
|
TFT_eSprite RadiotextSprite = TFT_eSprite(&tft);
|
||||||
TFT_eSprite FrequencySprite = TFT_eSprite(&tft);
|
TFT_eSprite FrequencySprite = TFT_eSprite(&tft);
|
||||||
TFT_eSprite AdvRadiotextSprite = TFT_eSprite(&tft);
|
TFT_eSprite AdvRadiotextSprite = TFT_eSprite(&tft);
|
||||||
TFT_eSprite EONSprite = TFT_eSprite(&tft);
|
TFT_eSprite RDSSprite = TFT_eSprite(&tft);
|
||||||
TFT_eSprite RTPlusSprite = TFT_eSprite(&tft);
|
|
||||||
TFT_eSprite AFSprite = TFT_eSprite(&tft);
|
|
||||||
TFT_eSprite SquelchSprite = TFT_eSprite(&tft);
|
TFT_eSprite SquelchSprite = TFT_eSprite(&tft);
|
||||||
TFT_eSprite MenuInfobox = TFT_eSprite(&tft);
|
|
||||||
|
|
||||||
WiFiConnect wc;
|
WiFiConnect wc;
|
||||||
WiFiServer Server(7373);
|
WiFiServer Server(7373);
|
||||||
@@ -523,39 +520,26 @@ void setup() {
|
|||||||
RadiotextSprite.createSprite(270, 19);
|
RadiotextSprite.createSprite(270, 19);
|
||||||
FrequencySprite.createSprite(200, 50);
|
FrequencySprite.createSprite(200, 50);
|
||||||
AdvRadiotextSprite.createSprite(162, 19);
|
AdvRadiotextSprite.createSprite(162, 19);
|
||||||
EONSprite.createSprite(172, 19);
|
RDSSprite.createSprite(172, 19);
|
||||||
RTPlusSprite.createSprite(172, 19);
|
|
||||||
AFSprite.createSprite(172, 19);
|
|
||||||
SquelchSprite.createSprite(47, 19);
|
SquelchSprite.createSprite(47, 19);
|
||||||
MenuInfobox.createSprite(292, 80);
|
|
||||||
|
|
||||||
RadiotextSprite.setTextDatum(TL_DATUM);
|
RadiotextSprite.setTextDatum(TL_DATUM);
|
||||||
FrequencySprite.setTextDatum(TR_DATUM);
|
FrequencySprite.setTextDatum(TR_DATUM);
|
||||||
AdvRadiotextSprite.setTextDatum(TL_DATUM);
|
AdvRadiotextSprite.setTextDatum(TL_DATUM);
|
||||||
EONSprite.setTextDatum(TL_DATUM);
|
RDSSprite.setTextDatum(TL_DATUM);
|
||||||
RTPlusSprite.setTextDatum(TL_DATUM);
|
|
||||||
AFSprite.setTextDatum(TL_DATUM);
|
|
||||||
SquelchSprite.setTextDatum(TL_DATUM);
|
SquelchSprite.setTextDatum(TL_DATUM);
|
||||||
MenuInfobox.setTextDatum(TC_DATUM);
|
|
||||||
|
|
||||||
FrequencySprite.loadFont(FREQFONT);
|
FrequencySprite.loadFont(FREQFONT);
|
||||||
|
|
||||||
if (language == LANGUAGE_CHS) {
|
if (language == LANGUAGE_CHS) {
|
||||||
RadiotextSprite.loadFont(FONT16_CHS);
|
RadiotextSprite.loadFont(FONT16_CHS);
|
||||||
AdvRadiotextSprite.loadFont(FONT16_CHS);
|
AdvRadiotextSprite.loadFont(FONT16_CHS);
|
||||||
EONSprite.loadFont(FONT16_CHS);
|
RDSSprite.loadFont(FONT16_CHS);
|
||||||
RTPlusSprite.loadFont(FONT16_CHS);
|
|
||||||
AFSprite.loadFont(FONT16_CHS);
|
|
||||||
SquelchSprite.loadFont(FONT16_CHS);
|
SquelchSprite.loadFont(FONT16_CHS);
|
||||||
MenuInfobox.loadFont(FONT28_CHS);
|
|
||||||
} else {
|
} else {
|
||||||
RadiotextSprite.loadFont(FONT16);
|
RadiotextSprite.loadFont(FONT16);
|
||||||
AdvRadiotextSprite.loadFont(FONT16);
|
AdvRadiotextSprite.loadFont(FONT16);
|
||||||
EONSprite.loadFont(FONT16);
|
RDSSprite.loadFont(FONT16);
|
||||||
RTPlusSprite.loadFont(FONT16);
|
|
||||||
AFSprite.loadFont(FONT16);
|
|
||||||
SquelchSprite.loadFont(FONT16);
|
SquelchSprite.loadFont(FONT16);
|
||||||
MenuInfobox.loadFont(FONT28);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (digitalRead(BWBUTTON) == LOW && digitalRead(ROTARY_BUTTON) == HIGH) {
|
if (digitalRead(BWBUTTON) == LOW && digitalRead(ROTARY_BUTTON) == HIGH) {
|
||||||
@@ -672,6 +656,8 @@ void setup() {
|
|||||||
}
|
}
|
||||||
tftPrint(0, "Patch: v" + String(TEF), 160, 202, ActiveColor, ActiveColorSmooth, 28);
|
tftPrint(0, "Patch: v" + String(TEF), 160, 202, ActiveColor, ActiveColorSmooth, 28);
|
||||||
|
|
||||||
|
if (analogRead(BATTERY_PIN) < 200) batterydetect = false;
|
||||||
|
|
||||||
if (wifi) {
|
if (wifi) {
|
||||||
tryWiFi();
|
tryWiFi();
|
||||||
tft.fillRect(184, 230, 16, 6, PrimaryColor);
|
tft.fillRect(184, 230, 16, 6, PrimaryColor);
|
||||||
@@ -712,7 +698,6 @@ void setup() {
|
|||||||
Wire.endTransmission();
|
Wire.endTransmission();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (analogRead(BATTERY_PIN) < 200) batterydetect = false;
|
|
||||||
SelectBand();
|
SelectBand();
|
||||||
|
|
||||||
setupmode = false;
|
setupmode = false;
|
||||||
@@ -1891,27 +1876,18 @@ void ModeButtonPress() {
|
|||||||
if (USBmode) Serial.begin(19200); else Serial.begin(115200);
|
if (USBmode) Serial.begin(19200); else Serial.begin(115200);
|
||||||
RadiotextSprite.unloadFont();
|
RadiotextSprite.unloadFont();
|
||||||
AdvRadiotextSprite.unloadFont();
|
AdvRadiotextSprite.unloadFont();
|
||||||
EONSprite.unloadFont();
|
RDSSprite.unloadFont();
|
||||||
RTPlusSprite.unloadFont();
|
|
||||||
AFSprite.unloadFont();
|
|
||||||
SquelchSprite.unloadFont();
|
SquelchSprite.unloadFont();
|
||||||
MenuInfobox.unloadFont();
|
|
||||||
if (language == LANGUAGE_CHS) {
|
if (language == LANGUAGE_CHS) {
|
||||||
RadiotextSprite.loadFont(FONT16_CHS);
|
RadiotextSprite.loadFont(FONT16_CHS);
|
||||||
AdvRadiotextSprite.loadFont(FONT16_CHS);
|
AdvRadiotextSprite.loadFont(FONT16_CHS);
|
||||||
EONSprite.loadFont(FONT16_CHS);
|
RDSSprite.loadFont(FONT16_CHS);
|
||||||
RTPlusSprite.loadFont(FONT16_CHS);
|
|
||||||
AFSprite.loadFont(FONT16_CHS);
|
|
||||||
SquelchSprite.loadFont(FONT16_CHS);
|
SquelchSprite.loadFont(FONT16_CHS);
|
||||||
MenuInfobox.loadFont(FONT28_CHS);
|
|
||||||
} else {
|
} else {
|
||||||
RadiotextSprite.loadFont(FONT16);
|
RadiotextSprite.loadFont(FONT16);
|
||||||
AdvRadiotextSprite.loadFont(FONT16);
|
AdvRadiotextSprite.loadFont(FONT16);
|
||||||
EONSprite.loadFont(FONT16);
|
RDSSprite.loadFont(FONT16);
|
||||||
RTPlusSprite.loadFont(FONT16);
|
|
||||||
AFSprite.loadFont(FONT16);
|
|
||||||
SquelchSprite.loadFont(FONT16);
|
SquelchSprite.loadFont(FONT16);
|
||||||
MenuInfobox.loadFont(FONT28);
|
|
||||||
}
|
}
|
||||||
doBandSelectionFM();
|
doBandSelectionFM();
|
||||||
doBandSelectionAM();
|
doBandSelectionAM();
|
||||||
@@ -3033,7 +3009,8 @@ void ShowBattery() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t v = analogRead(BATTERY_PIN);
|
uint16_t v = 0;
|
||||||
|
if (!wifi) v = analogRead(BATTERY_PIN);
|
||||||
battery = map(constrain(v, BAT_LEVEL_EMPTY, BAT_LEVEL_FULL), BAT_LEVEL_EMPTY, BAT_LEVEL_FULL, 0, BAT_LEVEL_STAGE);
|
battery = map(constrain(v, BAT_LEVEL_EMPTY, BAT_LEVEL_FULL), BAT_LEVEL_EMPTY, BAT_LEVEL_FULL, 0, BAT_LEVEL_STAGE);
|
||||||
|
|
||||||
if (batteryold != battery) {
|
if (batteryold != battery) {
|
||||||
|
|||||||
12
src/gui.cpp
12
src/gui.cpp
@@ -2439,9 +2439,6 @@ void Infoboxprint(const char* input) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuInfobox.fillSprite(BackgroundColor);
|
|
||||||
MenuInfobox.setTextColor(ActiveColor, ActiveColorSmooth, false);
|
|
||||||
|
|
||||||
if (newlineIndex != -1) {
|
if (newlineIndex != -1) {
|
||||||
char* line1 = (char*)malloc((newlineIndex + 1) * sizeof(char));
|
char* line1 = (char*)malloc((newlineIndex + 1) * sizeof(char));
|
||||||
strncpy(line1, input, newlineIndex);
|
strncpy(line1, input, newlineIndex);
|
||||||
@@ -2450,14 +2447,11 @@ void Infoboxprint(const char* input) {
|
|||||||
char* line2 = (char*)malloc((length - newlineIndex) * sizeof(char));
|
char* line2 = (char*)malloc((length - newlineIndex) * sizeof(char));
|
||||||
strcpy(line2, input + newlineIndex + 1);
|
strcpy(line2, input + newlineIndex + 1);
|
||||||
|
|
||||||
MenuInfobox.drawString(line1, 146, 15);
|
tftPrint(0, line1, 155, 48, ActiveColor, ActiveColorSmooth, 28);
|
||||||
MenuInfobox.drawString(line2, 146, 45);
|
tftPrint(0, line2, 155, 78, ActiveColor, ActiveColorSmooth, 28);
|
||||||
|
|
||||||
free(line1);
|
free(line1);
|
||||||
free(line2);
|
free(line2);
|
||||||
} else {
|
} else {
|
||||||
MenuInfobox.drawString(input, 146, 15);
|
tftPrint(0, input, 155, 78, ActiveColor, ActiveColorSmooth, 28);
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuInfobox.pushSprite(14, 34);
|
|
||||||
}
|
}
|
||||||
48
src/rds.cpp
48
src/rds.cpp
@@ -72,10 +72,10 @@ void ShowAdvancedRDS() {
|
|||||||
if (afstring.length() < 20) {
|
if (afstring.length() < 20) {
|
||||||
if (afstringold != afstring) {
|
if (afstringold != afstring) {
|
||||||
xPos2 = 0;
|
xPos2 = 0;
|
||||||
AFSprite.fillSprite(BackgroundColor);
|
RDSSprite.fillSprite(BackgroundColor);
|
||||||
AFSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||||
AFSprite.drawString(afstring, xPos2, 2);
|
RDSSprite.drawString(afstring, xPos2, 2);
|
||||||
AFSprite.pushSprite(35, 197);
|
RDSSprite.pushSprite(35, 197);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (millis() - afticker >= 15) {
|
if (millis() - afticker >= 15) {
|
||||||
@@ -89,10 +89,10 @@ void ShowAdvancedRDS() {
|
|||||||
aftickerhold = millis();
|
aftickerhold = millis();
|
||||||
}
|
}
|
||||||
if (xPos2 < -tft.textWidth(afstring) + (charWidth * 14)) xPos2 = 0;
|
if (xPos2 < -tft.textWidth(afstring) + (charWidth * 14)) xPos2 = 0;
|
||||||
AFSprite.fillSprite(BackgroundColor);
|
RDSSprite.fillSprite(BackgroundColor);
|
||||||
AFSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||||
AFSprite.drawString(afstring, xPos2, 2);
|
RDSSprite.drawString(afstring, xPos2, 2);
|
||||||
AFSprite.pushSprite(35, 197);
|
RDSSprite.pushSprite(35, 197);
|
||||||
afticker = millis();
|
afticker = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,10 +109,10 @@ void ShowAdvancedRDS() {
|
|||||||
if (eonstring.length() < 20) {
|
if (eonstring.length() < 20) {
|
||||||
if (eonstringold != eonstring) {
|
if (eonstringold != eonstring) {
|
||||||
xPos3 = 0;
|
xPos3 = 0;
|
||||||
EONSprite.fillSprite(BackgroundColor);
|
RDSSprite.fillSprite(BackgroundColor);
|
||||||
EONSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||||
EONSprite.drawString(eonstring, xPos3, 2);
|
RDSSprite.drawString(eonstring, xPos3, 2);
|
||||||
EONSprite.pushSprite(35, 172);
|
RDSSprite.pushSprite(35, 172);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (millis() - eonticker >= 15) {
|
if (millis() - eonticker >= 15) {
|
||||||
@@ -126,10 +126,10 @@ void ShowAdvancedRDS() {
|
|||||||
eontickerhold = millis();
|
eontickerhold = millis();
|
||||||
}
|
}
|
||||||
if (xPos3 < -tft.textWidth(eonstring) + (charWidth * 14)) xPos3 = 0;
|
if (xPos3 < -tft.textWidth(eonstring) + (charWidth * 14)) xPos3 = 0;
|
||||||
EONSprite.fillSprite(BackgroundColor);
|
RDSSprite.fillSprite(BackgroundColor);
|
||||||
EONSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||||
EONSprite.drawString(eonstring, xPos3, 2);
|
RDSSprite.drawString(eonstring, xPos3, 2);
|
||||||
EONSprite.pushSprite(35, 172);
|
RDSSprite.pushSprite(35, 172);
|
||||||
eonticker = millis();
|
eonticker = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,10 +146,10 @@ void ShowAdvancedRDS() {
|
|||||||
if (rtplusstring.length() < 20) {
|
if (rtplusstring.length() < 20) {
|
||||||
if (rtplusstringold != rtplusstring) {
|
if (rtplusstringold != rtplusstring) {
|
||||||
xPos4 = 0;
|
xPos4 = 0;
|
||||||
RTPlusSprite.fillSprite(BackgroundColor);
|
RDSSprite.fillSprite(BackgroundColor);
|
||||||
RTPlusSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||||
RTPlusSprite.drawString(rtplusstring, xPos4, 2);
|
RDSSprite.drawString(rtplusstring, xPos4, 2);
|
||||||
RTPlusSprite.pushSprite(35, 146);
|
RDSSprite.pushSprite(35, 146);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (millis() - rtplusticker >= 15) {
|
if (millis() - rtplusticker >= 15) {
|
||||||
@@ -163,10 +163,10 @@ void ShowAdvancedRDS() {
|
|||||||
rtplustickerhold = millis();
|
rtplustickerhold = millis();
|
||||||
}
|
}
|
||||||
if (xPos4 < -tft.textWidth(rtplusstring) + (charWidth * 14)) xPos4 = 0;
|
if (xPos4 < -tft.textWidth(rtplusstring) + (charWidth * 14)) xPos4 = 0;
|
||||||
RTPlusSprite.fillSprite(BackgroundColor);
|
RDSSprite.fillSprite(BackgroundColor);
|
||||||
RTPlusSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||||
RTPlusSprite.drawString(rtplusstring, xPos4, 2);
|
RDSSprite.drawString(rtplusstring, xPos4, 2);
|
||||||
RTPlusSprite.pushSprite(35, 146);
|
RDSSprite.pushSprite(35, 146);
|
||||||
rtplusticker = millis();
|
rtplusticker = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,9 +110,7 @@ extern WiFiClient RemoteClient;
|
|||||||
extern WiFiUDP Udp;
|
extern WiFiUDP Udp;
|
||||||
extern TFT_eSprite RadiotextSprite;
|
extern TFT_eSprite RadiotextSprite;
|
||||||
extern TFT_eSprite AdvRadiotextSprite;
|
extern TFT_eSprite AdvRadiotextSprite;
|
||||||
extern TFT_eSprite EONSprite;
|
extern TFT_eSprite RDSSprite;
|
||||||
extern TFT_eSprite RTPlusSprite;
|
|
||||||
extern TFT_eSprite AFSprite;
|
|
||||||
|
|
||||||
void ShowAdvancedRDS();
|
void ShowAdvancedRDS();
|
||||||
void readRds();
|
void readRds();
|
||||||
|
|||||||
Reference in New Issue
Block a user