From e4853e105a8320f4e1e87f649f25a517c335379b Mon Sep 17 00:00:00 2001 From: Jelmer Date: Thu, 23 Mar 2023 10:17:31 +0100 Subject: [PATCH] board-based pins --- ESP32_AP-Flasher/include/settings.h | 49 +++++++++++------------------ ESP32_AP-Flasher/platformio.ini | 37 ++++++++++++++++++++-- ESP32_AP-Flasher/src/main.cpp | 8 ++++- 3 files changed, 59 insertions(+), 35 deletions(-) diff --git a/ESP32_AP-Flasher/include/settings.h b/ESP32_AP-Flasher/include/settings.h index 2d2a02ab..df957b57 100644 --- a/ESP32_AP-Flasher/include/settings.h +++ b/ESP32_AP-Flasher/include/settings.h @@ -1,7 +1,7 @@ #include // how long the we should keep the transfer metadata -#define PENDING_TIMEOUT 24*3600 +#define PENDING_TIMEOUT 24 * 3600 // this determines how long images will be cached; #define PENDING_DATA_TIMEOUT 60 // maximum time (in minutes) that a tag is put to sleep if no update is expected. @@ -10,7 +10,7 @@ // flasher options #define CUSTOM_MAC_HDR 0x0000 - +#if (PINOUT == OPENEPAPERLINK_PCB) #define FLASHER_AP_SS 4 #define FLASHER_AP_CLK 5 #define FLASHER_AP_MOSI 7 @@ -41,39 +41,26 @@ #define FLASHER_ALT_TEST 13 #define FLASHER_LED 21 -#define FLASHER_RGB_LED 48 // maybe 38? +#define FLASHER_RGB_LED 48 +#endif - - -/* Lolin32 lite connections to AP tag +#if (PINOUT == SIMPLE_AP) +/* Lolin32 lite connections to AP tag*/ #define RXD1 16 #define TXD1 17 -#define ZBS_SS 5 -#define ZBS_CLK 18 -#define ZBS_MoSi 23 -#define ZBS_MiSo 19 -#define ZBS_Reset 2 -#define ZBS_POWER1 13 -#define ZBS_POWER2 15 +#define FLASHER_AP_SS 5 +#define FLASHER_AP_CLK 18 +#define FLASHER_AP_MOSI 23 +#define FLASHER_AP_MISO 19 +#define FLASHER_AP_RESET 2 +#define FLASHER_AP_POWER 13 +#define FLASHER_AP_POWER2 15 +#define FLASHER_AP_TXD 17 +#define FLASHER_AP_RXD 16 +#define FLASHER_AP_TEST -1 -#define ONBOARD_LED 22 -//*/ - -//* -#define RXD1 13 -#define TXD1 12 - -#define ZBS_SS 21 -#define ZBS_CLK 18 -#define ZBS_MoSi 22 -#define ZBS_MiSo 19 -#define ZBS_Reset 5 -#define ZBS_POWER1 15 -#define ZBS_POWER2 2 - -#define ONBOARD_LED 22 -//*/ +#define FLASHER_LED 22 +#endif #define MAX_WRITE_ATTEMPTS 5 - diff --git a/ESP32_AP-Flasher/platformio.ini b/ESP32_AP-Flasher/platformio.ini index 5e150a2a..8f61e5eb 100644 --- a/ESP32_AP-Flasher/platformio.ini +++ b/ESP32_AP-Flasher/platformio.ini @@ -12,11 +12,11 @@ ; !!! this configuration expects the 16MB Flash / 8MB Ram version of the ESP32-S3-DevkitC1 ; ---------------------------------------------------------------------------------------- -[env:openepaperlink-flasher-ap] +[env:OpenEPaperLink-AP-Flasher] platform = https://github.com/platformio/platform-espressif32.git board = esp32-s3-devkitc-1 framework = arduino -board_build.partitions =default_16MB.csv +board_build.partitions = default_16MB.csv platform_packages = monitor_filters = esp32_exception_decoder monitor_speed = 115200 @@ -30,16 +30,21 @@ lib_deps = https://github.com/Bodmer/TJpg_Decoder.git https://github.com/garretlab/shoddyxml2 https://github.com/Bodmer/U8g2_for_TFT_eSPI + https://github.com/ricmoo/qrcode fastled/FastLED upload_port = COM17 monitor_port = COM17 build_unflags = -D ARDUINO_USB_MODE=1 build_flags = + -D OPENEPAPERLINK_PCB=1 -D ARDUINO_USB_MODE=0 -D CONFIG_ESP32S3_SPIRAM_SUPPORT=1 -D BOARD_HAS_PSRAM -D CONFIG_SPIRAM_USE_MALLOC=y + -D PINOUT=OPENEPAPERLINK_PCB + -D HAS_USB=1 + board_build.flash_mode=qio board_build.arduino.memory_type = qio_opi @@ -47,4 +52,30 @@ board_build.psram_type=qspi_opi board_upload.maximum_size = 16777216 board_upload.maximum_ram_size = 327680 -board_upload.flash_size = 16MB \ No newline at end of file +board_upload.flash_size = 16MB + +[env:Simple_AP] +platform = espressif32 +board = esp32dev +framework = arduino +board_build.partitions = no_ota.csv +platform_packages = +monitor_filters = esp32_exception_decoder +monitor_speed = 115200 +board_build.f_cpu = 240000000L +board_build.filesystem = littlefs +lib_deps = + https://github.com/me-no-dev/ESPAsyncWebServer + https://github.com/tzapu/WiFiManager.git#feature_asyncwebserver + bblanchon/ArduinoJson + bodmer/TFT_eSPI + https://github.com/Bodmer/TJpg_Decoder.git + https://github.com/garretlab/shoddyxml2 + https://github.com/Bodmer/U8g2_for_TFT_eSPI + https://github.com/ricmoo/qrcode +upload_port = COM12 +monitor_port = COM12 + +build_flags = + -D SIMPLE_AP=2 + -D PINOUT=SIMPLE_AP \ No newline at end of file diff --git a/ESP32_AP-Flasher/src/main.cpp b/ESP32_AP-Flasher/src/main.cpp index f53ccc65..fc17bf10 100644 --- a/ESP32_AP-Flasher/src/main.cpp +++ b/ESP32_AP-Flasher/src/main.cpp @@ -11,7 +11,11 @@ #include "serial.h" #include "settings.h" #include "tag_db.h" + +#if (HAS_USB == 1) #include "usbflasher.h" +#endif + #include "web.h" #include "leds.h" @@ -25,7 +29,7 @@ void timeTask(void* parameter) { Serial.println("Waiting for valid time from NTP-server"); } else { if (now % 10 == 0) wsSendSysteminfo(); - if (now % 60 == 3) Ping(); + if (now % 30 == 3) Ping(); if (now % 300 == 6) saveDB("/current/tagDB.json"); contentRunner(); @@ -54,7 +58,9 @@ void setup() { Serial.printf("Total PSRAM: %d", ESP.getPsramSize()); Serial.printf("Free PSRAM: %d", ESP.getFreePsram()); + #if (HAS_USB == 1) xTaskCreate(usbFlasherTask, "flasher", 10000, NULL, configMAX_PRIORITIES - 10, NULL); + #endif configTzTime("CET-1CEST,M3.5.0,M10.5.0/3", "0.nl.pool.ntp.org", "europe.pool.ntp.org", "time.nist.gov"); // https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv