diff --git a/src/FSCommon.h b/src/FSCommon.h index 7710c5b83..c974840fe 100644 --- a/src/FSCommon.h +++ b/src/FSCommon.h @@ -64,4 +64,10 @@ bool fsFormat(); std::vector getFiles(const char *dirname, uint8_t levels, size_t maxCount = 64, bool *wasLimited = nullptr); void listDir(const char *dirname, uint8_t levels, bool del = false); void rmDir(const char *dirname); -void setupSDCard(); \ No newline at end of file +void setupSDCard(); + +#if defined(HAS_SDCARD) && !defined(SDCARD_USE_SOFT_SPI) && defined(SDCARD_USE_SPI1) +#include +// HSPI bus set up by setupSDCard(). Reuse this for other devices on the same bus. +extern SPIClass SPI_HSPI; +#endif \ No newline at end of file diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 28b956bb1..7c8b6ab8e 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -2,6 +2,7 @@ #if defined(USE_EINK) && !defined(USE_EINK_PARALLELDISPLAY) #include "EInkDisplay2.h" +#include "FSCommon.h" #include "SPILock.h" #include "main.h" #include @@ -214,9 +215,23 @@ bool EInkDisplay::connect() defined(CROWPANEL_ESP32S3_5_EPAPER) || defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER) || \ defined(MINI_EPAPER_S3) { +#if defined(TLORA_T3S3_EPAPER) + // T3-S3 shares HSPI with the SD card; preconfigure the panel control pins. + hspi = &SPI_HSPI; + pinMode(PIN_EINK_CS, OUTPUT); + pinMode(PIN_EINK_DC, OUTPUT); + pinMode(PIN_EINK_BUSY, INPUT); + if (PIN_EINK_RES >= 0) { + pinMode(PIN_EINK_RES, OUTPUT); + digitalWrite(PIN_EINK_RES, HIGH); + } + digitalWrite(PIN_EINK_CS, HIGH); + digitalWrite(PIN_EINK_DC, HIGH); +#else // Start HSPI hspi = new SPIClass(HSPI); hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS); // SCLK, MISO, MOSI, SS +#endif // VExt already enabled in setup() // RTC GPIO hold disabled in setup() diff --git a/src/graphics/niche/InkHUD/PlatformioConfig.ini b/src/graphics/niche/InkHUD/PlatformioConfig.ini index 67ad5098f..4c03773b9 100644 --- a/src/graphics/niche/InkHUD/PlatformioConfig.ini +++ b/src/graphics/niche/InkHUD/PlatformioConfig.ini @@ -1,7 +1,22 @@ [inkhud] -build_src_filter = +build_src_filter = +; Include the nicheGraphics directory -build_flags = + - ; BaseUI renderer stack is disabled for InkHUD + - ; InkHUD uses GFX_Root fonts instead of BaseUI font tables + - ; InkHUD drives e-ink through niche drivers + - + - + - + - + - + - + - + - + - + - + - + - +build_flags = -D MESHTASTIC_INCLUDE_NICHE_GRAPHICS ; Use NicheGraphics -D MESHTASTIC_INCLUDE_INKHUD ; Use InkHUD (a NicheGraphics UI) -D MESHTASTIC_EXCLUDE_SCREEN ; Suppress default Screen class diff --git a/variants/esp32s3/tlora_t3s3_epaper/nicheGraphics.h b/variants/esp32s3/tlora_t3s3_epaper/nicheGraphics.h index 73cc2e235..faa9a41b9 100644 --- a/variants/esp32s3/tlora_t3s3_epaper/nicheGraphics.h +++ b/variants/esp32s3/tlora_t3s3_epaper/nicheGraphics.h @@ -1,5 +1,6 @@ #pragma once +#include "FSCommon.h" #include "configuration.h" #ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS @@ -29,9 +30,8 @@ void setupNicheGraphics() // SPI // ----------------------------- - // Display is connected to HSPI - SPIClass *hspi = new SPIClass(HSPI); - hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS); + // Display shares the HSPI bus with the SD card; reuse it rather than re-init the same host. + SPIClass *hspi = &SPI_HSPI; // E-Ink Driver // ----------------------------- diff --git a/variants/esp32s3/tlora_t3s3_epaper/platformio.ini b/variants/esp32s3/tlora_t3s3_epaper/platformio.ini index 8f764bbe6..0830cf303 100644 --- a/variants/esp32s3/tlora_t3s3_epaper/platformio.ini +++ b/variants/esp32s3/tlora_t3s3_epaper/platformio.ini @@ -20,6 +20,8 @@ build_flags = -D TLORA_T3S3_EPAPER -I variants/esp32s3/tlora_t3s3_epaper -DUSE_EINK + -DMESHTASTIC_EXCLUDE_AUDIO=1 + -DMESHTASTIC_EXCLUDE_WEBSERVER=1 -DEINK_DISPLAY_MODEL=GxEPD2_213_BN -DEINK_WIDTH=250 -DEINK_HEIGHT=122 @@ -39,6 +41,9 @@ extends = esp32s3_base, inkhud board = tlora-t3s3-v1 board_check = true upload_protocol = esptool +custom_sdkconfig = + ${esp32s3_base.custom_sdkconfig} + CONFIG_ESP_IPC_TASK_STACK_SIZE=2048 ; default 1024 overflows during NimBLE init off USB power build_src_filter = ${esp32s3_base.build_src_filter} ${inkhud.build_src_filter} @@ -47,6 +52,8 @@ build_flags = ${inkhud.build_flags} -I variants/esp32s3/tlora_t3s3_epaper -D TLORA_T3S3_EPAPER + -DMESHTASTIC_EXCLUDE_AUDIO=1 + -DMESHTASTIC_EXCLUDE_WEBSERVER=1 lib_deps = ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX ${esp32s3_base.lib_deps}