diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 54a2229f..21ae6547 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -1853,16 +1853,16 @@ class AudioReactive : public Usermod { oappend(SET_F("addOption(dd,'Send',1);")); oappend(SET_F("addOption(dd,'Receive',2);")); oappend(SET_F("addInfo('AudioReactive:digitalmic:type',1,'requires reboot!');")); // 0 is field type, 1 is actual field - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',0,'I2S Serial Data (SD / DATA / DOUT) ');")); - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',1,'I2S Left/Right Clock (WS / CLK / LRCK)');")); - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',2,'I2S Serial Clock (SCK / BCLK)');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',0,'I2S Serial Data: SD / DOUT /DATA');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',1,'I2S Left/Right Clock: WS / LRCK / CLK');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',2,'I2S Serial Clock: SCK / BCLK');")); #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'I2S Master CLK
only use -1, 0, 1 or 3 for MCLK');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'MCLK - I2S Master CLK
only use -1, 0, 1 or 3 for MCLK');")); #else - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'I2S Master CLK');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'MCLK - I2S Master CLK');")); #endif - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',4,'I2C SDA');")); - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',5,'I2C SCL');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',4,'ES7243 I2C: SDA');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',5,'ES7243 I2C: SCL');")); } diff --git a/usermods/audioreactive/audio_source.h b/usermods/audioreactive/audio_source.h index 526d0689..50627dc5 100644 --- a/usermods/audioreactive/audio_source.h +++ b/usermods/audioreactive/audio_source.h @@ -420,9 +420,16 @@ public: }; void initialize(int8_t sdaPin, int8_t sclPin, int8_t i2swsPin, int8_t i2ssdPin, int8_t i2sckPin, int8_t mclkPin) { + // check that pins are valid + if ((sdaPin < 0) || (sclPin < 0)) { + DEBUGSR_PRINTF("\nAR: invalid ES7243 I2C pins: SDA=%d, SCL=%d\n", sdaPin, sclPin); + return; + } // Reserve SDA and SCL pins of the I2C interface - if (!pinManager.allocatePin(sdaPin, true, PinOwner::HW_I2C) || - !pinManager.allocatePin(sclPin, true, PinOwner::HW_I2C)) { + PinManagerPinType es7243Pins[2] = { { sdaPin, true }, { sclPin, true } }; + if (!pinManager.allocateMultiplePins(es7243Pins, 2, PinOwner::HW_I2C)) { + pinManager.deallocateMultiplePins(es7243Pins, 2, PinOwner::HW_I2C); + DEBUGSR_PRINTF("\nAR: Failed to allocate ES7243 I2C pins: SDA=%d, SCL=%d\n", sdaPin, sclPin); return; } @@ -436,8 +443,8 @@ public: void deinitialize() { // Release SDA and SCL pins of the I2C interface - pinManager.deallocatePin(pin_ES7243_SDA, PinOwner::HW_I2C); - pinManager.deallocatePin(pin_ES7243_SCL, PinOwner::HW_I2C); + PinManagerPinType es7243Pins[2] = { { pin_ES7243_SDA, true }, { pin_ES7243_SCL, true } }; + pinManager.deallocateMultiplePins(es7243Pins, 2, PinOwner::HW_I2C); I2SSource::deinitialize(); } diff --git a/wled00/wled.h b/wled00/wled.h index 32506e08..5d557727 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2211181 +#define VERSION 2211191 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG