From 5f5c520714adc46f6d46047cff175521e251dbc4 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Fri, 17 Jan 2025 11:18:01 +0100 Subject: [PATCH] Make OBP40 compile and add some SD-card code --- lib/obp60task/obp60task.cpp | 24 ++++++++++++++++++++++++ lib/obp60task/platformio.ini | 17 +++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 536e36a..ad2779c 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -13,6 +13,10 @@ #include "OBP60Extensions.h" // Functions lib for extension board #include "OBP60Keypad.h" // Functions for keypad +#include // SD-Card access +#include +#include + // True type character sets includes // See OBP60ExtensionPort.cpp @@ -410,6 +414,26 @@ void OBP60Task(GwApi *api){ doImageRequest(api, &pageNumber, pages, request); }); + // SD-Card: init an check + SPI.begin(SD_SPI_CLK, SD_SPI_MISO, SD_SPI_MOSI, SD_SPI_CS); + if (SD.begin(SDCARD_CS_PIN)) { + String sdtype = "unknown"; + uint8_t cardType = SD.cardType(); + switch (cardType) { + case CARD_MMC: + sdtype = "MMC"; + break; + case CARD_SD: + sdtype = "SDSC"; + break; + case CARD_SDHC: + sdtype = "SDHC"; + break; + } + uint64_t cardSize = SD.cardSize() / (1024 * 1024); + LOG_DEBUG(GwLog::DEBUG,"SD card type %s of size %d MB detected", sdtype, cardSize); + } + //now we have prepared the page data //we start a separate task that will fetch our keys... MyData allParameters; diff --git a/lib/obp60task/platformio.ini b/lib/obp60task/platformio.ini index 4010a82..681a964 100644 --- a/lib/obp60task/platformio.ini +++ b/lib/obp60task/platformio.ini @@ -9,15 +9,16 @@ board_build.variants_dir = variants #board = obp60_s3_n8 #ESP32-S3 N8, 8MB flash, no PSRAM #board = obp60_s3_n16 #ESP32-S3 N16,16MB flash, no PSRAM, zero series #board = obp60_s3_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM -board = obp60_s3_n16r8 #ESP32-S3 N16R8, 16MB flash, 8MB PSRAM, production series -#board = obp60_s3_light_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM, OBP60 clone -#board_build.partitions = default_8MB.csv #ESP32-S3 N8, 8MB flash -board_build.partitions = default_16MB.csv #ESP32-S3 N16, 16MB flash +#board = obp60_s3_n16r8 #ESP32-S3 N16R8, 16MB flash, 8MB PSRAM, production series +board = obp60_s3_light_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM, OBP60 clone +board_build.partitions = default_8MB.csv #ESP32-S3 N8, 8MB flash +#board_build.partitions = default_16MB.csv #ESP32-S3 N16, 16MB flash framework = arduino lib_deps = ${basedeps.lib_deps} Wire SPI + SD esphome/AsyncTCP-esphome@2.0.1 robtillaart/PCF8574@0.3.9 adafruit/Adafruit Unified Sensor @ 1.1.13 @@ -46,16 +47,16 @@ build_flags= -D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib -D BOARD_OBP60S3 #Board OBP60 V2.1 with ESP32S3 # -D HARDWARE_V20 #OBP60 hardware revision V2.0 - -D HARDWARE_V21 #OBP60 hardware revision V2.1 -# -D HARDWARE_LIGHT #OBP60 hardware clone +# -D HARDWARE_V21 #OBP60 hardware revision V2.1 + -D HARDWARE_LIGHT #OBP60 hardware clone # -D DISPLAY_GDEW042T2 #old E-Ink display from Waveshare, R10 0.47 ohm -D DISPLAY_GDEY042T81 #new E-Ink display from Waveshare, R10 2.2 ohm # -D DISPLAY_GYE042A87 #alternativ E-Ink display from Genyo Optical, R10 2.2 ohm # -D DISPLAY_SE0420NQ04 #alternativ E-Ink display from SID Technology, R10 2.2 ohm ${env.build_flags} #CONFIG_ESP_TASK_WDT_TIMEOUT_S = 10 #Task Watchdog timeout period (seconds) [1...60] 5 default -upload_port = /dev/ttyACM0 #OBP60 original -#upload_port = /dev/ttyUSB0 #OBP60 clone +#upload_port = /dev/ttyACM0 #OBP60 original +upload_port = /dev/ttyUSB0 #OBP60 clone upload_protocol = esptool #firmware upload via USB OTG seriell, by first upload need to set the ESP32-S3 in the upload mode with shortcut GND to Pin27 upload_speed = 230400 monitor_speed = 115200