Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ build_flags = -g
-DARDUINO_ARCH_ESP32S2
-DCONFIG_IDF_TARGET_ESP32S2=1
-DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0
-DCO
-DARDUINO_USB_MODE=0 ;; this flag is mandatory for ESP32-S2 !
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
;; ARDUINO_USB_CDC_ON_BOOT
Expand All @@ -388,7 +387,6 @@ build_flags = -g
-DARDUINO_ARCH_ESP32
-DARDUINO_ARCH_ESP32C3
-DCONFIG_IDF_TARGET_ESP32C3=1
-DCO
-DARDUINO_USB_MODE=1 ;; this flag is mandatory for ESP32-C3
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
;; ARDUINO_USB_CDC_ON_BOOT
Expand All @@ -411,7 +409,6 @@ build_flags = -g
-DARDUINO_ARCH_ESP32S3
-DCONFIG_IDF_TARGET_ESP32S3=1
-DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_DFU_ON_BOOT=0
-DCO
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
;; ARDUINO_USB_MODE, ARDUINO_USB_CDC_ON_BOOT
${esp32_idf_V5.build_flags}
Expand All @@ -436,7 +433,6 @@ build_flags = -g
-DARDUINO_ARCH_ESP32C5
-DCONFIG_IDF_TARGET_ESP32C5=1
-D CONFIG_ASYNC_TCP_USE_WDT=0
-DCO
;;-D WLED_DISABLE_INFRARED ;; library not tested yet with -C5
-D WLED_DISABLE_ESPNOW ;; ToDO: ESP-NOW support not yet tested
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
Expand Down Expand Up @@ -468,7 +464,6 @@ build_flags = -g
-DARDUINO_ARCH_ESP32C6
-DCONFIG_IDF_TARGET_ESP32C6=1
-D CONFIG_ASYNC_TCP_USE_WDT=0
-DCO
;; -D WLED_DISABLE_INFRARED ;; library not tested yet with -C6
-D WLED_DISABLE_ESPNOW ;; ToDO: temporarily disabled, until we find a solution for esp-now build errors with -C6
-DARDUINO_USB_MODE=1 ;; this flag is - most likely - mandatory for ESP32-C6
Expand Down Expand Up @@ -499,7 +494,6 @@ build_flags = -g
-DCONFIG_IDF_TARGET_ESP32P4=1
-DBOARD_HAS_PSRAM ;; all P4 boards have PSRAM support
-D CONFIG_ASYNC_TCP_USE_WDT=0
-DCO
-DARDUINO_USB_MODE=1 ;; this flag is - most likely - mandatory for ESP32-P4
;;-D WLED_DISABLE_INFRARED ;; library not tested yet with -P4
-D WLED_DISABLE_ESPNOW ;; ESP-NOW is not possible on P4 (no native Wi-Fi radio)
Expand Down
40 changes: 40 additions & 0 deletions usermods/audioreactive/audio_reactive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,48 @@

#include <driver/i2s.h>
#include <driver/adc.h>
#endif

// AI: below section was generated by an AI
#if defined(CONFIG_IDF_TARGET_ESP32) && defined(ARDUINO_ARCH_ESP32) && (ESP_IDF_VERSION_MAJOR >= 5)
Comment thread
DedeHai marked this conversation as resolved.
Outdated
/*
* Bootloop workaround for classic ESP32 on esp-idf 5.x (WLED V5):
* AR still uses the legacy I2S driver (driver/i2s.h) which pulls in the legacy ADC driver.
* This causes a "abort" on boot as IDF V5 does not allow the legacy ADC driver to be used
* if any other function (i.e. Arduino's analogRead()) pulls in the new driver.
*
* The no-op stubs below satisfy exactly the symbols i2s_legacy.c.obj needs, so the real
* adc_i2s_deprecated.c.obj / adc_legacy.c.obj are never linked. This is safe because on IDF >= 5
* the analog built-in-ADC mic class (I2SAdcSource) is compiled out anyway (see audio_source.h),
* so these paths are never executed; digital I2S/PDM mics don't use them.
* Delete this block once the usermod is ported to the new I2S driver (driver/i2s_std.h).
*/
#include <esp_err.h>

// Stub: would configure the (removed) I2S built-in ADC mode. Never called for digital mics.
extern "C" esp_err_t adc_i2s_mode_init(int adc_unit, int channel) {
(void)adc_unit; (void)channel;
return ESP_ERR_NOT_SUPPORTED;
}

// Stub: would select the ADC data source for I2S DMA. Never called for digital mics.
extern "C" esp_err_t adc_set_i2s_data_source(int adc_unit, int pattern) {
(void)adc_unit; (void)pattern;
return ESP_ERR_NOT_SUPPORTED;
}

// Stub: would acquire ADC1 for DMA (built-in ADC mode only). Report failure if ever called.
extern "C" esp_err_t adc1_dma_mode_acquire(void) {
return ESP_ERR_NOT_SUPPORTED;
}

// Stub: would release the legacy ADC1 lock. No lock is ever taken, so nothing to do.
extern "C" esp_err_t adc1_lock_release(int adc_unit) {
Comment thread
softhack007 marked this conversation as resolved.
Outdated
(void)adc_unit;
return ESP_OK;
}
#endif
// AI: end
Comment thread
DedeHai marked this conversation as resolved.

#if defined(ARDUINO_ARCH_ESP32) && (defined(WLED_DEBUG) || defined(SR_DEBUG))
#include <esp_timer.h>
Expand Down
8 changes: 2 additions & 6 deletions wled00/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1327,11 +1327,7 @@ String computeSHA1(const String& input) {
}

#ifdef ESP32
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#include "esp_adc_cal.h" // ToDO: deprecated API
//#include "esp_adc/adc_cali.h" // new API
//#include "esp_adc/adc_cali_scheme.h" // new API
#else
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
#include "esp_adc_cal.h"
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4,4,7) // backwards compatibility patch
#define ADC_ATTEN_DB_12 ADC_ATTEN_DB_11
Expand All @@ -1349,7 +1345,7 @@ String generateDeviceFingerprint() {
fp[0] ^= chip_info.revision | (chip_info.model << 16);
#endif

#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) && (CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3)
Comment thread
softhack007 marked this conversation as resolved.
Outdated
// mix in ADC calibration data - legacy adc calibration API is not supported on new MCUs (-C5, -C6, -C61, -P4)
esp_adc_cal_characteristics_t ch;
#if (SOC_ADC_MAX_BITWIDTH == 13) || (CONFIG_SOC_ADC_RTC_MAX_BITWIDTH == 13) // S2 has 13 bit ADC
Expand Down