From 32c404548832fe750dbf3d058a6a5617ac694189 Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 21 Sep 2023 19:26:09 +0200 Subject: [PATCH] Allow 9 LED pins with audioreadctive One additional LED pin for esp32 audioreactive :-) I2S#1 can still be used for NPB while audio is running on I2S#0. --- wled00/bus_wrapper.h | 17 +++++++++++++---- wled00/const.h | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/wled00/bus_wrapper.h b/wled00/bus_wrapper.h index 72b4435e..343a47c6 100644 --- a/wled00/bus_wrapper.h +++ b/wled00/bus_wrapper.h @@ -1177,8 +1177,12 @@ class PolyBus { uint8_t offset = 0; //0 = RMT (num 0-7) 8 = I2S0 9 = I2S1 #if defined(CONFIG_IDF_TARGET_ESP32S2) // ESP32-S2 only has 4 RMT channels - if (num > 4) return I_NONE; - if (num > 3) offset = 1; // only one I2S + #if defined(USERMOD_AUDIOREACTIVE) // softhack007 I2S#0 is reserved for audio input + if (num > 3) return I_NONE; + #else + if (num > 4) return I_NONE; + if (num > 3) offset = 1; // only one I2S + #endif #elif defined(CONFIG_IDF_TARGET_ESP32C3) // On ESP32-C3 only the first 2 RMT channels are usable for transmitting if (num > 1) return I_NONE; @@ -1189,8 +1193,13 @@ class PolyBus { //if (num > 3) offset = num -4; // I2S not supported yet #else // standard ESP32 has 8 RMT and 2 I2S channels - if (num > 9) return I_NONE; - if (num > 7) offset = num -7; + #if defined(USERMOD_AUDIOREACTIVE) // softhack007 I2S#0 is reserved for audio input, but I2S#1 is availeavle as 9th LED pin + if (num > 8) return I_NONE; + if (num == 8) offset = 2; + #else + if (num > 9) return I_NONE; + if (num > 7) offset = num -7; + #endif #endif switch (busType) { case TYPE_WS2812_1CH_X3: diff --git a/wled00/const.h b/wled00/const.h index 6ee83451..88cba645 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -44,8 +44,8 @@ #define WLED_MIN_VIRTUAL_BUSSES 4 #else #if defined(USERMOD_AUDIOREACTIVE) // requested by @softhack007 https://github.com/blazoncek/WLED/issues/33 - #define WLED_MAX_BUSSES 8 - #define WLED_MIN_VIRTUAL_BUSSES 2 + #define WLED_MAX_BUSSES 9 + #define WLED_MIN_VIRTUAL_BUSSES 1 #else #define WLED_MAX_BUSSES 10 #define WLED_MIN_VIRTUAL_BUSSES 0