es7243 additional error checking
- es7243: check for valid SCK and MCLK - minor UI improvements
This commit is contained in:
@@ -778,7 +778,7 @@ build_flags = ${esp32_4MB_V4_max_base.build_flags}
|
|||||||
; RAM: [== ] 24.8% (used 81316 bytes from 327680 bytes)
|
; RAM: [== ] 24.8% (used 81316 bytes from 327680 bytes)
|
||||||
; Flash: [======= ] 72.9% (used 1528253 bytes from 2097152 bytes)
|
; Flash: [======= ] 72.9% (used 1528253 bytes from 2097152 bytes)
|
||||||
|
|
||||||
;; experiemtal environment for boards with PSRAM (needs ESP-IDF 4.4.1).
|
;; experimental environment for boards with PSRAM (needs ESP-IDF 4.4.1).
|
||||||
; esp32_4MB_PSRAM_max: bin entry, uses esp32_4MB_V4_max_base and adds specific settings
|
; esp32_4MB_PSRAM_max: bin entry, uses esp32_4MB_V4_max_base and adds specific settings
|
||||||
[env:esp32_4MB_PSRAM_max]
|
[env:esp32_4MB_PSRAM_max]
|
||||||
extends = esp32_4MB_V4_max_base
|
extends = esp32_4MB_V4_max_base
|
||||||
|
|||||||
@@ -1252,7 +1252,11 @@ class AudioReactive : public Usermod {
|
|||||||
if (enabled) disableSoundProcessing = false; // all good - enable audio processing
|
if (enabled) disableSoundProcessing = false; // all good - enable audio processing
|
||||||
|
|
||||||
if((!audioSource) || (!audioSource->isInitialized())) { // audio source failed to initialize. Still stay "enabled", as there might be input arriving via UDP Sound Sync
|
if((!audioSource) || (!audioSource->isInitialized())) { // audio source failed to initialize. Still stay "enabled", as there might be input arriving via UDP Sound Sync
|
||||||
|
#ifdef WLED_DEBUG
|
||||||
|
DEBUG_PRINTLN(F("AR: Failed to initialize sound input driver. Please check input PIN settings."));
|
||||||
|
#else
|
||||||
DEBUGSR_PRINTLN(F("AR: Failed to initialize sound input driver. Please check input PIN settings."));
|
DEBUGSR_PRINTLN(F("AR: Failed to initialize sound input driver. Please check input PIN settings."));
|
||||||
|
#endif
|
||||||
disableSoundProcessing = true;
|
disableSoundProcessing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1853,13 +1857,13 @@ class AudioReactive : public Usermod {
|
|||||||
oappend(SET_F("addOption(dd,'Send',1);"));
|
oappend(SET_F("addOption(dd,'Send',1);"));
|
||||||
oappend(SET_F("addOption(dd,'Receive',2);"));
|
oappend(SET_F("addOption(dd,'Receive',2);"));
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:type',1,'<i>requires reboot!</i>');")); // 0 is field type, 1 is actual field
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:type',1,'<i>requires reboot!</i>');")); // 0 is field type, 1 is actual field
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',0,'I2S Serial Data: SD / DOUT /DATA');"));
|
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[]',1,'I2S Left/Right Clock: WS / LRCK / CLK');"));
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',2,'I2S Serial Clock: SCK / BCLK');"));
|
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)
|
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'MCLK - I2S Master CLK<br/><i>only use -1, 0, 1 or 3 for MCLK</i>');"));
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'MCLK: I2S Master CLK<br/><i>only use -1, 0, 1 or 3 for MCLK</i>');"));
|
||||||
#else
|
#else
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'MCLK - I2S Master CLK');"));
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'MCLK: I2S Master CLK');"));
|
||||||
#endif
|
#endif
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',4,'ES7243 I2C: SDA');"));
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',4,'ES7243 I2C: SDA');"));
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',5,'ES7243 I2C: SCL');"));
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',5,'ES7243 I2C: SCL');"));
|
||||||
|
|||||||
@@ -271,6 +271,8 @@ class I2SSource : public AudioSource {
|
|||||||
.data_in_num = i2ssdPin
|
.data_in_num = i2ssdPin
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//DEBUGSR_PRINTF("[AR] I2S: SD=%d, WS=%d, SCK=%d, MCLK=%d\n", i2ssdPin, i2swsPin, i2sckPin, mclkPin);
|
||||||
|
|
||||||
esp_err_t err = i2s_driver_install(I2S_NUM_0, &_config, 0, nullptr);
|
esp_err_t err = i2s_driver_install(I2S_NUM_0, &_config, 0, nullptr);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
DEBUGSR_PRINTF("AR: Failed to install i2s driver: %d\n", err);
|
DEBUGSR_PRINTF("AR: Failed to install i2s driver: %d\n", err);
|
||||||
@@ -282,7 +284,8 @@ class I2SSource : public AudioSource {
|
|||||||
if(_config.mode & I2S_MODE_MASTER) {
|
if(_config.mode & I2S_MODE_MASTER) {
|
||||||
if (_config.mode & I2S_MODE_PDM)
|
if (_config.mode & I2S_MODE_PDM)
|
||||||
DEBUGSR_PRINTLN(F("AR: I2S#0 driver installed in PDM MASTER mode."));
|
DEBUGSR_PRINTLN(F("AR: I2S#0 driver installed in PDM MASTER mode."));
|
||||||
else DEBUGSR_PRINTLN(F("AR: I2S#0 driver installed in MASTER mode."));
|
else
|
||||||
|
DEBUGSR_PRINTLN(F("AR: I2S#0 driver installed in MASTER mode."));
|
||||||
} else
|
} else
|
||||||
DEBUGSR_PRINTLN(F("AR: I2S#0 driver installed in SLAVE mode."));
|
DEBUGSR_PRINTLN(F("AR: I2S#0 driver installed in SLAVE mode."));
|
||||||
|
|
||||||
@@ -425,6 +428,12 @@ public:
|
|||||||
DEBUGSR_PRINTF("\nAR: invalid ES7243 I2C pins: SDA=%d, SCL=%d\n", sdaPin, sclPin);
|
DEBUGSR_PRINTF("\nAR: invalid ES7243 I2C pins: SDA=%d, SCL=%d\n", sdaPin, sclPin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((i2sckPin < 0) || (mclkPin < 0)) {
|
||||||
|
DEBUGSR_PRINTF("\nAR: invalid I2S pin: SCK=%d, MCLK=%d\n", i2sckPin, mclkPin);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Reserve SDA and SCL pins of the I2C interface
|
// Reserve SDA and SCL pins of the I2C interface
|
||||||
PinManagerPinType es7243Pins[2] = { { sdaPin, true }, { sclPin, true } };
|
PinManagerPinType es7243Pins[2] = { { sdaPin, true }, { sclPin, true } };
|
||||||
if (!pinManager.allocateMultiplePins(es7243Pins, 2, PinOwner::HW_I2C)) {
|
if (!pinManager.allocateMultiplePins(es7243Pins, 2, PinOwner::HW_I2C)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user