diff --git a/scripts/applyPatches.py b/scripts/applyPatches.py index 3c38c100f..83b28c234 100644 --- a/scripts/applyPatches.py +++ b/scripts/applyPatches.py @@ -28,9 +28,10 @@ def applyPatch(libName, patchFile): # list of patches to apply (relative to /src) applyPatch("ESPAsyncWebServer-esphome", "../patches/AsyncWeb_Prometheus.patch") -if env['PIOENV'][:13] == "opendtufusion": - applyPatch("GxEPD2", "../patches/GxEPD2_SW_SPI.patch") -elif env['PIOENV'][:5] == "esp32": +#if env['PIOENV'][:13] == "opendtufusion": + #applyPatch("GxEPD2", "../patches/GxEPD2_SW_SPI.patch") +#el +if (env['PIOENV'][:5] == "esp32") or (env['PIOENV'][:13] == "opendtufusion"): applyPatch("GxEPD2", "../patches/GxEPD2_HAL.patch") if (env['PIOENV'][:13] == "opendtufusion") or (env['PIOENV'][:5] == "esp32"): diff --git a/src/hm/nrfHal.h b/src/hm/nrfHal.h index a9bd89d2e..a92285438 100644 --- a/src/hm/nrfHal.h +++ b/src/hm/nrfHal.h @@ -39,7 +39,12 @@ class nrfHal: public RF24_hal, public SpiPatcherHandle { mPinEn = static_cast(en); mSpiSpeed = speed; + #if defined(CONFIG_IDF_TARGET_ESP32S3) + mHostDevice = SPI2_HOST; + #else mHostDevice = (14 == sclk) ? SPI2_HOST : SPI3_HOST; + #endif + mSpiPatcher = SpiPatcher::getInstance(mHostDevice); gpio_reset_pin(mPinMosi); diff --git a/src/hms/cmtHal.h b/src/hms/cmtHal.h index 58f79da4b..13a14950e 100644 --- a/src/hms/cmtHal.h +++ b/src/hms/cmtHal.h @@ -37,7 +37,12 @@ class cmtHal : public SpiPatcherHandle { mPinFcs = static_cast(fcs); mSpiSpeed = speed; + #if defined(CONFIG_IDF_TARGET_ESP32S3) + mHostDevice = SPI2_HOST; + #else mHostDevice = (14 == clk) ? SPI2_HOST : SPI3_HOST; + #endif + mSpiPatcher = SpiPatcher::getInstance(mHostDevice); gpio_reset_pin(mPinSdio); diff --git a/src/network/AhoyEthernetSpi.h b/src/network/AhoyEthernetSpi.h index 7b5bac85b..4848de284 100644 --- a/src/network/AhoyEthernetSpi.h +++ b/src/network/AhoyEthernetSpi.h @@ -44,7 +44,12 @@ class AhoyEthernetSpi { gpio_reset_pin(static_cast(pin_int)); gpio_set_pull_mode(static_cast(pin_int), GPIO_PULLUP_ONLY); + #if defined(CONFIG_IDF_TARGET_ESP32S3) + mHostDevice = SPI3_HOST; + #else mHostDevice = (14 == pin_sclk) ? SPI2_HOST : SPI3_HOST; + #endif + mSpiPatcher = SpiPatcher::getInstance(mHostDevice); spi_device_interface_config_t devcfg = { diff --git a/src/plugins/Display/epdHal.h b/src/plugins/Display/epdHal.h index 4d2057dd2..377632888 100644 --- a/src/plugins/Display/epdHal.h +++ b/src/plugins/Display/epdHal.h @@ -38,7 +38,12 @@ class epdHal: public GxEPD2_HalInterface, public SpiPatcherHandle { mPinBusy = static_cast(busy); mSpiSpeed = speed; + #if defined(CONFIG_IDF_TARGET_ESP32S3) + mHostDevice = SPI3_HOST; + #else mHostDevice = (14 == sclk) ? SPI2_HOST : SPI3_HOST; + #endif + mSpiPatcher = SpiPatcher::getInstance(mHostDevice); gpio_reset_pin(mPinMosi);