diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index dfc7e38..2b68827 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -184,7 +184,7 @@ byte amgain; byte freqoldcount; byte HighCutLevel; byte HighCutOffset; -byte items[10] = {10, static_cast(dynamicspi ? 10 : 9), 7, 10, 10, 10, 9, 6, 9, 9}; +byte items[10] = {10, static_cast(dynamicspi ? 10 : 9), 7, 10, 10, 10, 9, 6, 10, 9}; byte iMSEQ; byte iMSset; byte language; @@ -642,6 +642,7 @@ void setup() { webserver.on("/", handleRoot); webserver.on("/downloadCSV", HTTP_GET, handleDownloadCSV); + webserver.on("/logo.png", handleLogo); doTheme(); @@ -2732,7 +2733,12 @@ void ButtonPress() { } } } else { - toggleiMSEQ(); + if (band < BAND_GAP) { + if (addRowToCSV()) ShowFreq(2); else ShowFreq(3); + delay(200); + while (digitalRead(ROTARY_BUTTON) == LOW) delay(50); + ShowFreq(0); + } } } if (screensaverset) { @@ -3150,17 +3156,32 @@ void ShowFreq(int mode) { } FrequencySprite.setTextDatum(TR_DATUM); + switch (mode) { + case 0: + FrequencySprite.fillSprite(BackgroundColor); + FrequencySprite.setTextColor(FreqColor, FreqColorSmooth, false); + FrequencySprite.drawString(String(freq / 100) + "." + (freq % 100 < 10 ? "0" : "") + String(freq % 100) + " ", 218, -6); + FrequencySprite.pushSprite(46, 46); + freqold = freq; + break; - if (mode == 0) { - FrequencySprite.fillSprite(BackgroundColor); - FrequencySprite.setTextColor(FreqColor, FreqColorSmooth, false); - FrequencySprite.drawString(String(freq / 100) + "." + (freq % 100 < 10 ? "0" : "") + String(freq % 100) + " ", 218, -6); - FrequencySprite.pushSprite(46, 46); - freqold = freq; - } else if (mode == 1) { - FrequencySprite.fillSprite(BackgroundColor); - FrequencySprite.pushSprite(46, 46); - tftPrint(0, myLanguage[language][34], 146, 58, ActiveColor, ActiveColorSmooth, 28); + case 1: + FrequencySprite.fillSprite(BackgroundColor); + FrequencySprite.pushSprite(46, 46); + tftPrint(0, myLanguage[language][34], 146, 58, ActiveColor, ActiveColorSmooth, 28); + break; + + case 2: + FrequencySprite.fillSprite(BackgroundColor); + FrequencySprite.pushSprite(46, 46); + tftPrint(0, myLanguage[language][290], 146, 58, ActiveColor, ActiveColorSmooth, 28); + break; + + case 3: + FrequencySprite.fillSprite(BackgroundColor); + FrequencySprite.pushSprite(46, 46); + tftPrint(0, myLanguage[language][291], 146, 58, ActiveColor, ActiveColorSmooth, 28); + break; } FrequencySprite.unloadFont(); } @@ -5328,23 +5349,23 @@ void handleRoot() { // Add CSS styling for a modern, dark-themed look html += ""; html += ""; - // Add the logo image at the top of the page - html += "\"FMdx"; + // Add the logo image at the top of the page, served from SPIFFS + html += "\"FMdx"; // Add a header with a dynamic title from the language array (replace with actual language logic) html += "

" + String(myLanguage[language][286]) + "

"; @@ -5585,3 +5606,39 @@ String getCurrentDateTime() { return String(buf) + "," + timeEuropean; } } + +void handleLogo() { + fs::File file = SPIFFS.open("/logo.png", "r"); + if (!file) { + webserver.send(404, "text/plain", "Logo not found"); + return; + } + webserver.streamFile(file, "image/png"); + file.close(); +} + +void printLogbookCSV() { + // Attempt to open the CSV file stored in SPIFFS + fs::File file = SPIFFS.open("/logbook.csv", "r"); + + // Check if the file was successfully opened + if (!file) { + Serial.println("Failed to open logbook!"); + return; + } + + // Print a message indicating the start of the file content + Serial.println("===== Start of logbook.csv ====="); + + // Read and print the contents of the file line by line + while (file.available()) { + String line = file.readStringUntil('\n'); // Read one line at a time + Serial.println(line); // Print the line to the Serial Monitor + } + + // Close the file after reading + file.close(); + + // Print a message indicating the end of the file content + Serial.println("===== End of logbook.csv ====="); +} diff --git a/data/logo.png b/data/logo.png new file mode 100644 index 0000000..3c792b2 Binary files /dev/null and b/data/logo.png differ diff --git a/src/comms.cpp b/src/comms.cpp index d0416fd..0def40a 100644 --- a/src/comms.cpp +++ b/src/comms.cpp @@ -307,6 +307,8 @@ void Communication() { } } } + } else if (data_str.startsWith("l") || data_str.startsWith("L")) { + printLogbookCSV(); } } diff --git a/src/comms.h b/src/comms.h index a61ccc6..e0ca88b 100644 --- a/src/comms.h +++ b/src/comms.h @@ -148,5 +148,5 @@ extern void showAutoSquelch(bool mode); extern void ShowStepSize(); extern void startFMDXScan(); extern void cancelDXScan(); - +extern void printLogbookCSV(); #endif \ No newline at end of file diff --git a/src/gui.cpp b/src/gui.cpp index dd32ab3..8b3e156 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -1555,6 +1555,12 @@ void ShowOneLine(byte position, byte item, bool selected) { FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); FullLineSprite.drawString(String(fmscansens), 298, 2); break; + + case DXMODE: + FullLineSprite.setTextDatum(TL_DATUM); + FullLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false); + FullLineSprite.drawString(removeNewline(myLanguage[language][292]), 6, 2); + break; } break; } @@ -2608,6 +2614,12 @@ void ShowOneButton(byte position, byte item, bool selected) { PSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); PSSprite.drawString(String(fmscansens), 75, 15); break; + + case DXMODE: + PSSprite.setTextDatum(TC_DATUM); + PSSprite.setTextColor(ActiveColor, ActiveColorSmooth, false); + PSSprite.drawString(shortLine(removeNewline(myLanguage[language][292])), 75, 8); + break; } break; } @@ -4854,14 +4866,14 @@ void MenuDown() { } void showMenuOpenTouchButtons() { - if (hardwaremodel == PORTABLE_TOUCH_ILI9341 && !((menupage == CONNECTIVITY && menuoption == ITEM3) || (menupage == AUTOMEM && (menuoption == ITEM1 || menuoption == ITEM9)) || (menupage == MAINSETTINGS && menuoption == ITEM1))) { + if (hardwaremodel == PORTABLE_TOUCH_ILI9341 && !((menupage == CONNECTIVITY && menuoption == ITEM3) || (menupage == AUTOMEM && (menuoption == ITEM1 || menuoption == ITEM9)) || (menupage == MAINSETTINGS && menuoption == ITEM1) || (menupage == DXMODE && menuoption == ITEM10))) { tft.fillRoundRect(18, 154, 60, 40, 6, FrameColor); tft.drawRoundRect(18, 154, 60, 40, 6, ActiveColor); tft.fillRoundRect(240, 154, 60, 40, 6, FrameColor); tft.drawRoundRect(240, 154, 60, 40, 6, ActiveColor); tft.fillTriangle(52, 160, 52, 188, 38, 174, (CurrentTheme == 7 ? White : ActiveColor)); tft.fillTriangle(266, 160, 266, 188, 280, 174, (CurrentTheme == 7 ? White : ActiveColor)); - if (menuoption == ITEM9) { + if (!submenu && menuoption == ITEM9) { tft.fillRoundRect(240, 36, 60, 40, 6, FrameColor); tft.drawRoundRect(240, 36, 60, 40, 6, ActiveColor); tftPrint(0, "OK", 270, 44, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); @@ -5799,6 +5811,18 @@ void DoMenu() { OneBigLineSprite.drawString((scanholdonsignal ? myLanguage[language][42] : myLanguage[language][30]), 135, 0); OneBigLineSprite.pushSprite(24, 118); break; + + case ITEM10: + Infoboxprint(myLanguage[language][292]); + if (handleCreateNewLogbook()) OneBigLineSprite.drawString(myLanguage[language][293], 135, 0); else OneBigLineSprite.drawString(myLanguage[language][294], 135, 0); + OneBigLineSprite.pushSprite(24, 118); + + if (hardwaremodel == PORTABLE_TOUCH_ILI9341) { + tft.fillRoundRect(130, 154, 60, 40, 6, FrameColor); + tft.drawRoundRect(130, 154, 60, 40, 6, ActiveColor); + tftPrint(0, "OK", 160, 162, (CurrentTheme == 7 ? White : ActiveColor), ActiveColorSmooth, 28); + } + break; } break; diff --git a/src/gui.h b/src/gui.h index 3549f35..eaa543e 100644 --- a/src/gui.h +++ b/src/gui.h @@ -246,4 +246,5 @@ 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 rdsonly, uint8_t doublepi); extern void ClearMemoryRange(uint8_t start, uint8_t stop); +extern bool handleCreateNewLogbook(); #endif \ No newline at end of file diff --git a/src/language.h b/src/language.h index e92369e..b5bf445 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][290] PROGMEM = { +static const char* const myLanguage[18][295] PROGMEM = { { "English", // English "Rotary direction changed", // 1 "Please release button", // 2 @@ -295,7 +295,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Nederlands", // Dutch @@ -587,7 +592,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Jouw logboek", // 286 "Download logboek", // 287 "Logboek is leeg", // 288 - "Ga naar einde" // 289 + "Ga naar einde", // 289 + "Logboek update", // 290 + "Log mislukt!", // 291 + "Logboek legen", // 292 + "Logboek geleegd", // 293 + "Legen mislukt" // 294 }, { "Polski", // Polish @@ -879,7 +889,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Hrvatski", // Croatian @@ -1171,7 +1186,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Ελληνικά", // Greek @@ -1463,7 +1483,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Română", // Romanian @@ -1755,7 +1780,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Deutsch", // German @@ -2047,7 +2077,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Český", // Czech @@ -2339,7 +2374,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Magyar", // Hungarian @@ -2631,7 +2671,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Français", // French @@ -2923,7 +2968,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Български", // Bulgarian @@ -3215,7 +3265,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Русский", // Russian @@ -3507,7 +3562,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Українська", // Ukranian @@ -3799,7 +3859,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Italiano", // Italian @@ -4091,7 +4156,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Simplified Chinese", // Simplified Chinese @@ -4383,7 +4453,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Norsk", // Norwegian @@ -4675,7 +4750,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Español", // Spanish @@ -4967,7 +5047,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 }, { "Português", // Portuguese @@ -5259,7 +5344,12 @@ static const char* const myLanguage[18][290] PROGMEM = { "Your logbook", // 286 "Download logbook", // 287 "Logbook is empty", // 288 - "Go to bottom" // 289 + "Go to bottom", // 289 + "Added to log", // 290 + "Update failed!", // 291 + "Clear logbook", // 292 + "Logbook cleared", // 293 + "Clear failed" // 294 } }; #endif \ No newline at end of file