diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 9a69bea..6210772 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -4644,8 +4644,6 @@ uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, ui tft.fillRect(66, 110, 188, 6, GreyoutColor); tftPrint(1, myLanguage[language][272], 120, 155, ActiveColor, ActiveColorSmooth, 16); - while (digitalRead(ROTARY_BUTTON)) delay(50); - for (frequency = startfreq * 10; frequency <= stopfreq * 10; frequency += 10) { if (stopScanning) { break; @@ -4704,8 +4702,8 @@ uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, ui percentold = percent; } - if (digitalRead(ROTARY_BUTTON) == LOW) { - while (digitalRead(ROTARY_BUTTON)) delay(50); + if (digitalRead(MODEBUTTON) == LOW) { + while (digitalRead(MODEBUTTON)) delay(50); error = 2; stopScanning = true; break; @@ -4771,3 +4769,13 @@ void StoreMemoryPos(uint8_t _pos) { presets[_pos].frequency = frequency_SW; } } + +void ClearMemoryRange(uint8_t start, uint8_t stop) { + for (uint8_t pos = start; pos <= stop; pos++) { + EEPROM.writeByte(pos + EE_PRESETS_BAND_START, BAND_FM); + EEPROM.writeUInt((pos * 4) + EE_PRESETS_FREQUENCY_START, EE_PRESETS_FREQUENCY); + EEPROM.commit(); + presets[pos].band = BAND_FM; + presets[pos].frequency = EE_PRESETS_FREQUENCY; + } +} diff --git a/src/gui.cpp b/src/gui.cpp index 47836e7..3b4dcf4 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -8,7 +8,7 @@ #include byte menuitem; -byte items[10] = {10, static_cast(dynamicspi ? 10 : 9), 7, 10, 10, 10, 9, 6, 7, 6}; +byte items[10] = {10, static_cast(dynamicspi ? 10 : 9), 7, 10, 10, 10, 9, 6, 7, 7}; extern mem presets[]; bool setWiFiConnectParam = false; @@ -1251,6 +1251,12 @@ void ShowOneLine(byte position, byte item, bool selected) { FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); FullLineSprite.drawString((scanmute ? myLanguage[language][42] : myLanguage[language][30]), 298, 2); break; + + case AUTOMEM: + FullLineSprite.setTextDatum(TL_DATUM); + FullLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false); + FullLineSprite.drawString(removeNewline(myLanguage[language][276]), 6, 2); + break; } break; @@ -4533,6 +4539,21 @@ void DoMenu() { OneBigLineSprite.drawString((mempionly ? myLanguage[language][42] : myLanguage[language][30]), 135, 0); OneBigLineSprite.pushSprite(24, 118); break; + + case ITEM7: + Infoboxprint(myLanguage[language][276]); + + ClearMemoryRange(memstartpos, memstoppos); + OneBigLineSprite.drawString(myLanguage[language][216], 135, 0); + OneBigLineSprite.pushSprite(24, 118); + + switch (CurrentTheme) { + case 7: OneBigLineSprite.pushImage(-11, -118, 292, 170, popupbackground_wo); break; + default: OneBigLineSprite.pushImage(-11, -118, 292, 170, popupbackground); break; + } + OneBigLineSprite.drawString(String(memstartpos + 1) + " - " + String(memstoppos + 1) + " " + String(myLanguage[language][277]), 135, 0); + OneBigLineSprite.pushSprite(24, 148); + break; } break; } diff --git a/src/gui.h b/src/gui.h index f50fb9f..f220d02 100644 --- a/src/gui.h +++ b/src/gui.h @@ -244,4 +244,5 @@ extern void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, i extern void setAutoSpeedSPI(); extern void showAutoSquelch(bool mode); extern uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, uint8_t stopmem, bool pisearch); +extern void ClearMemoryRange(uint8_t start, uint8_t stop); #endif \ No newline at end of file diff --git a/src/language.h b/src/language.h index ff5576c..f08d49c 100644 --- a/src/language.h +++ b/src/language.h @@ -5,7 +5,7 @@ // [number of languages][number of texts] -static const char* const myLanguage[18][276] PROGMEM = { +static const char* const myLanguage[18][278] PROGMEM = { { "English", // English "Rotary direction changed", // 1 "Please release button", // 2 @@ -281,7 +281,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Nederlands", // Dutch @@ -559,7 +561,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Gevonden", // 272 "Afgebroken! Geheugen vol", // 273 "Afgebroken! Knop ingedrukt", // 274 - "Zoeken zonder fouten voltooid" // 275 + "Zoeken zonder fouten voltooid", // 275 + "Wis geheugenkanalen", // 276 + "gewist" // 277 }, { "Polski", // Polish @@ -837,7 +841,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Hrvatski", // Croatian @@ -1115,7 +1121,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Ελληνικά", // Greek @@ -1393,7 +1401,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Română", // Romanian @@ -1671,7 +1681,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Deutsch", // German @@ -1949,7 +1961,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Český", // Czech @@ -2227,7 +2241,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Magyar", // Hungarian @@ -2505,7 +2521,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Français", // French @@ -2783,7 +2801,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Български", // Bulgarian @@ -3061,7 +3081,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Русский", // Russian @@ -3339,7 +3361,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Українська", // Ukranian @@ -3617,7 +3641,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Italiano", // Italian @@ -3895,7 +3921,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Simplified Chinese", // Simplified Chinese @@ -4173,7 +4201,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Norsk", // Norwegian @@ -4451,7 +4481,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Español", // Spanish @@ -4729,7 +4761,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 }, { "Português", // Portuguese @@ -5007,7 +5041,9 @@ static const char* const myLanguage[18][276] PROGMEM = { "Found", // 272 "Abort! Out of memorychannels", // 273 "Abort! User pressed button", // 274 - "Scan finished without errors" // 275 + "Scan finished without errors", // 275 + "Clear memory channels", // 276 + "cleared" // 277 } }; #endif \ No newline at end of file