Moved underscore variable to try to avoid memoryleak

This commit is contained in:
Sjef Verhoeven PE5PVB
2024-02-14 19:02:01 +01:00
parent 2d48487adf
commit c1a2a4557e
4 changed files with 14 additions and 14 deletions
+2 -2
View File
@@ -420,7 +420,7 @@ void setup() {
LowLevelSet = EEPROM.readByte(EE_BYTE_LOWLEVELSET); LowLevelSet = EEPROM.readByte(EE_BYTE_LOWLEVELSET);
memorypos = EEPROM.readByte(EE_BYTE_MEMORYPOS); memorypos = EEPROM.readByte(EE_BYTE_MEMORYPOS);
region = EEPROM.readByte(EE_BYTE_REGION); region = EEPROM.readByte(EE_BYTE_REGION);
radio.rds.underscore = EEPROM.readByte(EE_BYTE_RDS_UNDERSCORE); radio.underscore = EEPROM.readByte(EE_BYTE_RDS_UNDERSCORE);
USBmode = EEPROM.readByte(EE_BYTE_USBMODE); USBmode = EEPROM.readByte(EE_BYTE_USBMODE);
wifi = EEPROM.readByte(EE_BYTE_WIFI); wifi = EEPROM.readByte(EE_BYTE_WIFI);
subnetclient = EEPROM.readByte(EE_BYTE_SUBNETCLIENT); subnetclient = EEPROM.readByte(EE_BYTE_SUBNETCLIENT);
@@ -1919,7 +1919,7 @@ void ModeButtonPress() {
EEPROM.writeByte(EE_BYTE_SHOWRDSERRORS, showrdserrors); EEPROM.writeByte(EE_BYTE_SHOWRDSERRORS, showrdserrors);
EEPROM.writeByte(EE_BYTE_LOWLEVELSET, LowLevelSet); EEPROM.writeByte(EE_BYTE_LOWLEVELSET, LowLevelSet);
EEPROM.writeByte(EE_BYTE_REGION, region); EEPROM.writeByte(EE_BYTE_REGION, region);
EEPROM.writeByte(EE_BYTE_RDS_UNDERSCORE, radio.rds.underscore); EEPROM.writeByte(EE_BYTE_RDS_UNDERSCORE, radio.underscore);
EEPROM.writeByte(EE_BYTE_USBMODE, USBmode); EEPROM.writeByte(EE_BYTE_USBMODE, USBmode);
EEPROM.writeByte(EE_BYTE_WIFI, wifi); EEPROM.writeByte(EE_BYTE_WIFI, wifi);
EEPROM.writeByte(EE_BYTE_SUBNETCLIENT, subnetclient); EEPROM.writeByte(EE_BYTE_SUBNETCLIENT, subnetclient);
+2 -2
View File
@@ -1720,7 +1720,7 @@ String TEF6686::extractUTF8Substring(const String & utf8String, size_t start, si
charIndex++; charIndex++;
} }
if (under && rds.underscore) { if (under && underscore) {
while (substring.length() < length) { while (substring.length() < length) {
substring += '_'; substring += '_';
} }
@@ -1734,7 +1734,7 @@ void TEF6686::RDScharConverter(const char* input, wchar_t* output, size_t size,
for (size_t i = 0; i < size - 1; i++) { for (size_t i = 0; i < size - 1; i++) {
char currentChar = input[i]; char currentChar = input[i];
switch (currentChar) { switch (currentChar) {
case 0x20: if (under && rds.underscore) output[i] = L'_'; else output[i] = L' '; break; case 0x20: if (under && underscore) output[i] = L'_'; else output[i] = L' '; break;
case 0x21 ... 0x5D: output[i] = static_cast<wchar_t>(currentChar); break; case 0x21 ... 0x5D: output[i] = static_cast<wchar_t>(currentChar); break;
case 0x5E: output[i] = L''; break; case 0x5E: output[i] = L''; break;
case 0x5F: output[i] = L'_'; break; case 0x5F: output[i] = L'_'; break;
+1 -1
View File
@@ -610,7 +610,6 @@ typedef struct _rds_ {
bool rtAB32; bool rtAB32;
bool hasRDSplus; bool hasRDSplus;
bool filter; bool filter;
bool underscore;
bool rdsreset; bool rdsreset;
bool pierrors; bool pierrors;
bool sortaf; bool sortaf;
@@ -707,6 +706,7 @@ class TEF6686 {
uint8_t rdsblock; uint8_t rdsblock;
bool mute; bool mute;
bool afmethodB; bool afmethodB;
bool underscore;
byte af_updatecounter; byte af_updatecounter;
private: private:
+8 -8
View File
@@ -611,7 +611,7 @@ void BuildMenu() {
if (region == REGION_EU) tftPrint(1, myLanguage[language][47], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (region == REGION_EU) tftPrint(1, myLanguage[language][47], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16);
if (region == REGION_US) tftPrint(1, myLanguage[language][48], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (region == REGION_US) tftPrint(1, myLanguage[language][48], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16);
if (radio.rds.underscore) tftPrint(1, myLanguage[language][42], 310, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (radio.underscore) tftPrint(1, myLanguage[language][42], 310, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16);
if (radio.rds.filter) tftPrint(1, myLanguage[language][42], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (radio.rds.filter) tftPrint(1, myLanguage[language][42], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16);
if (radio.rds.pierrors) tftPrint(1, myLanguage[language][42], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (radio.rds.pierrors) tftPrint(1, myLanguage[language][42], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16);
@@ -1283,9 +1283,9 @@ void MenuUp() {
break; break;
case ITEM3: case ITEM3:
if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); if (radio.underscore) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28);
if (radio.rds.underscore) radio.rds.underscore = false; else radio.rds.underscore = true; if (radio.underscore) radio.underscore = false; else radio.underscore = true;
if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (radio.underscore) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
break; break;
case ITEM4: case ITEM4:
@@ -1881,9 +1881,9 @@ void MenuDown() {
break; break;
case ITEM3: case ITEM3:
if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); if (radio.underscore) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28);
if (radio.rds.underscore) radio.rds.underscore = false; else radio.rds.underscore = true; if (radio.underscore) radio.underscore = false; else radio.underscore = true;
if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (radio.underscore) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
break; break;
case ITEM4: case ITEM4:
@@ -2450,7 +2450,7 @@ void DoMenu() {
case ITEM3: case ITEM3:
Infoboxprint(myLanguage[language][49]); Infoboxprint(myLanguage[language][49]);
if (radio.rds.underscore) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (radio.underscore) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
break; break;
case ITEM4: case ITEM4: