From 58c93ed40131c533f4e6d5f8a130cca2675dc6d1 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Tue, 20 Feb 2024 15:40:52 -0500 Subject: [PATCH 1/8] Add remove SD files for Mini --- esp32_marauder/MenuFunctions.cpp | 112 ++++++++++++++++++++++++++++--- esp32_marauder/MenuFunctions.h | 1 + esp32_marauder/SDInterface.cpp | 19 +++++- esp32_marauder/SDInterface.h | 3 + esp32_marauder/configs.h | 2 +- 5 files changed, 124 insertions(+), 13 deletions(-) diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp index b066c5ba0..184e1a2fc 100644 --- a/esp32_marauder/MenuFunctions.cpp +++ b/esp32_marauder/MenuFunctions.cpp @@ -1245,6 +1245,13 @@ void MenuFunctions::RunSetup() #ifdef MARAUDER_MINI miniKbMenu.list = new LinkedList(); #endif + #ifndef HAS_ILI9341 + #ifdef HAS_BUTTONS + #ifdef HAS_SD + sdDeleteMenu.list = new LinkedList(); + #endif + #endif + #endif // Bluetooth menu stuff bluetoothSnifferMenu.list = new LinkedList(); @@ -1283,6 +1290,9 @@ void MenuFunctions::RunSetup() #ifdef MARAUDER_MINI miniKbMenu.name = "Mini Keyboard"; #endif + #ifndef HAS_ILI9341 + sdDeleteMenu.name = "Delete SD Files"; + #endif // Build Main Menu mainMenu.parentMenu = NULL; @@ -1553,17 +1563,6 @@ void MenuFunctions::RunSetup() this->changeMenu(htmlMenu.parentMenu); }); - /*int loopLimit = min(evil_portal_obj.html_files->size(), BUTTON_ARRAY_LEN); - - for (int i = 0; i < loopLimit - 1; i++) { - this->addNodes(&htmlMenu, evil_portal_obj.html_files->get(i), TFT_CYAN, NULL, 0, [this, i]() { - evil_portal_obj.target_html_name = (String)evil_portal_obj.html_files->get(i); - Serial.println("Set Evil Portal HTML as " + evil_portal_obj.target_html_name); - evil_portal_obj.using_serial_html = false; - this->changeMenu(htmlMenu.parentMenu); - }); - }*/ - // Select APs on Mini this->addNodes(&wifiGeneralMenu, text_table1[56], TFT_NAVY, NULL, KEYBOARD_ICO, [this](){ wifiAPMenu.list->clear(); @@ -1716,6 +1715,97 @@ void MenuFunctions::RunSetup() this->addNodes(&deviceMenu, text08, TFT_NAVY, NULL, KEYBOARD_ICO, [this]() { this->changeMenu(&settingsMenu); }); + #ifdef HAS_SD + if (sd_obj.supported) { + this->addNodes(&deviceMenu, "Delete SD Files", TFT_CYAN, NULL, SD_UPDATE, [this]() { + #ifndef HAS_ILI9341 + #ifdef HAS_BUTTONS + this->changeMenu(&sdDeleteMenu); + #if !(defined(MARAUDER_V6) || defined(MARAUDER_V6_1)) + + bool deleting = true; + + display_obj.tft.setTextWrap(false); + display_obj.tft.setCursor(0, SCREEN_HEIGHT / 3); + display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK); + display_obj.tft.println("Loading..."); + + while (deleting) { + // Build list of files + sd_obj.sd_files->clear(); + delete sd_obj.sd_files; + + sd_obj.sd_files = new LinkedList(); + + sd_obj.sd_files->add("Back"); + + sd_obj.listDirToLinkedList(sd_obj.sd_files); + + int sd_file_index = 0; + + this->sdDeleteMenu.list->set(0, MenuNode{sd_obj.sd_files->get(sd_file_index), false, TFT_CYAN, 0, NULL, true, NULL}); + this->buildButtons(&sdDeleteMenu); + this->displayCurrentMenu(); + + // Start button loop + while(true) { + #ifndef MARAUDER_M5STICKC + if (u_btn.justPressed()) { + if (sd_file_index > 0) + sd_file_index--; + else + sd_file_index = sd_obj.sd_files->size() - 1; + + this->sdDeleteMenu.list->set(0, MenuNode{sd_obj.sd_files->get(sd_file_index), false, TFT_CYAN, 0, NULL, true, NULL}); + this->buildButtons(&sdDeleteMenu); + this->displayCurrentMenu(); + } + #endif + if (d_btn.justPressed()) { + if (sd_file_index < sd_obj.sd_files->size() - 1) + sd_file_index++; + else + sd_file_index = 0; + + this->sdDeleteMenu.list->set(0, MenuNode{sd_obj.sd_files->get(sd_file_index), false, TFT_CYAN, 0, NULL, true, NULL}); + this->buildButtons(&sdDeleteMenu, 0, sd_obj.sd_files->get(sd_file_index)); + this->displayCurrentMenu(); + } + if (c_btn.justPressed()) { + if (sd_obj.sd_files->get(sd_file_index) != "Back") { + if (sd_obj.removeFile("/" + sd_obj.sd_files->get(sd_file_index))) + Serial.println("Successfully Removed File: /" + sd_obj.sd_files->get(sd_file_index)); + display_obj.tft.setTextWrap(false); + display_obj.tft.setCursor(0, SCREEN_HEIGHT / 3); + display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK); + display_obj.tft.println("Deleting /" + sd_obj.sd_files->get(sd_file_index) + "..."); + } + else { + this->changeMenu(sdDeleteMenu.parentMenu); + deleting = false; + } + break; + } + } + } + #endif + #endif + #endif + }); + } + #endif + + #ifdef HAS_SD + #ifndef ILI9341 + #ifdef HAS_BUTTONS + sdDeleteMenu.parentMenu = &deviceMenu; + this->addNodes(&sdDeleteMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() { + this->changeMenu(sdDeleteMenu.parentMenu); + }); + #endif + #endif + #endif + // GPS Menu #ifdef HAS_GPS if (gps_obj.getGpsModuleStatus()) { diff --git a/esp32_marauder/MenuFunctions.h b/esp32_marauder/MenuFunctions.h index 84ee4d4f6..6df91523b 100644 --- a/esp32_marauder/MenuFunctions.h +++ b/esp32_marauder/MenuFunctions.h @@ -140,6 +140,7 @@ class MenuFunctions Menu specSettingMenu; Menu infoMenu; Menu languageMenu; + Menu sdDeleteMenu; // WiFi menu stuff Menu wifiSnifferMenu; diff --git a/esp32_marauder/SDInterface.cpp b/esp32_marauder/SDInterface.cpp index adfbbefaf..8d36c9a3b 100644 --- a/esp32_marauder/SDInterface.cpp +++ b/esp32_marauder/SDInterface.cpp @@ -79,6 +79,10 @@ bool SDInterface::initSD() { SD.mkdir("/SCRIPTS"); Serial.println("/SCRIPTS created"); } + + this->sd_files = new LinkedList(); + + this->sd_files->add("Back"); return true; } @@ -98,6 +102,13 @@ File SDInterface::getFile(String path) { } } +bool SDInterface::removeFile(String file_path) { + if (SD.remove(file_path)) + return true; + else + return false; +} + void SDInterface::listDirToLinkedList(LinkedList* file_names, String str_dir, String ext) { if (this->supported) { File dir = SD.open(str_dir); @@ -108,12 +119,18 @@ void SDInterface::listDirToLinkedList(LinkedList* file_names, String str { break; } + + if (entry.isDirectory()) + continue; + + String file_name = entry.name(); if (ext != "") { - String file_name = entry.name(); if (file_name.endsWith(ext)) { file_names->add(file_name); } } + else + file_names->add(file_name); } } } diff --git a/esp32_marauder/SDInterface.h b/esp32_marauder/SDInterface.h index af02262e6..eda62bafc 100644 --- a/esp32_marauder/SDInterface.h +++ b/esp32_marauder/SDInterface.h @@ -43,12 +43,15 @@ class SDInterface { bool initSD(); + LinkedList* sd_files; + void listDir(String str_dir); void listDirToLinkedList(LinkedList* file_names, String str_dir = "/", String ext = ""); File getFile(String path); void runUpdate(); void performUpdate(Stream &updateSource, size_t updateSize); void main(); + bool removeFile(String file_path); }; #endif diff --git a/esp32_marauder/configs.h b/esp32_marauder/configs.h index 63c6cbb7f..258aacba4 100644 --- a/esp32_marauder/configs.h +++ b/esp32_marauder/configs.h @@ -20,7 +20,7 @@ //#define XIAO_ESP32_S3 //// END BOARD TARGETS - #define MARAUDER_VERSION "v0.13.8" + #define MARAUDER_VERSION "v0.13.9" //// HARDWARE NAMES #ifdef MARAUDER_M5STICKC From 5bd4b647b55cf1583dc2afe2c95e28d6f8824958 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Thu, 22 Feb 2024 23:54:03 -0500 Subject: [PATCH 2/8] Add support for Adafruit Reverse Feather ESP32-S2 --- .github/workflows/build_push.yml | 84 ++++++++-- User_Setup_Select.h | 1 + User_Setup_marauder_mini.h | 4 +- User_Setup_marauder_rev_feather.h | 59 +++++++ esp32_marauder/.theia/launch.json | 8 + esp32_marauder/Display.cpp | 12 ++ esp32_marauder/EvilPortal.cpp | 12 +- esp32_marauder/MenuFunctions.cpp | 264 +++++++++++++++++++----------- esp32_marauder/MenuFunctions.h | 14 +- esp32_marauder/Switches.cpp | 98 +++++++++++ esp32_marauder/Switches.h | 35 ++++ esp32_marauder/WiFiScan.cpp | 12 +- esp32_marauder/configs.h | 184 ++++++++++++++++++++- esp32_marauder/esp32_marauder.ino | 14 +- 14 files changed, 666 insertions(+), 135 deletions(-) create mode 100644 User_Setup_marauder_rev_feather.h create mode 100644 esp32_marauder/.theia/launch.json create mode 100644 esp32_marauder/Switches.cpp create mode 100644 esp32_marauder/Switches.h diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml index 6a0017319..c39d0a71d 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/build_push.yml @@ -56,19 +56,12 @@ jobs: repository: bigbrodude6119/ESPAsyncWebServer ref: master path: CustomESPAsyncWebServer - - #- name: Install TFT_eSPI - # uses: actions/checkout@v2 - # with: - # repository: justcallmekoko/TFT_eSPI - # ref: master - # path: CustomTFT_eSPI - name: Install TFT_eSPI uses: actions/checkout@v2 with: repository: Bodmer/TFT_eSPI - ref: 2.2.23 + ref: 2.5.34 path: CustomTFT_eSPI - name: Install lv_arduino @@ -106,12 +99,12 @@ jobs: ref: v6.18.2 path: CustomArduinoJson - - name: Install SwitchLib - uses: actions/checkout@v2 - with: - repository: justcallmekoko/SwitchLib - ref: main - path: CustomSwitchLib + #- name: Install SwitchLib + # uses: actions/checkout@v2 + # with: + # repository: justcallmekoko/SwitchLib + # ref: main + # path: CustomSwitchLib - name: Install LinkedList uses: actions/checkout@v2 @@ -138,6 +131,7 @@ jobs: cp User_Setup_marauder_mini.h CustomTFT_eSPI/ cp User_Setup_og_marauder.h CustomTFT_eSPI/ cp User_Setup_marauder_m5stickc.h CustomTFT_eSPI/ + cp User_Setup_marauder_rev_feather.h CustomTFT_eSPI/ pwd ls -la ls -la CustomTFT_eSPI @@ -182,6 +176,7 @@ jobs: - name: Configure configs.h for Flipper Zero WiFi Dev Board run: | + sed -i 's/^ #define MARAUDER_REV_FEATHER/ \/\/#define MARAUDER_REV_FEATHER/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_M5STICKC/ \/\/#define MARAUDER_M5STICKC/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_MINI/ \/\/#define MARAUDER_MINI/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V4/ \/\/#define MARAUDER_V4/' esp32_marauder/configs.h @@ -218,9 +213,11 @@ jobs: - name: Configure TFT_eSPI and configs.h for OG Marauder run: | pwd - find /home/runner/ -name "*TFT_eSPI*" + find /home/runner/ -name "*TFT_eSPI*" + sed -i 's/^#include /\/\/#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h sed -i 's/^#include /\/\/#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h sed -i 's/^\/\/#include /#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h + sed -i 's/^ #define MARAUDER_REV_FEATHER/ \/\/#define MARAUDER_REV_FEATHER/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_MINI/ \/\/#define MARAUDER_MINI/' esp32_marauder/configs.h sed -i 's/^ \/\/#define MARAUDER_V4/ #define MARAUDER_V4/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V6/ \/\/#define MARAUDER_V6/' esp32_marauder/configs.h @@ -244,8 +241,10 @@ jobs: - name: Configure TFT_eSPI and configs.h for Marauder v6 run: | + sed -i 's/^#include /\/\/#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h sed -i 's/^#include /\/\/#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h sed -i 's/^\/\/#include /#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h + sed -i 's/^ #define MARAUDER_REV_FEATHER/ \/\/#define MARAUDER_REV_FEATHER/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_MINI/ \/\/#define MARAUDER_MINI/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V4/ \/\/#define MARAUDER_V4/' esp32_marauder/configs.h sed -i 's/^ \/\/#define MARAUDER_V6/ #define MARAUDER_V6/' esp32_marauder/configs.h @@ -286,6 +285,7 @@ jobs: - name: Configure TFT_eSPI and configs.h for Marauder v6.1 run: | + sed -i 's/^ #define MARAUDER_REV_FEATHER/ \/\/#define MARAUDER_REV_FEATHER/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_MINI/ \/\/#define MARAUDER_MINI/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V4/ \/\/#define MARAUDER_V4/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V6/ \/\/#define MARAUDER_V6/' esp32_marauder/configs.h @@ -311,6 +311,7 @@ jobs: run: | sed -i 's/^#include /\/\/#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h sed -i 's/^\/\/#include /#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h + sed -i 's/^ #define MARAUDER_REV_FEATHER/ \/\/#define MARAUDER_REV_FEATHER/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_MINI/ \/\/#define MARAUDER_MINI/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V4/ \/\/#define MARAUDER_V4/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V6/ \/\/#define MARAUDER_V6/' esp32_marauder/configs.h @@ -336,6 +337,7 @@ jobs: run: | sed -i 's/^\/\/#include /#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h sed -i 's/^#include /\/\/#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h + sed -i 's/^ #define MARAUDER_REV_FEATHER/ \/\/#define MARAUDER_REV_FEATHER/' esp32_marauder/configs.h sed -i 's/^ \/\/#define MARAUDER_MINI/ #define MARAUDER_MINI/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V4/ \/\/#define MARAUDER_V4/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V6/ \/\/#define MARAUDER_V6/' esp32_marauder/configs.h @@ -359,6 +361,7 @@ jobs: - name: Configure TFT_eSPI and configs.h for ESP32 LDDB run: | + sed -i 's/^ #define MARAUDER_REV_FEATHER/ \/\/#define MARAUDER_REV_FEATHER/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_MINI/ \/\/#define MARAUDER_MINI/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V4/ \/\/#define MARAUDER_V4/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V6/ \/\/#define MARAUDER_V6/' esp32_marauder/configs.h @@ -382,6 +385,7 @@ jobs: - name: Configure TFT_eSPI and configs.h for Marauder Dev Board Pro run: | + sed -i 's/^ #define MARAUDER_REV_FEATHER/ \/\/#define MARAUDER_REV_FEATHER/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_MINI/ \/\/#define MARAUDER_MINI/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V4/ \/\/#define MARAUDER_V4/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V6/ \/\/#define MARAUDER_V6/' esp32_marauder/configs.h @@ -409,6 +413,7 @@ jobs: find /home/runner/ -name "*TFT_eSPI*" sed -i 's/^#include /\/\/#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h sed -i 's/^\/\/#include /#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h + sed -i 's/^ #define MARAUDER_REV_FEATHER/ \/\/#define MARAUDER_REV_FEATHER/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_MINI/ \/\/#define MARAUDER_MINI/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V4/ \/\/#define MARAUDER_V4/' esp32_marauder/configs.h sed -i 's/^ #define MARAUDER_V6/ \/\/#define MARAUDER_V6/' esp32_marauder/configs.h @@ -430,6 +435,36 @@ jobs: - name: Rename Marauder M5StickC bin run: | mv ./esp32_marauder/build/esp32.esp32.m5stick-c/esp32_marauder.ino.bin ./esp32_marauder/build/esp32.esp32.m5stick-c/esp32_marauder.m5stickc_plus.bin + + - name: Configure TFT_eSPI and configs.h for Marauder Rev Feather + run: | + pwd + find /home/runner/ -name "*TFT_eSPI*" + sed -i 's/^\/\/#include /#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h + sed -i 's/^#include /\/\/#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h + sed -i 's/^#include /\/\/#include /' /home/runner/Arduino/libraries/CustomTFT_eSPI/User_Setup_Select.h + sed -i 's/^ \/\/#define MARAUDER_REV_FEATHER/ #define MARAUDER_REV_FEATHER/' esp32_marauder/configs.h + sed -i 's/^ #define MARAUDER_MINI/ \/\/#define MARAUDER_MINI/' esp32_marauder/configs.h + sed -i 's/^ #define MARAUDER_V4/ \/\/#define MARAUDER_V4/' esp32_marauder/configs.h + sed -i 's/^ #define MARAUDER_V6/ \/\/#define MARAUDER_V6/' esp32_marauder/configs.h + sed -i 's/^ #define MARAUDER_V6_1/ \/\/#define MARAUDER_V6_1/' esp32_marauder/configs.h + sed -i 's/^ #define MARAUDER_KIT/ \/\/#define MARAUDER_KIT/' esp32_marauder/configs.h + sed -i 's/^ #define GENERIC_ESP32/ \/\/#define GENERIC_ESP32/' esp32_marauder/configs.h + sed -i 's/^ #define MARAUDER_FLIPPER/ \/\/#define MARAUDER_FLIPPER/' esp32_marauder/configs.h + sed -i 's/^ #define ESP32_LDDB/ \/\/#define ESP32_LDDB/' esp32_marauder/configs.h + sed -i 's/^ #define MARAUDER_DEV_BOARD_PRO/ \/\/#define MARAUDER_DEV_BOARD_PRO/' esp32_marauder/configs.h + sed -i 's/^ #define MARAUDER_M5STICKC/ \/\/#define MARAUDER_M5STICKC/' esp32_marauder/configs.h + + - name: Build Marauder for Marauder Rev Feather + uses: ArminJo/arduino-test-compile@v3.2.1 + with: + sketch-names: esp32_marauder.ino + arduino-board-fqbn: esp32:esp32:esp32s2:PartitionScheme=min_spiffs,FlashSize=4M,PSRAM=enabled + extra-arduino-cli-args: "--warnings none" + + - name: Rename Marauder Marauder Rev Feather + run: | + mv ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.ino.bin ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.rev_feather.bin - name: Display finished bins run: | @@ -505,6 +540,13 @@ jobs: path: ./esp32_marauder/build/esp32.esp32.m5stick-c/esp32_marauder.m5stickc_plus.bin retention-days: 5 + - name: 'Upload Rev Feather Artifact' + uses: actions/upload-artifact@v3 + with: + name: esp32_marauder.rev_feather.bin + path: ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.rev_feather.bin + retention-days: 5 + - name: Create Release id: create_release uses: actions/create-release@v1 @@ -636,3 +678,15 @@ jobs: asset_name: esp32_marauder.m5stickc_plus.bin asset_content_type: application/bin if: github.event_name != 'pull_request' + + - name: Upload Rev Feather Asset + id: upload-rev-feather-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.rev_feather.bin + asset_name: esp32_marauder.rev_feather.bin + asset_content_type: application/bin + if: github.event_name != 'pull_request' diff --git a/User_Setup_Select.h b/User_Setup_Select.h index 8b1f49612..82c61d38a 100644 --- a/User_Setup_Select.h +++ b/User_Setup_Select.h @@ -24,6 +24,7 @@ #include //#include //#include +//#include //#include // Setup file configured for my ILI9341 //#include // Setup file configured for my ST7735 diff --git a/User_Setup_marauder_mini.h b/User_Setup_marauder_mini.h index ed58b244b..c7a28107b 100644 --- a/User_Setup_marauder_mini.h +++ b/User_Setup_marauder_mini.h @@ -43,8 +43,8 @@ // For ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display // Try ONE option at a time to find the correct colour order for your display - #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue -// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red +// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue + #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red // For M5Stack ESP32 module with integrated ILI9341 display ONLY, remove // in line below diff --git a/User_Setup_marauder_rev_feather.h b/User_Setup_marauder_rev_feather.h new file mode 100644 index 000000000..95e9dd54b --- /dev/null +++ b/User_Setup_marauder_rev_feather.h @@ -0,0 +1,59 @@ +// ST7789 135 x 240 display with no chip select line + +#define ST7789_DRIVER // Configure all registers + +#define TFT_WIDTH 135 +#define TFT_HEIGHT 240 + +#define CGRAM_OFFSET // Library will add offsets required + +//#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue +//#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red + +//#define TFT_INVERSION_ON +//#define TFT_INVERSION_OFF + +// DSTIKE stepup +//#define TFT_DC 23 +//#define TFT_RST 32 +//#define TFT_MOSI 26 +//#define TFT_SCLK 27 + +// Generic ESP32 setup +//#define TFT_MISO 19 +//#define TFT_MOSI 23 +//#define TFT_SCLK 18 +//#define TFT_CS -1 // Not connected +//#define TFT_DC 2 +//#define TFT_RST 4 // Connect reset to ensure display initialises + +// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation +#define TFT_MISO 37 +#define TFT_MOSI 35 +#define TFT_SCLK 36 +#define TFT_CS 42 // Define as not used +#define TFT_DC 40 // Data Command control pin +#define TFT_RST 41 // TFT reset pin (could connect to NodeMCU RST, see next line) +#define TFT_BL 45 + + +#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH +#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters +#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters +#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm +#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:. +#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. +//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT +#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts + +#define SMOOTH_FONT + + +// #define SPI_FREQUENCY 27000000 +#define SPI_FREQUENCY 40000000 + +#define SPI_READ_FREQUENCY 20000000 + +#define SPI_TOUCH_FREQUENCY 2500000 + +// #define SUPPORT_TRANSACTIONS \ No newline at end of file diff --git a/esp32_marauder/.theia/launch.json b/esp32_marauder/.theia/launch.json new file mode 100644 index 000000000..7e4253b33 --- /dev/null +++ b/esp32_marauder/.theia/launch.json @@ -0,0 +1,8 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + "version": "0.2.0", + "configurations": [ + + ] +} diff --git a/esp32_marauder/Display.cpp b/esp32_marauder/Display.cpp index da835e44c..f150e5c29 100644 --- a/esp32_marauder/Display.cpp +++ b/esp32_marauder/Display.cpp @@ -28,6 +28,10 @@ void Display::RunSetup() tft.setRotation(1); #endif + #ifdef MARAUDER_REV_FEATHER + tft.setRotation(1); + #endif + tft.setCursor(0, 0); #ifdef HAS_ILI9341 @@ -53,6 +57,14 @@ void Display::RunSetup() #ifdef KIT pinMode(KIT_LED_BUILTIN, OUTPUT); #endif + + #ifdef MARAUDER_REV_FEATHER + pinMode(7, OUTPUT); + + delay(10); + + digitalWrite(7, HIGH); + #endif } void Display::drawFrame() diff --git a/esp32_marauder/EvilPortal.cpp b/esp32_marauder/EvilPortal.cpp index b17d0afaf..cd1aa3ade 100644 --- a/esp32_marauder/EvilPortal.cpp +++ b/esp32_marauder/EvilPortal.cpp @@ -92,7 +92,11 @@ bool EvilPortal::setHtml() { return true; } Serial.println("Setting HTML..."); - File html_file = sd_obj.getFile("/" + this->target_html_name); + #ifdef HAS_SD + File html_file = sd_obj.getFile("/" + this->target_html_name); + #else + File html_file; + #endif if (!html_file) { #ifdef HAS_SCREEN this->sendToDisplay("Could not find /" + this->target_html_name); @@ -139,7 +143,11 @@ bool EvilPortal::setAP(LinkedList* ssids, LinkedList* access_ // If there are no SSIDs and there are no APs selected, pull from file // This means the file is last resort if ((ssids->size() <= 0) && (temp_ap_name == "")) { - File ap_config_file = sd_obj.getFile("/ap.config.txt"); + #ifdef HAS_SD + File ap_config_file = sd_obj.getFile("/ap.config.txt"); + #else + File ap_config_file; + #endif // Could not open config file. return false if (!ap_config_file) { #ifdef HAS_SCREEN diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp index 184e1a2fc..d8cabe54d 100644 --- a/esp32_marauder/MenuFunctions.cpp +++ b/esp32_marauder/MenuFunctions.cpp @@ -519,9 +519,6 @@ void MenuFunctions::main(uint32_t currentTime) if ((wifi_scan_obj.currentScanMode != LV_JOIN_WIFI) && (wifi_scan_obj.currentScanMode != LV_ADD_SSID)) this->updateStatusBar(); - //#if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) - // display_obj.updateBanner(current_menu->name); - //#endif } } @@ -931,7 +928,7 @@ void MenuFunctions::updateStatusBar() { display_obj.tft.setTextSize(1); - #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) + #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) display_obj.tft.setFreeFont(NULL); #endif @@ -973,7 +970,7 @@ void MenuFunctions::updateStatusBar() display_obj.tft.drawString("CH: " + (String)wifi_scan_obj.set_channel, 50, 0, 2); #endif - #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) + #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) display_obj.tft.drawString("CH: " + (String)wifi_scan_obj.set_channel, TFT_WIDTH/4, 0, 1); #endif } @@ -987,7 +984,7 @@ void MenuFunctions::updateStatusBar() display_obj.tft.drawString((String)wifi_scan_obj.free_ram + "B", 100, 0, 2); #endif - #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) + #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) display_obj.tft.drawString((String)wifi_scan_obj.free_ram + "B", TFT_WIDTH/1.75, 0, 1); #endif } @@ -1013,22 +1010,24 @@ void MenuFunctions::updateStatusBar() // Draw SD info - if (sd_obj.supported) - the_color = TFT_GREEN; - else - the_color = TFT_RED; + #ifdef HAS_SD + if (sd_obj.supported) + the_color = TFT_GREEN; + else + the_color = TFT_RED; - #ifdef HAS_ILI9341 - display_obj.tft.drawXBitmap(170, - 0, - menu_icons[STATUS_SD], - 16, - 16, - STATUSBAR_COLOR, - the_color); + #ifdef HAS_ILI9341 + display_obj.tft.drawXBitmap(170, + 0, + menu_icons[STATUS_SD], + 16, + 16, + STATUSBAR_COLOR, + the_color); + #endif #endif - #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) + #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) display_obj.tft.setTextColor(the_color, STATUSBAR_COLOR); display_obj.tft.drawString("SD", TFT_WIDTH - 12, 0, 1); #endif @@ -1037,7 +1036,7 @@ void MenuFunctions::updateStatusBar() void MenuFunctions::drawStatusBar() { display_obj.tft.setTextSize(1); - #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) + #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) display_obj.tft.setFreeFont(NULL); #endif display_obj.tft.fillRect(0, 0, 240, STATUS_BAR_WIDTH, STATUSBAR_COLOR); @@ -1078,7 +1077,7 @@ void MenuFunctions::drawStatusBar() display_obj.tft.drawString("CH: " + (String)wifi_scan_obj.set_channel, 50, 0, 2); #endif - #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) + #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) display_obj.tft.drawString("CH: " + (String)wifi_scan_obj.set_channel, TFT_WIDTH/4, 0, 1); #endif @@ -1090,7 +1089,7 @@ void MenuFunctions::drawStatusBar() display_obj.tft.drawString((String)wifi_scan_obj.free_ram + "B", 100, 0, 2); #endif - #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) + #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) display_obj.tft.drawString((String)wifi_scan_obj.free_ram + "B", TFT_WIDTH/1.75, 0, 1); #endif @@ -1114,22 +1113,25 @@ void MenuFunctions::drawStatusBar() #endif // Draw SD info - if (sd_obj.supported) - the_color = TFT_GREEN; - else - the_color = TFT_RED; + #ifdef HAS_SD + if (sd_obj.supported) + the_color = TFT_GREEN; + else + the_color = TFT_RED; + - #ifdef HAS_ILI9341 - display_obj.tft.drawXBitmap(170, - 0, - menu_icons[STATUS_SD], - 16, - 16, - STATUSBAR_COLOR, - the_color); + #ifdef HAS_ILI9341 + display_obj.tft.drawXBitmap(170, + 0, + menu_icons[STATUS_SD], + 16, + 16, + STATUSBAR_COLOR, + the_color); + #endif #endif - #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) + #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) display_obj.tft.setTextColor(the_color, STATUSBAR_COLOR); display_obj.tft.drawString("SD", TFT_WIDTH - 12, 0, 1); #endif @@ -1242,7 +1244,7 @@ void MenuFunctions::RunSetup() // WiFi HTML menu stuff htmlMenu.list = new LinkedList(); - #ifdef MARAUDER_MINI + #if (!defined(HAS_ILI9341) && defined(HAS_BUTTONS)) miniKbMenu.list = new LinkedList(); #endif #ifndef HAS_ILI9341 @@ -1287,7 +1289,7 @@ void MenuFunctions::RunSetup() gpsInfoMenu.name = "GPS Data"; #endif htmlMenu.name = "EP HTML List"; - #ifdef MARAUDER_MINI + #if (!defined(HAS_ILI9341) && defined(HAS_BUTTONS)) miniKbMenu.name = "Mini Keyboard"; #endif #ifndef HAS_ILI9341 @@ -1473,7 +1475,7 @@ void MenuFunctions::RunSetup() addSSIDGFX(); }); #endif - #ifdef MARAUDER_MINI + #if (!defined(HAS_ILI9341) && defined(HAS_BUTTONS)) this->addNodes(&wifiGeneralMenu, text_table1[1], TFT_NAVY, NULL, KEYBOARD_ICO, [this](){ this->changeMenu(&miniKbMenu); this->miniKeyboard(&miniKbMenu); @@ -1514,7 +1516,7 @@ void MenuFunctions::RunSetup() #else // Mini EP HTML select this->addNodes(&wifiGeneralMenu, "Select EP HTML File", TFT_CYAN, NULL, KEYBOARD_ICO, [this](){ this->changeMenu(&htmlMenu); - #ifdef HAS_BUTTONS + #if (defined(HAS_BUTTONS) && defined(HAS_SD)) #if !(defined(MARAUDER_V6) || defined(MARAUDER_V6_1)) while(true) { if (d_btn.justPressed()) { @@ -1553,10 +1555,12 @@ void MenuFunctions::RunSetup() #endif }); - miniKbMenu.parentMenu = &wifiGeneralMenu; - this->addNodes(&miniKbMenu, "a", TFT_CYAN, NULL, 0, [this]() { - this->changeMenu(miniKbMenu.parentMenu); - }); + #if (!defined(HAS_ILI9341) && defined(HAS_BUTTONS)) + miniKbMenu.parentMenu = &wifiGeneralMenu; + this->addNodes(&miniKbMenu, "a", TFT_CYAN, NULL, 0, [this]() { + this->changeMenu(miniKbMenu.parentMenu); + }); + #endif htmlMenu.parentMenu = &wifiGeneralMenu; this->addNodes(&htmlMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() { @@ -1858,21 +1862,23 @@ void MenuFunctions::RunSetup() wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF; this->changeMenu(whichUpdateMenu.parentMenu); }); - if (sd_obj.supported) addNodes(&whichUpdateMenu, text_table1[40], TFT_MAGENTA, NULL, SD_UPDATE, [this]() { - wifi_scan_obj.currentScanMode = OTA_UPDATE; - this->changeMenu(&confirmMenu); - }); + #ifdef HAS_SD + if (sd_obj.supported) addNodes(&whichUpdateMenu, text_table1[40], TFT_MAGENTA, NULL, SD_UPDATE, [this]() { + wifi_scan_obj.currentScanMode = OTA_UPDATE; + this->changeMenu(&confirmMenu); + }); - // Confirm SD update menu - confirmMenu.parentMenu = &whichUpdateMenu; - this->addNodes(&confirmMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() { - this->changeMenu(confirmMenu.parentMenu); - }); - this->addNodes(&confirmMenu, text14, TFT_ORANGE, NULL, UPDATE, [this]() { - wifi_scan_obj.currentScanMode = OTA_UPDATE; - this->changeMenu(&failedUpdateMenu); - sd_obj.runUpdate(); - }); + // Confirm SD update menu + confirmMenu.parentMenu = &whichUpdateMenu; + this->addNodes(&confirmMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() { + this->changeMenu(confirmMenu.parentMenu); + }); + this->addNodes(&confirmMenu, text14, TFT_ORANGE, NULL, UPDATE, [this]() { + wifi_scan_obj.currentScanMode = OTA_UPDATE; + this->changeMenu(&failedUpdateMenu); + sd_obj.runUpdate(); + }); + #endif // Web Update updateMenu.parentMenu = &deviceMenu; @@ -1902,7 +1908,7 @@ void MenuFunctions::RunSetup() this->initTime = millis(); } -#ifdef MARAUDER_MINI +#if (!defined(HAS_ILI9341) && defined(HAS_BUTTONS)) void MenuFunctions::miniKeyboard(Menu * targetMenu) { // Prepare a char array and reset temp SSID string extern LinkedList* ssids; @@ -1926,8 +1932,8 @@ void MenuFunctions::RunSetup() #ifdef HAS_BUTTONS #if !(defined(MARAUDER_V6) || defined(MARAUDER_V6_1)) while(true) { - #ifndef MARAUDER_M5STICKC - // Cycle char previous + // Cycle char previous + #ifdef HAS_L if (l_btn.justPressed()) { pressed = true; if (this->mini_kb_index > 0) @@ -1937,19 +1943,40 @@ void MenuFunctions::RunSetup() targetMenu->list->set(0, MenuNode{String(char_array[this->mini_kb_index]).c_str(), false, TFT_CYAN, 0, NULL, true, NULL}); this->buildButtons(targetMenu); - //this->displayCurrentMenu(); + while (!l_btn.justReleased()) + delay(1); + } + #endif + + // Cycle char next + #ifdef HAS_R + if (r_btn.justPressed()) { + pressed = true; + if (this->mini_kb_index < str_len - 2) + this->mini_kb_index++; + else + this->mini_kb_index = 0; + targetMenu->list->set(0, MenuNode{String(char_array[this->mini_kb_index]).c_str(), false, TFT_CYAN, 0, NULL, true, NULL}); + this->buildButtons(targetMenu, 0, String(char_array[this->mini_kb_index]).c_str()); + while (!r_btn.justReleased()) + delay(1); } + #endif - // Add character + //// 5-WAY SWITCH STUFF + // Add character + #if (defined(HAS_D) && defined(HAS_R)) if (d_btn.justPressed()) { pressed = true; wifi_scan_obj.current_mini_kb_ssid.concat(String(char_array[this->mini_kb_index]).c_str()); while (!d_btn.justReleased()) delay(1); } + #endif - // Remove character + // Remove character + #if (defined(HAS_U) && defined(HAS_L)) if (u_btn.justPressed()) { pressed = true; wifi_scan_obj.current_mini_kb_ssid.remove(wifi_scan_obj.current_mini_kb_ssid.length() - 1); @@ -1958,39 +1985,83 @@ void MenuFunctions::RunSetup() } #endif - // Cycle char next - if (r_btn.justPressed()) { - pressed = true; - if (this->mini_kb_index < str_len - 2) - this->mini_kb_index++; - else - this->mini_kb_index = 0; - - targetMenu->list->set(0, MenuNode{String(char_array[this->mini_kb_index]).c_str(), false, TFT_CYAN, 0, NULL, true, NULL}); - this->buildButtons(targetMenu, 0, String(char_array[this->mini_kb_index]).c_str()); - //this->displayCurrentMenu(); - } + //// PARTIAL SWITCH STUFF + // Advance char or add char + #if (defined(HAS_D) && !defined(HAS_R)) + if (d_btn.justPressed()) { + bool was_held = false; + pressed = true; + while(!d_btn.justReleased()) { + d_btn.justPressed(); + + // Add letter to string + if (d_btn.isHeld()) { + wifi_scan_obj.current_mini_kb_ssid.concat(String(char_array[this->mini_kb_index]).c_str()); + was_held = true; + break; + } + } + if (!was_held) { + if (this->mini_kb_index < str_len - 2) + this->mini_kb_index++; + else + this->mini_kb_index = 0; - // Add SSID - if (c_btn.justPressed()) { - while (!c_btn.justReleased()) { - c_btn.justPressed(); // Need to continue updating button hold status. My shitty library. - - // Exit - if (c_btn.isHeld()) { - this->changeMenu(targetMenu->parentMenu); - return; + targetMenu->list->set(0, MenuNode{String(char_array[this->mini_kb_index]).c_str(), false, TFT_CYAN, 0, NULL, true, NULL}); + this->buildButtons(targetMenu, 0, String(char_array[this->mini_kb_index]).c_str()); } - delay(1); } - // If we have a string, add it to list of SSIDs - if (wifi_scan_obj.current_mini_kb_ssid != "") { + #endif + + // Prev char or remove char + #if (defined(HAS_U) && !defined(HAS_L)) + if (u_btn.justPressed()) { + bool was_held = false; pressed = true; - ssid s = {wifi_scan_obj.current_mini_kb_ssid, random(1, 12), {random(256), random(256), random(256), random(256), random(256), random(256)}, false}; - ssids->unshift(s); - wifi_scan_obj.current_mini_kb_ssid = ""; + while(!u_btn.justReleased()) { + u_btn.justPressed(); + + // Remove letter from string + if (u_btn.isHeld()) { + wifi_scan_obj.current_mini_kb_ssid.remove(wifi_scan_obj.current_mini_kb_ssid.length() - 1); + was_held = true; + break; + } + } + if (!was_held) { + if (this->mini_kb_index > 0) + this->mini_kb_index--; + else + this->mini_kb_index = str_len - 2; + + targetMenu->list->set(0, MenuNode{String(char_array[this->mini_kb_index]).c_str(), false, TFT_CYAN, 0, NULL, true, NULL}); + this->buildButtons(targetMenu); + } } - } + #endif + + // Add SSID + #ifdef HAS_C + if (c_btn.justPressed()) { + while (!c_btn.justReleased()) { + c_btn.justPressed(); // Need to continue updating button hold status. My shitty library. + + // Exit + if (c_btn.isHeld()) { + this->changeMenu(targetMenu->parentMenu); + return; + } + delay(1); + } + // If we have a string, add it to list of SSIDs + if (wifi_scan_obj.current_mini_kb_ssid != "") { + pressed = true; + ssid s = {wifi_scan_obj.current_mini_kb_ssid, random(1, 12), {random(256), random(256), random(256), random(256), random(256), random(256)}, false}; + ssids->unshift(s); + wifi_scan_obj.current_mini_kb_ssid = ""; + } + } + #endif // Display info on screen if (pressed) { @@ -2006,10 +2077,8 @@ void MenuFunctions::RunSetup() display_obj.tft.println(ssids->get(0).essid); display_obj.tft.setTextColor(TFT_ORANGE, TFT_BLACK); - display_obj.tft.println("U - Remove Char"); - display_obj.tft.println("D - Add Char"); - display_obj.tft.println("L - Previous Char"); - display_obj.tft.println("R - Next Char"); + display_obj.tft.println("U/D - Rem/Add Char"); + display_obj.tft.println("L/R - Prev/Nxt Char"); display_obj.tft.println("C - Save"); display_obj.tft.println("C(Hold) - Exit"); pressed = false; @@ -2086,7 +2155,6 @@ void MenuFunctions::buildButtons(Menu * menu, int starting_index, String button_ } } - void MenuFunctions::displayCurrentMenu(uint8_t start_index) { //Serial.println(F("Displaying current menu...")); @@ -2101,7 +2169,7 @@ void MenuFunctions::displayCurrentMenu(uint8_t start_index) display_obj.tft.setFreeFont(MENU_FONT); #endif - #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) + #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) display_obj.tft.setFreeFont(NULL); display_obj.tft.setTextSize(1); #endif @@ -2124,7 +2192,7 @@ void MenuFunctions::displayCurrentMenu(uint8_t start_index) #endif - #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) + #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) if ((current_menu->selected == i) || (current_menu->list->get(i).selected)) display_obj.key[i - start_index].drawButton(true, current_menu->list->get(i).name); else diff --git a/esp32_marauder/MenuFunctions.h b/esp32_marauder/MenuFunctions.h index 6df91523b..081a7e4d6 100644 --- a/esp32_marauder/MenuFunctions.h +++ b/esp32_marauder/MenuFunctions.h @@ -15,12 +15,12 @@ #include "settings.h" #ifdef HAS_BUTTONS - #include - extern SwitchLib u_btn; - extern SwitchLib d_btn; - extern SwitchLib l_btn; - extern SwitchLib r_btn; - extern SwitchLib c_btn; + #include "Switches.h" + extern Switches u_btn; + extern Switches d_btn; + extern Switches l_btn; + extern Switches r_btn; + extern Switches c_btn; #endif extern WiFiScan wifi_scan_obj; @@ -174,7 +174,7 @@ class MenuFunctions void displaySetting(String key, Menu* menu, int index); void buttonSelected(uint8_t b, int8_t x = -1); void buttonNotSelected(uint8_t b, int8_t x = -1); - #ifdef MARAUDER_MINI + #if (!defined(HAS_ILI9341) && defined(HAS_BUTTONS)) void miniKeyboard(Menu * targetMenu); #endif diff --git a/esp32_marauder/Switches.cpp b/esp32_marauder/Switches.cpp new file mode 100644 index 000000000..b0c68dd0b --- /dev/null +++ b/esp32_marauder/Switches.cpp @@ -0,0 +1,98 @@ +#include "Switches.h" + +Switches::Switches() { + this->pin = 0; + this->pin = false; + this->pressed = false; + this->hold_lim = 2000; + this->cur_hold = 0; + this->isheld = false; + + pinMode(this->pin, INPUT); + + return; +} + +Switches::Switches(int pin, uint32_t hold_lim, bool pullup) { + this->pin = pin; + this->pullup = pullup; + this->pressed = false; + this->hold_lim = hold_lim; + this->cur_hold = 0; + this->isheld = false; + + if (pullup) + pinMode(this->pin, INPUT_PULLUP); + else + pinMode(this->pin, INPUT_PULLDOWN); + + return; +} + +int Switches::getPin() { + return this->pin; +} + +bool Switches::getPullup() { + return this->pullup; +} + +bool Switches::isHeld() { + return this->isheld; +} + +bool Switches::getButtonState() { + int buttonState = digitalRead(this->pin); + + if ((this->pullup) && (buttonState == LOW)) + return true; + else if ((!this->pullup) && (buttonState == HIGH)) + return true; + else + return false; +} + +bool Switches::justPressed() { + bool btn_state = this->getButtonState(); + + // Button was JUST pressed + if (btn_state && !this->pressed) { + this->hold_init = millis(); + this->pressed = btn_state; + return true; + } + else if (btn_state) { // Button is STILL pressed + // Check if button is held + //Serial.println("cur_hold: " + (String)this->cur_hold); + if ((millis() - this->hold_init) < this->hold_lim) { + this->isheld = false; + } + else { + this->isheld = true; + } + + this->pressed = btn_state; + return false; + } + else { // Button is not pressed + this->pressed = btn_state; + this->isheld = false; + return false; + } +} + +bool Switches::justReleased() { + bool btn_state = this->getButtonState(); + + // Button was JUST released + if (!btn_state && this->pressed) { + this->isheld = false; + this->pressed = btn_state; + return true; + } + else { // Button is STILL released + this->pressed = btn_state; + return false; + } + +} \ No newline at end of file diff --git a/esp32_marauder/Switches.h b/esp32_marauder/Switches.h new file mode 100644 index 000000000..8955709e6 --- /dev/null +++ b/esp32_marauder/Switches.h @@ -0,0 +1,35 @@ +#ifndef Switches_h +#define Switches_h + +#include + +class Switches { + private: + int pin; + uint32_t hold_lim; + uint32_t cur_hold; + + uint32_t hold_init = millis(); + + bool isheld; + + bool pullup; + + bool pressed; + + bool getButtonState(); + + public: + Switches(); + + Switches(int pin, uint32_t hold_lim, bool pullup); + + int getPin(); + bool getPullup(); + + bool justPressed(); + bool justReleased(); + bool isHeld(); +}; + +#endif \ No newline at end of file diff --git a/esp32_marauder/WiFiScan.cpp b/esp32_marauder/WiFiScan.cpp index 01f4831bf..01f024d94 100644 --- a/esp32_marauder/WiFiScan.cpp +++ b/esp32_marauder/WiFiScan.cpp @@ -1058,7 +1058,9 @@ void WiFiScan::RunAPScan(uint8_t scan_mode, uint16_t color) uint16_t calData[5] = { 213, 3469, 320, 3446, 1 }; // Landscape TFT DIY Serial.println("Using TFT DIY"); #endif - display_obj.tft.setTouch(calData); + #ifdef HAS_ILI9341 + display_obj.tft.setTouch(calData); + #endif lv_obj_t * scr = lv_cont_create(NULL, NULL); @@ -4035,7 +4037,9 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t uint16_t t_x = 0, t_y = 0; // To store the touch coordinates // Do the touch stuff - pressed = display_obj.tft.getTouch(&t_x, &t_y); + #ifdef HAS_ILI9341 + pressed = display_obj.tft.getTouch(&t_x, &t_y); + #endif if (pressed) { Serial.print("Got touch | X: "); @@ -4186,7 +4190,9 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t uint16_t t_x = 0, t_y = 0; // To store the touch coordinates // Do the touch stuff - pressed = display_obj.tft.getTouch(&t_x, &t_y); + #ifdef HAS_ILI9341 + pressed = display_obj.tft.getTouch(&t_x, &t_y); + #endif if (pressed) { Serial.print("Got touch | X: "); diff --git a/esp32_marauder/configs.h b/esp32_marauder/configs.h index 258aacba4..f54f00097 100644 --- a/esp32_marauder/configs.h +++ b/esp32_marauder/configs.h @@ -8,7 +8,7 @@ //// BOARD TARGETS //#define MARAUDER_M5STICKC - #define MARAUDER_MINI + //#define MARAUDER_MINI //#define MARAUDER_V4 //#define MARAUDER_V6 //#define MARAUDER_V6_1 @@ -18,6 +18,7 @@ //#define ESP32_LDDB //#define MARAUDER_DEV_BOARD_PRO //#define XIAO_ESP32_S3 + #define MARAUDER_REV_FEATHER //// END BOARD TARGETS #define MARAUDER_VERSION "v0.13.9" @@ -27,6 +28,8 @@ #define HARDWARE_NAME "M5Stick-C Plus" #elif defined(MARAUDER_MINI) #define HARDWARE_NAME "Marauder Mini" + #elif defined(MARAUDER_REV_FEATHER) + #define HARDWARE_NAME "Adafruit Feather ESP32-S2 Reverse TFT" #elif defined(MARAUDER_V4) #define HARDWARE_NAME "Marauder v4" #elif defined(MARAUDER_V6) @@ -78,6 +81,20 @@ #define HAS_GPS #endif + #ifdef MARAUDER_REV_FEATHER + //#define FLIPPER_ZERO_HAT + //#define HAS_BATTERY + //#define HAS_BT + #define HAS_BUTTONS + #define HAS_NEOPIXEL_LED + //#define HAS_PWR_MGMT + #define HAS_SCREEN + #define HAS_SD + #define USE_SD + #define HAS_TEMP_SENSOR + //#define HAS_GPS + #endif + #ifdef MARAUDER_V4 //#define FLIPPER_ZERO_HAT #define HAS_BATTERY @@ -201,12 +218,44 @@ //// BUTTON DEFINITIONS #ifdef HAS_BUTTONS + #ifdef MARAUDER_REV_FEATHER + #define L_BTN -1 + #define C_BTN 1 + #define U_BTN 0 + #define R_BTN -1 + #define D_BTN 2 + + //#define HAS_L + //#define HAS_R + #define HAS_U + #define HAS_D + #define HAS_C + + #define L_PULL true + #define C_PULL false + #define U_PULL true + #define R_PULL true + #define D_PULL false + #endif + #ifdef MARAUDER_MINI #define L_BTN 13 #define C_BTN 34 #define U_BTN 36 #define R_BTN 39 #define D_BTN 35 + + #define HAS_L + #define HAS_R + #define HAS_U + #define HAS_D + #define HAS_C + + #define L_PULL true + #define C_PULL true + #define U_PULL true + #define R_PULL true + #define D_PULL true #endif #ifdef MARAUDER_M5STICKC @@ -215,6 +264,18 @@ #define U_BTN -1 #define R_BTN -1 #define D_BTN 39 + + //#define HAS_L + //#define HAS_R + //#define HAS_U + #define HAS_D + #define HAS_C + + #define L_PULL true + #define C_PULL true + #define U_PULL true + #define R_PULL true + #define D_PULL true #endif #ifdef MARAUDER_V6 @@ -223,6 +284,18 @@ #define U_BTN -1 #define R_BTN -1 #define D_BTN -1 + + //#define HAS_L + //#define HAS_R + //#define HAS_U + //#define HAS_D + #define HAS_C + + #define L_PULL true + #define C_PULL true + #define U_PULL true + #define R_PULL true + #define D_PULL true #endif #ifdef MARAUDER_V6_1 @@ -231,6 +304,18 @@ #define U_BTN -1 #define R_BTN -1 #define D_BTN -1 + + //#define HAS_L + //#define HAS_R + //#define HAS_U + //#define HAS_D + #define HAS_C + + #define L_PULL true + #define C_PULL true + #define U_PULL true + #define R_PULL true + #define D_PULL true #endif #endif @@ -548,6 +633,73 @@ #define STATUSBAR_COLOR 0x4A49 #endif + #ifdef MARAUDER_REV_FEATHER + #define SCREEN_CHAR_WIDTH 40 + //#define TFT_MISO 37 + //#define TFT_MOSI 35 + //#define TFT_SCLK 36 + #define TFT_CS 42 + #define TFT_DC 40 + #define TFT_RST 41 + #define TFT_BL 45 + //#define TOUCH_CS 21 + #define SD_CS 4 + + #define SCREEN_BUFFER + + #define MAX_SCREEN_BUFFER 9 + + #define BANNER_TEXT_SIZE 1 + + #ifndef TFT_WIDTH + #define TFT_WIDTH 240 + #endif + + #ifndef TFT_HEIGHT + #define TFT_HEIGHT 135 + #endif + + #define CHAR_WIDTH 6 + #define SCREEN_WIDTH TFT_WIDTH // Originally 240 + #define SCREEN_HEIGHT TFT_HEIGHT // Originally 320 + #define HEIGHT_1 TFT_WIDTH + #define WIDTH_1 TFT_WIDTH + #define STANDARD_FONT_CHAR_LIMIT (TFT_WIDTH/6) // number of characters on a single line with normal font + #define TEXT_HEIGHT (TFT_HEIGHT/10) // Height of text to be printed and scrolled + #define BOT_FIXED_AREA 0 // Number of lines in bottom fixed area (lines counted from bottom of screen) + #define TOP_FIXED_AREA 48 // Number of lines in top fixed area (lines counted from top of screen) + #define YMAX TFT_HEIGHT // Bottom of screen area + #define minimum(a,b) (((a) < (b)) ? (a) : (b)) + //#define MENU_FONT NULL + #define MENU_FONT &FreeMono9pt7b // Winner + //#define MENU_FONT &FreeMonoBold9pt7b + //#define MENU_FONT &FreeSans9pt7b + //#define MENU_FONT &FreeSansBold9pt7b + #define BUTTON_SCREEN_LIMIT 5 + #define BUTTON_ARRAY_LEN 13 + #define STATUS_BAR_WIDTH (TFT_HEIGHT/16) + #define LVGL_TICK_PERIOD 6 + + #define FRAME_X 100 + #define FRAME_Y 64 + #define FRAME_W 120 + #define FRAME_H 50 + + // Red zone size + #define REDBUTTON_X FRAME_X + #define REDBUTTON_Y FRAME_Y + #define REDBUTTON_W (FRAME_W/2) + #define REDBUTTON_H FRAME_H + + // Green zone size + #define GREENBUTTON_X (REDBUTTON_X + REDBUTTON_W) + #define GREENBUTTON_Y FRAME_Y + #define GREENBUTTON_W (FRAME_W/2) + #define GREENBUTTON_H FRAME_H + + #define STATUSBAR_COLOR 0x4A49 + #endif + #endif //// END DISPLAY DEFINITIONS @@ -627,6 +779,24 @@ #define BUTTON_PADDING 10 #endif + #ifdef MARAUDER_REV_FEATHER + #define BANNER_TIME 50 + + #define COMMAND_PREFIX "!" + + // Keypad start position, key sizes and spacing + #define KEY_X (TFT_WIDTH/2) // Centre of key + #define KEY_Y (TFT_HEIGHT/4.5) + #define KEY_W TFT_WIDTH // Width and height + #define KEY_H (TFT_HEIGHT/12.8) + #define KEY_SPACING_X 0 // X and Y gap + #define KEY_SPACING_Y 1 + #define KEY_TEXTSIZE 1 // Font size multiplier + #define ICON_W 22 + #define ICON_H 22 + #define BUTTON_PADDING 10 + #endif + #ifdef MARAUDER_M5STICKC #define BANNER_TIME 50 @@ -669,6 +839,10 @@ #define SD_CS 4 #endif + #ifdef MARAUDER_REV_FEATHER + #define SD_CS 5 + #endif + #ifdef MARAUDER_M5STICKC #define SD_CS -1 #endif @@ -724,6 +898,8 @@ #define MEM_LOWER_LIM 20000 #elif defined(MARAUDER_MINI) #define MEM_LOWER_LIM 20000 + #elif defined(MARAUDER_REV_FEATHER) + #define MEM_LOWER_LIM 20000 #elif defined(MARAUDER_V4) #define MEM_LOWER_LIM 20000 #elif defined(MARAUDER_V6) || defined(MARAUDER_V6_1) @@ -750,6 +926,8 @@ #define PIN 17 #elif defined(MARAUDER_DEV_BOARD_PRO) #define PIN 16 + #elif defined(MARAUDER_REV_FEATHER) + #define PIN 33 #else #define PIN 25 #endif @@ -762,6 +940,8 @@ #define MAX_HTML_SIZE 11400 #elif defined(MARAUDER_MINI) #define MAX_HTML_SIZE 11400 + #elif defined(MARAUDER_REV_FEATHER) + #define MAX_HTML_SIZE 11400 #elif defined(MARAUDER_V4) #define MAX_HTML_SIZE 11400 #elif defined(MARAUDER_V6) || defined(MARAUDER_V6_1) @@ -835,6 +1015,8 @@ #define MARAUDER_TITLE_BYTES 13578 #elif defined(MARAUDER_MINI) #define MARAUDER_TITLE_BYTES 13578 + #elif defined(MARAUDER_REV_FEATHER) + #define MARAUDER_TITLE_BYTES 13578 #else #define MARAUDER_TITLE_BYTES 13578 #endif diff --git a/esp32_marauder/esp32_marauder.ino b/esp32_marauder/esp32_marauder.ino index d5ce728ce..9936ccf83 100644 --- a/esp32_marauder/esp32_marauder.ino +++ b/esp32_marauder/esp32_marauder.ino @@ -41,7 +41,7 @@ https://www.online-utility.org/image/convert/to/XBM #include "xiaoLED.h" #elif defined(MARAUDER_M5STICKC) #include "stickcLED.h" -#else +#elif defined(HAS_NEOPIXEL_LED) #include "LedInterface.h" #endif @@ -65,22 +65,22 @@ https://www.online-utility.org/image/convert/to/XBM #endif #ifdef HAS_BUTTONS - #include + #include "Switches.h" #if (U_BTN >= 0) - SwitchLib u_btn = SwitchLib(U_BTN, 1000, true); + Switches u_btn = Switches(U_BTN, 1000, U_PULL); #endif #if (D_BTN >= 0) - SwitchLib d_btn = SwitchLib(D_BTN, 1000, true); + Switches d_btn = Switches(D_BTN, 1000, D_PULL); #endif #if (L_BTN >= 0) - SwitchLib l_btn = SwitchLib(L_BTN, 1000, true); + Switches l_btn = Switches(L_BTN, 1000, L_PULL); #endif #if (R_BTN >= 0) - SwitchLib r_btn = SwitchLib(R_BTN, 1000, true); + Switches r_btn = Switches(R_BTN, 1000, R_PULL); #endif #if (C_BTN >= 0) - SwitchLib c_btn = SwitchLib(C_BTN, 1000, true); + Switches c_btn = Switches(C_BTN, 1000, C_PULL); #endif #endif From cfb582c847d625086f0b0192afbd7e833f940aae Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Fri, 23 Feb 2024 00:03:52 -0500 Subject: [PATCH 3/8] Fix TFT_eSPI tag name --- .github/workflows/build_push.yml | 2 +- esp32_marauder/configs.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml index c39d0a71d..867149351 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/build_push.yml @@ -61,7 +61,7 @@ jobs: uses: actions/checkout@v2 with: repository: Bodmer/TFT_eSPI - ref: 2.5.34 + ref: V2.5.34 path: CustomTFT_eSPI - name: Install lv_arduino diff --git a/esp32_marauder/configs.h b/esp32_marauder/configs.h index f54f00097..7357edfbd 100644 --- a/esp32_marauder/configs.h +++ b/esp32_marauder/configs.h @@ -92,7 +92,7 @@ #define HAS_SD #define USE_SD #define HAS_TEMP_SENSOR - //#define HAS_GPS + #define HAS_GPS #endif #ifdef MARAUDER_V4 @@ -1000,6 +1000,11 @@ #define GPS_TX 33 #define GPS_RX 32 #define mac_history_len 512 + #elif defined(MARAUDER_REV_FEATHER) + #define GPS_SERIAL_INDEX 1 + #define GPS_TX 6 + #define GPS_RX 9 + #define mac_history_len 512 #endif #else #define mac_history_len 512 From 2cf39700ee8ba62f727a368ba3235b6203a557ba Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Sat, 24 Feb 2024 19:41:06 -0500 Subject: [PATCH 4/8] Fix num sats on status bar --- esp32_marauder/GpsInterface.cpp | 10 +++--- esp32_marauder/GpsInterface.h | 1 + esp32_marauder/MenuFunctions.cpp | 14 +++++++-- esp32_marauder/MenuFunctions.h | 1 + esp32_marauder/configs.h | 4 +-- esp32_marauder/esp32_marauder.ino | 52 ------------------------------- 6 files changed, 19 insertions(+), 63 deletions(-) diff --git a/esp32_marauder/GpsInterface.cpp b/esp32_marauder/GpsInterface.cpp index 24c5c04a0..370c37f62 100644 --- a/esp32_marauder/GpsInterface.cpp +++ b/esp32_marauder/GpsInterface.cpp @@ -34,10 +34,6 @@ void GpsInterface::begin() { delay(3900); - MicroNMEA::sendSentence(Serial2, "$PSTMFORCESTANDBY,00006"); - - delay(100); - if (Serial2.available()) { Serial.println("GPS Attached Successfully"); this->gps_enabled = true; @@ -46,10 +42,8 @@ void GpsInterface::begin() { char c = Serial2.read(); //Serial.print(c); //Pass the character to the library - Serial.print(c); nmea.process(c); } - Serial.println(nmea.getSentence()); } else { this->gps_enabled = false; @@ -536,6 +530,10 @@ String GpsInterface::getNumSatsString() { return (String)num_sats; } +int GpsInterface::getNumSats() { + return num_sats; +} + bool GpsInterface::getFixStatus() { return this->good_fix; } diff --git a/esp32_marauder/GpsInterface.h b/esp32_marauder/GpsInterface.h index 5094d177a..27640ce8f 100644 --- a/esp32_marauder/GpsInterface.h +++ b/esp32_marauder/GpsInterface.h @@ -39,6 +39,7 @@ class GpsInterface { void begin(); void main(); + int getNumSats(); String getNumSatsString(); bool getFixStatus(); String getFixStatusAsString(); diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp index d8cabe54d..480f8d1e0 100644 --- a/esp32_marauder/MenuFunctions.cpp +++ b/esp32_marauder/MenuFunctions.cpp @@ -934,6 +934,11 @@ void MenuFunctions::updateStatusBar() uint16_t the_color; + if (this->old_gps_sat_count != gps_obj.getNumSats()) { + this->old_gps_sat_count = gps_obj.getNumSats(); + display_obj.tft.fillRect(0, 0, 240, STATUS_BAR_WIDTH, STATUSBAR_COLOR); + } + // GPS Stuff #ifdef HAS_GPS if (gps_obj.getGpsModuleStatus()) { @@ -1292,8 +1297,10 @@ void MenuFunctions::RunSetup() #if (!defined(HAS_ILI9341) && defined(HAS_BUTTONS)) miniKbMenu.name = "Mini Keyboard"; #endif - #ifndef HAS_ILI9341 - sdDeleteMenu.name = "Delete SD Files"; + #ifdef HAS_SD + #ifndef HAS_ILI9341 + sdDeleteMenu.name = "Delete SD Files"; + #endif #endif // Build Main Menu @@ -1719,6 +1726,7 @@ void MenuFunctions::RunSetup() this->addNodes(&deviceMenu, text08, TFT_NAVY, NULL, KEYBOARD_ICO, [this]() { this->changeMenu(&settingsMenu); }); + #ifdef HAS_SD if (sd_obj.supported) { this->addNodes(&deviceMenu, "Delete SD Files", TFT_CYAN, NULL, SD_UPDATE, [this]() { @@ -1800,7 +1808,7 @@ void MenuFunctions::RunSetup() #endif #ifdef HAS_SD - #ifndef ILI9341 + #ifndef HAS_ILI9341 #ifdef HAS_BUTTONS sdDeleteMenu.parentMenu = &deviceMenu; this->addNodes(&sdDeleteMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() { diff --git a/esp32_marauder/MenuFunctions.h b/esp32_marauder/MenuFunctions.h index 081a7e4d6..489797614 100644 --- a/esp32_marauder/MenuFunctions.h +++ b/esp32_marauder/MenuFunctions.h @@ -122,6 +122,7 @@ class MenuFunctions uint32_t initTime = 0; uint8_t menu_start_index = 0; uint8_t mini_kb_index = 0; + uint8_t old_gps_sat_count = 0; // Main menu stuff Menu mainMenu; diff --git a/esp32_marauder/configs.h b/esp32_marauder/configs.h index 7357edfbd..71ac91bdb 100644 --- a/esp32_marauder/configs.h +++ b/esp32_marauder/configs.h @@ -10,7 +10,7 @@ //#define MARAUDER_M5STICKC //#define MARAUDER_MINI //#define MARAUDER_V4 - //#define MARAUDER_V6 + #define MARAUDER_V6 //#define MARAUDER_V6_1 //#define MARAUDER_KIT //#define GENERIC_ESP32 @@ -18,7 +18,7 @@ //#define ESP32_LDDB //#define MARAUDER_DEV_BOARD_PRO //#define XIAO_ESP32_S3 - #define MARAUDER_REV_FEATHER + //#define MARAUDER_REV_FEATHER //// END BOARD TARGETS #define MARAUDER_VERSION "v0.13.9" diff --git a/esp32_marauder/esp32_marauder.ino b/esp32_marauder/esp32_marauder.ino index 9936ccf83..a974e19e9 100644 --- a/esp32_marauder/esp32_marauder.ino +++ b/esp32_marauder/esp32_marauder.ino @@ -13,7 +13,6 @@ https://www.online-utility.org/image/convert/to/XBM #endif #include -//#include "Web.h" #include "EvilPortal.h" #include #include "esp_wifi.h" @@ -45,7 +44,6 @@ https://www.online-utility.org/image/convert/to/XBM #include "LedInterface.h" #endif -//#include "esp_interface.h" #include "settings.h" #include "CommandLine.h" #include "lang_var.h" @@ -54,14 +52,9 @@ https://www.online-utility.org/image/convert/to/XBM #include "BatteryInterface.h" #endif -//#ifdef HAS_TEMP_SENSOR -// #include "TemperatureInterface.h" -//#endif - #ifdef HAS_SCREEN #include "Display.h" #include "MenuFunctions.h" - //#include "a32u4_interface.h" #endif #ifdef HAS_BUTTONS @@ -87,9 +80,7 @@ https://www.online-utility.org/image/convert/to/XBM WiFiScan wifi_scan_obj; EvilPortal evil_portal_obj; -//Web web_obj; Buffer buffer_obj; -//EspInterface esp_obj; Settings settings_obj; CommandLine cli_obj; @@ -101,14 +92,9 @@ CommandLine cli_obj; BatteryInterface battery_obj; #endif -//#ifdef HAS_TEMP_SENSOR -// TemperatureInterface temp_obj; -//#endif - #ifdef HAS_SCREEN Display display_obj; MenuFunctions menu_function_obj; - //A32u4Interface a32u4_obj; #endif #ifdef HAS_SD @@ -169,8 +155,6 @@ void setup() axp192_obj.begin(); #endif - //pinMode(FLASH_BUTTON, INPUT); - #ifdef HAS_SCREEN pinMode(TFT_BL, OUTPUT); #endif @@ -198,16 +182,8 @@ void setup() Serial.begin(115200); - //Serial.println("\n\nHello, World!\n"); - Serial.println("ESP-IDF version is: " + String(esp_get_idf_version())); - //#ifdef HAS_SCREEN - // Serial.println("Has Screen"); - //#else - // Serial.println("Does not have screen"); - //#endif - #ifdef HAS_SCREEN display_obj.RunSetup(); display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK); @@ -225,7 +201,6 @@ void setup() #endif #ifdef HAS_SCREEN - //showCenterText(version_number, 250); #ifndef MARAUDER_MINI display_obj.tft.drawCentreString(display_obj.version_number, 120, 250, 2); #endif @@ -264,20 +239,10 @@ void setup() display_obj.tft.println(text_table0[1]); #endif - //Serial.println("Internal Temp: " + (String)((temprature_sens_read() - 32) / 1.8)); - settings_obj.begin(); - //Serial.println("This is a test Channel: " + (String)settings_obj.loadSetting("Channel")); - //if (settings_obj.loadSetting( "Force PMKID")) - // Serial.println("This is a test Force PMKID: true"); - //else - // Serial.println("This is a test Force PMKID: false"); - wifi_scan_obj.RunSetup(); - //Serial.println(wifi_scan_obj.freeRAM()); - #ifdef HAS_SCREEN display_obj.tft.println(F(text_table0[2])); #endif @@ -309,23 +274,12 @@ void setup() display_obj.tft.println(F(text_table0[5])); #endif - // Temperature stuff - //#ifdef HAS_TEMP_SENSOR - // temp_obj.RunSetup(); - //#endif - #ifdef HAS_SCREEN display_obj.tft.println(F(text_table0[6])); #endif #ifdef HAS_BATTERY battery_obj.battery_level = battery_obj.getBatteryLevel(); - -// if (battery_obj.i2c_supported) { -// Serial.println(F("IP5306 I2C Supported: true")); -// } -// else -// Serial.println(F("IP5306 I2C Supported: false")); #endif // Do some LED stuff @@ -366,12 +320,6 @@ void setup() #ifdef HAS_SCREEN menu_function_obj.RunSetup(); #endif - - //Serial.println(F("\n\n--------------------------------\n")); - //Serial.println(F(" ESP32 Marauder \n")); - //Serial.println(" " + version_number + "\n"); - //Serial.println(F(" By: justcallmekoko\n")); - //Serial.println(F("--------------------------------\n\n")); Serial.println(F("CLI Ready")); cli_obj.RunSetup(); From 4188819965ac80c0c5e5215fec9985ec4850356a Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Sat, 24 Feb 2024 19:59:23 -0500 Subject: [PATCH 5/8] Fix mini and v6 status bar channel refresh --- esp32_marauder/MenuFunctions.cpp | 17 ++++++++++++++--- esp32_marauder/configs.h | 4 ++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp index 480f8d1e0..3e6702d0c 100644 --- a/esp32_marauder/MenuFunctions.cpp +++ b/esp32_marauder/MenuFunctions.cpp @@ -927,6 +927,8 @@ void MenuFunctions::battery2(bool initial) void MenuFunctions::updateStatusBar() { display_obj.tft.setTextSize(1); + + bool status_changed = false; #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) display_obj.tft.setFreeFont(NULL); @@ -937,6 +939,7 @@ void MenuFunctions::updateStatusBar() if (this->old_gps_sat_count != gps_obj.getNumSats()) { this->old_gps_sat_count = gps_obj.getNumSats(); display_obj.tft.fillRect(0, 0, 240, STATUS_BAR_WIDTH, STATUSBAR_COLOR); + status_changed = true; } // GPS Stuff @@ -968,9 +971,13 @@ void MenuFunctions::updateStatusBar() display_obj.tft.setTextColor(TFT_WHITE, STATUSBAR_COLOR); // WiFi Channel Stuff - if (wifi_scan_obj.set_channel != wifi_scan_obj.old_channel) { + if ((wifi_scan_obj.set_channel != wifi_scan_obj.old_channel) || (status_changed)) { wifi_scan_obj.old_channel = wifi_scan_obj.set_channel; - display_obj.tft.fillRect(50, 0, TFT_WIDTH * 0.21, STATUS_BAR_WIDTH, STATUSBAR_COLOR); + #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) + display_obj.tft.fillRect(43, 0, TFT_WIDTH * 0.21, STATUS_BAR_WIDTH, STATUSBAR_COLOR); + #else + display_obj.tft.fillRect(50, 0, TFT_WIDTH * 0.21, STATUS_BAR_WIDTH, STATUSBAR_COLOR); + #endif #ifdef HAS_ILI9341 display_obj.tft.drawString("CH: " + (String)wifi_scan_obj.set_channel, 50, 0, 2); #endif @@ -1077,7 +1084,11 @@ void MenuFunctions::drawStatusBar() // WiFi Channel Stuff wifi_scan_obj.old_channel = wifi_scan_obj.set_channel; - display_obj.tft.fillRect(50, 0, 50, STATUS_BAR_WIDTH, STATUSBAR_COLOR); + #if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC) || defined(MARAUDER_REV_FEATHER) + display_obj.tft.fillRect(43, 0, TFT_WIDTH * 0.21, STATUS_BAR_WIDTH, STATUSBAR_COLOR); + #else + display_obj.tft.fillRect(50, 0, TFT_WIDTH * 0.21, STATUS_BAR_WIDTH, STATUSBAR_COLOR); + #endif #ifdef HAS_ILI9341 display_obj.tft.drawString("CH: " + (String)wifi_scan_obj.set_channel, 50, 0, 2); #endif diff --git a/esp32_marauder/configs.h b/esp32_marauder/configs.h index 71ac91bdb..3b3347262 100644 --- a/esp32_marauder/configs.h +++ b/esp32_marauder/configs.h @@ -8,9 +8,9 @@ //// BOARD TARGETS //#define MARAUDER_M5STICKC - //#define MARAUDER_MINI + #define MARAUDER_MINI //#define MARAUDER_V4 - #define MARAUDER_V6 + //#define MARAUDER_V6 //#define MARAUDER_V6_1 //#define MARAUDER_KIT //#define GENERIC_ESP32 From 4ea3166f1afa2dabee9e748f784792c7ea4f8354 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Sat, 24 Feb 2024 20:13:25 -0500 Subject: [PATCH 6/8] Fix v6 status bar ram refresh --- esp32_marauder/MenuFunctions.cpp | 2 +- esp32_marauder/configs.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp index 3e6702d0c..5a7fd68ba 100644 --- a/esp32_marauder/MenuFunctions.cpp +++ b/esp32_marauder/MenuFunctions.cpp @@ -989,7 +989,7 @@ void MenuFunctions::updateStatusBar() // RAM Stuff wifi_scan_obj.freeRAM(); - if (wifi_scan_obj.free_ram != wifi_scan_obj.old_free_ram) { + if ((wifi_scan_obj.free_ram != wifi_scan_obj.old_free_ram) || (status_changed)) { wifi_scan_obj.old_free_ram = wifi_scan_obj.free_ram; display_obj.tft.fillRect(100, 0, 60, STATUS_BAR_WIDTH, STATUSBAR_COLOR); #ifdef HAS_ILI9341 diff --git a/esp32_marauder/configs.h b/esp32_marauder/configs.h index 3b3347262..71ac91bdb 100644 --- a/esp32_marauder/configs.h +++ b/esp32_marauder/configs.h @@ -8,9 +8,9 @@ //// BOARD TARGETS //#define MARAUDER_M5STICKC - #define MARAUDER_MINI + //#define MARAUDER_MINI //#define MARAUDER_V4 - //#define MARAUDER_V6 + #define MARAUDER_V6 //#define MARAUDER_V6_1 //#define MARAUDER_KIT //#define GENERIC_ESP32 From 194549427a0ba5c45406bd6d5efd681d48860fd2 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Sat, 24 Feb 2024 20:23:32 -0500 Subject: [PATCH 7/8] Fix mini SD update display text --- esp32_marauder/SDInterface.cpp | 2 +- esp32_marauder/configs.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/esp32_marauder/SDInterface.cpp b/esp32_marauder/SDInterface.cpp index 8d36c9a3b..c5a769eb0 100644 --- a/esp32_marauder/SDInterface.cpp +++ b/esp32_marauder/SDInterface.cpp @@ -161,7 +161,7 @@ void SDInterface::runUpdate() { #ifdef HAS_SCREEN display_obj.tft.setTextWrap(false); display_obj.tft.setFreeFont(NULL); - display_obj.tft.setCursor(0, 100); + display_obj.tft.setCursor(0, TFT_HEIGHT / 3); display_obj.tft.setTextSize(1); display_obj.tft.setTextColor(TFT_WHITE); diff --git a/esp32_marauder/configs.h b/esp32_marauder/configs.h index 71ac91bdb..3b3347262 100644 --- a/esp32_marauder/configs.h +++ b/esp32_marauder/configs.h @@ -8,9 +8,9 @@ //// BOARD TARGETS //#define MARAUDER_M5STICKC - //#define MARAUDER_MINI + #define MARAUDER_MINI //#define MARAUDER_V4 - #define MARAUDER_V6 + //#define MARAUDER_V6 //#define MARAUDER_V6_1 //#define MARAUDER_KIT //#define GENERIC_ESP32 From d183894223c68dd2ec70f46533e19584bc500ef6 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Sat, 24 Feb 2024 20:44:12 -0500 Subject: [PATCH 8/8] Increased Mini button list size to 100 This will allow for larger AP lists. Mfers in apartment buildings will still be mad --- esp32_marauder/configs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esp32_marauder/configs.h b/esp32_marauder/configs.h index 3b3347262..22c5b9fe7 100644 --- a/esp32_marauder/configs.h +++ b/esp32_marauder/configs.h @@ -367,7 +367,7 @@ //#define MENU_FONT &FreeSans9pt7b //#define MENU_FONT &FreeSansBold9pt7b #define BUTTON_SCREEN_LIMIT 6 - #define BUTTON_ARRAY_LEN 13 + #define BUTTON_ARRAY_LEN 100 #define STATUS_BAR_WIDTH (TFT_HEIGHT/16) #define LVGL_TICK_PERIOD 6 @@ -609,7 +609,7 @@ //#define MENU_FONT &FreeSans9pt7b //#define MENU_FONT &FreeSansBold9pt7b #define BUTTON_SCREEN_LIMIT 10 - #define BUTTON_ARRAY_LEN 13 + #define BUTTON_ARRAY_LEN 100 #define STATUS_BAR_WIDTH (TFT_HEIGHT/16) #define LVGL_TICK_PERIOD 6 @@ -676,7 +676,7 @@ //#define MENU_FONT &FreeSans9pt7b //#define MENU_FONT &FreeSansBold9pt7b #define BUTTON_SCREEN_LIMIT 5 - #define BUTTON_ARRAY_LEN 13 + #define BUTTON_ARRAY_LEN 100 #define STATUS_BAR_WIDTH (TFT_HEIGHT/16) #define LVGL_TICK_PERIOD 6