diff --git a/usermods/audioreactive/audio_source.h b/usermods/audioreactive/audio_source.h index b1bce2bf..164e945d 100644 --- a/usermods/audioreactive/audio_source.h +++ b/usermods/audioreactive/audio_source.h @@ -319,7 +319,7 @@ public: }; #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) -// ADC over I2S is only availeable in "claasic" ESP32 +// ADC over I2S is only availeable in "classic" ESP32 /* ADC over I2S Microphone This microphone is an ADC pin sampled via the I2S interval diff --git a/wled00/const.h b/wled00/const.h index 08d76935..d0d2d754 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -25,10 +25,14 @@ #ifdef ESP8266 #define WLED_MAX_BUSSES 3 #else - #ifdef CONFIG_IDF_TARGET_ESP32S2 + #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) #define WLED_MAX_BUSSES 5 #else - #define WLED_MAX_BUSSES 10 + #if defined(CONFIG_IDF_TARGET_ESP32S3) + #define WLED_MAX_BUSSES 8 + #else + #define WLED_MAX_BUSSES 10 + #endif #endif #endif #endif diff --git a/wled00/pin_manager.cpp b/wled00/pin_manager.cpp index 14d5b65b..d1b6740e 100644 --- a/wled00/pin_manager.cpp +++ b/wled00/pin_manager.cpp @@ -219,11 +219,20 @@ PinOwner PinManagerClass::getPinOwner(byte gpio) { } #ifdef ARDUINO_ARCH_ESP32 +#if defined(CONFIG_IDF_TARGET_ESP32C3) + #define MAX_LED_CHANNELS 6 +#else + #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) + #define MAX_LED_CHANNELS 8 + #else + #define MAX_LED_CHANNELS 16 + #endif +#endif byte PinManagerClass::allocateLedc(byte channels) { - if (channels > 16 || channels == 0) return 255; + if (channels > MAX_LED_CHANNELS || channels == 0) return 255; byte ca = 0; - for (byte i = 0; i < 16; i++) { + for (byte i = 0; i < MAX_LED_CHANNELS; i++) { byte by = i >> 3; byte bi = i - 8*by; if (bitRead(ledcAlloc[by], bi)) { //found occupied pin @@ -248,7 +257,7 @@ byte PinManagerClass::allocateLedc(byte channels) void PinManagerClass::deallocateLedc(byte pos, byte channels) { for (byte j = pos; j < pos + channels; j++) { - if (j > 16) return; + if (j > MAX_LED_CHANNELS) return; byte by = j >> 3; byte bi = j - 8*by; bitWrite(ledcAlloc[by], bi, false); diff --git a/wled00/xml.cpp b/wled00/xml.cpp index fb3216cc..fc090668 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -317,9 +317,9 @@ void getSettingsJS(byte subPage, char* dest) // set limits oappend(SET_F("bLimits(")); - #if defined(ESP32) && defined(USERMOD_AUDIOREACTIVE) + #if defined(ESP32) && defined(USERMOD_AUDIOREACTIVE) && !defined(CONFIG_IDF_TARGET_ESP32S3) // requested by @softhack007 https://github.com/blazoncek/WLED/issues/33 - oappend(itoa(WLED_MAX_BUSSES-2,nS,10)); oappend(","); // prevent use of I2S buses if audio installed + oappend(itoa(WLED_MAX_BUSSES-2,nS,10)); oappend(","); // prevent use of I2S buses if audio installed. ESP32-S3 currently does not support these busses. #else oappend(itoa(WLED_MAX_BUSSES,nS,10)); oappend(","); #endif