You've already forked TEF6686_ESP32
Won 105kB flash by optimising UI text handling
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "comms.h"
|
||||
#include "language.h"
|
||||
#include "constants.h"
|
||||
#include <EEPROM.h>
|
||||
|
||||
@@ -805,7 +804,7 @@ void XDRGTKRoutine() {
|
||||
if (!screenmute) {
|
||||
tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor);
|
||||
tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor);
|
||||
tftPrint(0, myLanguage[language][34], 160, 100, ActiveColor, ActiveColorSmooth, 28);
|
||||
tftPrint(0, textUI(34), 160, 100, ActiveColor, ActiveColorSmooth, 28);
|
||||
}
|
||||
|
||||
DataPrint("U");
|
||||
@@ -974,7 +973,7 @@ void tryWiFi() {
|
||||
if (!setupmode && wifi) {
|
||||
tft.drawRoundRect(1, 20, 319, 180, 5, ActiveColor);
|
||||
tft.fillRoundRect(3, 22, 315, 176, 5, BackgroundColor);
|
||||
Infoboxprint(myLanguage[language][55]);
|
||||
Infoboxprint(textUI(55));
|
||||
}
|
||||
if (wifi) {
|
||||
if (wc.autoConnect()) {
|
||||
@@ -986,9 +985,9 @@ void tryWiFi() {
|
||||
webserver.begin();
|
||||
NTPupdate();
|
||||
remoteip = IPAddress (WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient);
|
||||
if (!setupmode) tftPrint(0, myLanguage[language][57], 155, 128, InsignificantColor, InsignificantColorSmooth, 28);
|
||||
if (!setupmode) tftPrint(0, textUI(57), 155, 128, InsignificantColor, InsignificantColorSmooth, 28);
|
||||
} else {
|
||||
if (!setupmode) tftPrint(0, myLanguage[language][56], 155, 128, SignificantColor, SignificantColorSmooth, 28);
|
||||
if (!setupmode) tftPrint(0, textUI(56), 155, 128, SignificantColor, SignificantColorSmooth, 28);
|
||||
Server.end();
|
||||
webserver.stop();
|
||||
Udp.stop();
|
||||
|
||||
@@ -158,4 +158,5 @@ extern void Infoboxprint(const char* input);
|
||||
extern void TuneUp();
|
||||
extern void TuneDown();
|
||||
extern void ShowTuneMode();
|
||||
extern const char* textUI(uint16_t number);
|
||||
#endif
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
|
||||
#define VERSION "v2.20"
|
||||
|
||||
#define ON 1
|
||||
#define OFF 0
|
||||
#define REVERSE false
|
||||
|
||||
1407
src/gui.cpp
1407
src/gui.cpp
File diff suppressed because it is too large
Load Diff
@@ -207,6 +207,7 @@ extern unsigned int memstartfreq;
|
||||
extern unsigned int memstopfreq;
|
||||
extern unsigned long scantimer;
|
||||
extern byte items[10];
|
||||
extern const size_t language_totalnumber;
|
||||
|
||||
extern TFT_eSPI tft;
|
||||
extern TEF6686 radio;
|
||||
@@ -255,4 +256,5 @@ extern void showAutoSquelch(bool mode);
|
||||
extern uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, uint8_t stopmem, bool rdsonly, uint8_t doublepi);
|
||||
extern void ClearMemoryRange(uint8_t start, uint8_t stop);
|
||||
extern bool handleCreateNewLogbook();
|
||||
extern const char* textUI(uint16_t number);
|
||||
#endif
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef LANGUAGE_H
|
||||
#define LANGUAGE_H
|
||||
|
||||
#define VERSION "v2.20"
|
||||
|
||||
// [number of languages][number of texts]
|
||||
|
||||
static const char* const myLanguage[21][301] PROGMEM = {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "logbook.h"
|
||||
#include "language.h"
|
||||
#include "constants.h"
|
||||
#include <EEPROM.h>
|
||||
|
||||
@@ -45,9 +44,9 @@ void handleRoot() {
|
||||
html += "<img src=\"/logo.png\" alt=\"FMDX website\">";
|
||||
html += "</a>";
|
||||
|
||||
html += "<h1>" + String(myLanguage[language][286]) + "</h1>";
|
||||
html += "<button onclick=\"window.location.href='/downloadCSV'\">" + String(myLanguage[language][287]) + "</button>";
|
||||
html += "<button class=\"go-to-bottom\" onclick=\" window.scrollTo(0, document.body.scrollHeight);\">" + String(myLanguage[language][289]) + "</button>";
|
||||
html += "<h1>" + String(textUI(286)) + "</h1>";
|
||||
html += "<button onclick=\"window.location.href='/downloadCSV'\">" + String(textUI(287)) + "</button>";
|
||||
html += "<button class=\"go-to-bottom\" onclick=\" window.scrollTo(0, document.body.scrollHeight);\">" + String(textUI(289)) + "</button>";
|
||||
|
||||
// Sorting function with icons
|
||||
html += "<script>";
|
||||
@@ -151,11 +150,11 @@ void handleRoot() {
|
||||
|
||||
file.close();
|
||||
} else {
|
||||
html += "<tr><td colspan=\"100%\" style=\"text-align: center; color: red;\">" + String(myLanguage[language][299]) + "</td></tr>";
|
||||
html += "<tr><td colspan=\"100%\" style=\"text-align: center; color: red;\">" + String(textUI(299)) + "</td></tr>";
|
||||
}
|
||||
|
||||
if (!hasData) {
|
||||
html += "<tr><td colspan=\"100%\" style=\"text-align: center; color: red;\">" + String(myLanguage[language][288]) + "</td></tr>";
|
||||
html += "<tr><td colspan=\"100%\" style=\"text-align: center; color: red;\">" + String(textUI(288)) + "</td></tr>";
|
||||
}
|
||||
|
||||
html += "</table>";
|
||||
|
||||
@@ -40,4 +40,6 @@ void handleLogo();
|
||||
void printLogbookCSV();
|
||||
void sendUDPlog();
|
||||
IPAddress makeBroadcastAddress(IPAddress ip);
|
||||
|
||||
extern const char* textUI(uint16_t number);
|
||||
#endif
|
||||
19
src/rds.cpp
19
src/rds.cpp
@@ -1,7 +1,6 @@
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wbool-compare"
|
||||
#include "rds.h"
|
||||
#include "language.h"
|
||||
#include "constants.h"
|
||||
#include <TimeLib.h>
|
||||
|
||||
@@ -51,7 +50,7 @@ void ShowAdvancedRDS() {
|
||||
|
||||
if (licold != radio.rds.LIC || rdsreset) {
|
||||
if (!screenmute) {
|
||||
if (radio.rds.hasLIC) LICString = (radio.rds.LICtext.length() == 0 ? myLanguage[language][73] : radio.rds.LICtext); else LICString = "N/A";
|
||||
if (radio.rds.hasLIC) LICString = (radio.rds.LICtext.length() == 0 ? textUI(73) : radio.rds.LICtext); else LICString = "N/A";
|
||||
if (LICString != LIColdString) {
|
||||
tftPrint(-1, "N/A", 242, 208, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, LIColdString, 242, 208, BackgroundColor, BackgroundColor, 16);
|
||||
@@ -74,7 +73,7 @@ void ShowAdvancedRDS() {
|
||||
}
|
||||
|
||||
String afstring;
|
||||
if (radio.rds.hasAF && radio.af_counter > 0) for (byte i = 0; i < radio.af_counter; i++) afstring += String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10) + (i == radio.af_counter - 1 ? " " : " | "); else afstring = myLanguage[language][87];
|
||||
if (radio.rds.hasAF && radio.af_counter > 0) for (byte i = 0; i < radio.af_counter; i++) afstring += String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10) + (i == radio.af_counter - 1 ? " " : " | "); else afstring = textUI(87);
|
||||
if (hasafold != radio.rds.hasAF) {
|
||||
if (!screenmute) {
|
||||
if (radio.rds.hasAF) tftPrint(-1, "AF", 50, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(-1, "AF", 50, 51, GreyoutColor, BackgroundColor, 16);
|
||||
@@ -115,7 +114,7 @@ void ShowAdvancedRDS() {
|
||||
}
|
||||
|
||||
String eonstring;
|
||||
if (radio.eon_counter > 0) for (byte i = 0; i < radio.eon_counter; i++) eonstring += String(radio.eon[i].picode) + (radio.eon[i].ps.length() > 0 ? String(": " + String(radio.eon[i].ps)) : "") + (radio.eon[i].mappedfreq > 0 ? String(" " + String(radio.eon[i].mappedfreq / 100) + "." + String((radio.eon[i].mappedfreq % 100) / 10)) : "") + (radio.eon[i].mappedfreq2 > 0 ? String(" / " + String(radio.eon[i].mappedfreq2 / 100) + "." + String((radio.eon[i].mappedfreq2 % 100) / 10)) : "") + (radio.eon[i].mappedfreq3 > 0 ? String(" / " + String(radio.eon[i].mappedfreq3 / 100) + "." + String((radio.eon[i].mappedfreq3 % 100) / 10)) : "") + (i == radio.eon_counter - 1 ? " " : " | "); else eonstring = myLanguage[language][88];
|
||||
if (radio.eon_counter > 0) for (byte i = 0; i < radio.eon_counter; i++) eonstring += String(radio.eon[i].picode) + (radio.eon[i].ps.length() > 0 ? String(": " + String(radio.eon[i].ps)) : "") + (radio.eon[i].mappedfreq > 0 ? String(" " + String(radio.eon[i].mappedfreq / 100) + "." + String((radio.eon[i].mappedfreq % 100) / 10)) : "") + (radio.eon[i].mappedfreq2 > 0 ? String(" / " + String(radio.eon[i].mappedfreq2 / 100) + "." + String((radio.eon[i].mappedfreq2 % 100) / 10)) : "") + (radio.eon[i].mappedfreq3 > 0 ? String(" / " + String(radio.eon[i].mappedfreq3 / 100) + "." + String((radio.eon[i].mappedfreq3 % 100) / 10)) : "") + (i == radio.eon_counter - 1 ? " " : " | "); else eonstring = textUI(88);
|
||||
if (haseonold != radio.rds.hasEON) {
|
||||
if (!screenmute) {
|
||||
if (radio.eon_counter > 0) tftPrint(-1, "EON", 153, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(-1, "EON", 153, 51, GreyoutColor, BackgroundColor, 16);
|
||||
@@ -156,7 +155,7 @@ void ShowAdvancedRDS() {
|
||||
}
|
||||
|
||||
String rtplusstring;
|
||||
if (radio.rds.hasRDSplus) rtplusstring = (radio.rds.rdsplusTag1 != 169 ? String(myLanguage[language][radio.rds.rdsplusTag1]) + ": " + String(radio.rds.RTContent1) : "") + (radio.rds.rdsplusTag2 != 169 ? " - " + String(myLanguage[language][radio.rds.rdsplusTag2]) + ": " + String(radio.rds.RTContent2) : "") + " "; else rtplusstring = myLanguage[language][89];
|
||||
if (radio.rds.hasRDSplus) rtplusstring = (radio.rds.rdsplusTag1 != 169 ? String(textUI(radio.rds.rdsplusTag1)) + ": " + String(radio.rds.RTContent1) : "") + (radio.rds.rdsplusTag2 != 169 ? " - " + String(textUI(radio.rds.rdsplusTag2)) + ": " + String(radio.rds.RTContent2) : "") + " "; else rtplusstring = textUI(89);
|
||||
if (hasrtplusold != radio.rds.hasRDSplus) {
|
||||
if (!screenmute) {
|
||||
if (radio.rds.hasRDSplus) tftPrint(-1, "RT+", 123, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(-1, "RT+", 123, 51, GreyoutColor, BackgroundColor, 16);
|
||||
@@ -281,7 +280,7 @@ void showECC() {
|
||||
if (ECCold != radio.rds.ECC) {
|
||||
if (advancedRDS) {
|
||||
if (!screenmute) {
|
||||
if (radio.rds.hasECC) ECCString = (radio.rds.ECCtext.length() == 0 ? myLanguage[language][73] : radio.rds.ECCtext); else ECCString = "N/A";
|
||||
if (radio.rds.hasECC) ECCString = (radio.rds.ECCtext.length() == 0 ? textUI(73) : radio.rds.ECCtext); else ECCString = "N/A";
|
||||
if (ECCString != ECColdString) {
|
||||
tftPrint(-1, "N/A", 242, 193, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, ECColdString, 242, 193, BackgroundColor, BackgroundColor, 16);
|
||||
@@ -617,7 +616,7 @@ void showPI() {
|
||||
|
||||
void showPTY() {
|
||||
if (strcmp(radio.rds.stationType, programTypePrevious)) {
|
||||
String PTYString = String(radio.rds.stationTypeCode) + "/" + (radio.rds.region != 0 ? radio.rds.stationType : myLanguage[language][228 + radio.rds.stationTypeCode]);
|
||||
String PTYString = String(radio.rds.stationTypeCode) + "/" + (radio.rds.region != 0 ? radio.rds.stationType : textUI(228 + radio.rds.stationTypeCode));
|
||||
|
||||
if (radio.rds.stationTypeCode == 32) PTYString = "";
|
||||
|
||||
@@ -1002,7 +1001,7 @@ void ShowAFEON() {
|
||||
|
||||
if (radio.rds.hasAF && afpagenr == 1) {
|
||||
if (!hasafold) {
|
||||
tftPrint(-1, myLanguage[language][87], 6, 48, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, textUI(87), 6, 48, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "AF:", 4, 32, ActiveColor, ActiveColorSmooth, 16);
|
||||
hasafold = true;
|
||||
}
|
||||
@@ -1029,7 +1028,7 @@ void ShowAFEON() {
|
||||
|
||||
if (radio.eon_counter > 0 && afpagenr > 1) {
|
||||
if (!haseonold) {
|
||||
tftPrint(-1, myLanguage[language][88], 6, 48, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, textUI(88), 6, 48, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "PI", 4, 32, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(0, "TA", 250, 32, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(0, "TP", 276, 32, ActiveColor, ActiveColorSmooth, 16);
|
||||
@@ -1194,7 +1193,7 @@ void ShowAFEON() {
|
||||
aid_counterold = radio.rds.aid_counter;
|
||||
|
||||
if (AIDStringTemp != AIDStringold) {
|
||||
AIDString = String(myLanguage[language][33]) + " - " + String(myLanguage[language][79]) + ": " + AIDStringTemp + " ";
|
||||
AIDString = String(textUI(33)) + " - " + String(textUI(79)) + ": " + AIDStringTemp + " ";
|
||||
AIDWidth = FullLineSprite.textWidth(AIDString);
|
||||
AIDStringold = AIDString;
|
||||
}
|
||||
|
||||
@@ -158,4 +158,5 @@ extern void DataPrint(String string);
|
||||
extern void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize);
|
||||
extern void tftReplace(int8_t offset, const String & textold, const String & text, int16_t x, int16_t y, int color, int smoothcolor, int background, uint8_t fontsize);
|
||||
extern bool isDST(time_t t);
|
||||
extern const char* textUI(uint16_t number);
|
||||
#endif
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "touch.h"
|
||||
#include "language.h"
|
||||
#include "constants.h"
|
||||
#include <EEPROM.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user