Skip to content

Fix bootloops, remove stray flag#5749

Open
DedeHai wants to merge 4 commits into
wled:mainfrom
DedeHai:Fix_V5_bootloop
Open

Fix bootloops, remove stray flag#5749
DedeHai wants to merge 4 commits into
wled:mainfrom
DedeHai:Fix_V5_bootloop

Conversation

@DedeHai

@DedeHai DedeHai commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

C3 and S3 would just bootloop. There are two issues:

  • the ADC calibration used to "salt" the device hash is no longer available in V5 - While it works on ESP32 and S2 it's best to remove it completely from V5 builds. The issue is that this pulls in the legacy driver which V5 has a guard for: if both legacy and new drivers are used, it will "abort" during boot.

edit: adding -march=rv32imc is not needed, it was related to local PIO breaking when switching from V4 to V5 without deleting the .pio folder:

  • On the C3 there is a secondary issue: the build uses rv32imac by default for RISC V builds. The C3 being the first one using this architecture does not have the atromic hardware support (tha "a" in rv32imac). Using -march=rv32imc forces the compiler to use software "atomic" -> no more "invalid instruction"

I also removed the stray "-DCO" flags that have no meaning and are probably truncated DCORE_DEBUG_LEVEL flags

edit: also fixes bootloop on ESP32 when using AR

Summary by CodeRabbit

Summary by CodeRabbit

  • Bug Fixes
    • Improved build and runtime compatibility across ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C5, ESP32-C6, and ESP32-P4.
    • Corrected USB-mode build configuration for supported ESP32-family targets.
    • Updated device fingerprint generation to select the right ADC-calibration behavior based on ESP-IDF version and chip variant.
    • Added an ESP-IDF 5.x stability workaround for audio-reactive builds on ESP32 to avoid boot issues.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

ESP32 build environments remove stray directives and add target-specific USB-mode defines. Device-fingerprint ADC calibration is restricted to pre-5.0 ESP-IDF builds, while audioreactive adds ESP-IDF 5.x compatibility stubs for legacy ADC/I2S symbols.

Changes

ESP32 compatibility

Layer / File(s) Summary
ESP32 build flag updates
platformio.ini
Removes stray -DCO directives for ESP32-S2/C3/C5/C6/P4/S3 and adds USB-mode defines for S2, C3, C6, and P4.
ADC calibration guards
wled00/util.cpp
Restricts ADC calibration headers and fingerprint calibration-data mixing to pre-5.0.0 ESP-IDF builds and supported ESP32 targets.
ESP-IDF 5.x audioreactive compatibility
usermods/audioreactive/audio_reactive.cpp
Adds C-linkage stubs for legacy ADC/I2S symbols on ESP32 ESP-IDF 5.x builds.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • wled/WLED#5048: Related ESP32-C3/C5/C6/P4 build environments and USB-mode defines.
  • wled/WLED#5107: Related ESP32 USB-mode build flag changes.
  • wled/WLED#5357: Related audioreactive ESP-IDF I2S compatibility workarounds.

Suggested labels: V5, usermod, major

Suggested reviewers: softhack007, netmindz

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main changes: fixing bootloops and cleaning up a stray build flag.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@softhack007 softhack007 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍
I was always wondering what -DCO is about, it was probably an ancient copy&paste from tasmota

@DedeHai

DedeHai commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

@netmindz this changes the "device ID" for the stats, at least for C3 and S3 - just a heads-up

Comment thread platformio.ini Outdated
Comment thread wled00/util.cpp
#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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will mean that every unique deviceId will change. Is this really our only option?

If so then we need to start rolling out a dual deviceid approach into current firmware so we can try and migrate

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could go back to my initial approach of reading the values directly from the fuses - which was replaced with this as it is "dangerous low level stuff" and better to use a higher level API but since it is no longer available that would now be our only option.

@softhack007 softhack007 Jul 21, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so then we need to start rolling out a dual deviceid approach into current firmware

I think our DeviceIDs will definitely change with V5 - the old API is gone; it gave us some calibration data to salt the DeviceID with. We cannot even re-calculate the old IDs in V5 firmware.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe I can salvage it, the ESP32 and the S2 still support the old API (at least in the V5 version we are using, AI said it got removed in 5.6 or something). For the C3 and S3 we may be able to replicate the value from the fuse value, need to check.

@softhack007

Copy link
Copy Markdown
Member

@DedeHai i've just fixed some merge conflicts with my latest platformio.ini changes, hope this doesn't screw up any uncommitted changes you may have.

@DedeHai

DedeHai commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

@softhack007 I have no uncommited changes yet. I am just running V5 on some of my test devices - C3 and S2 are completely screwed using RMT - not sure we are missing some parameters for NPB or if it just plain is not working. Symptoms: frames get pushed out while the last frame is still sending (FPS limiter disabled). When trying to save any LED settings, it hangs at while(!canAllShow()). S2 is slightly better than C3 it seems but can not save LED settings as well.

@willmmiles

Copy link
Copy Markdown
Member

@softhack007 I have no uncommited changes yet. I am just running V5 on some of my test devices - C3 and S2 are completely screwed using RMT - not sure we are missing some parameters for NPB or if it just plain is not working. Symptoms: frames get pushed out while the last frame is still sending (FPS limiter disabled). When trying to save any LED settings, it hangs at while(!canAllShow()). S2 is slightly better than C3 it seems but can not save LED settings as well.

@DedeHai I'd suggest fixing up pixelbus and merging it instead of debugging NPB. We can continue to iterate on it in main.

@softhack007

softhack007 commented Jul 21, 2026

Copy link
Copy Markdown
Member
  • C3 and S2 are completely screwed using RMT

Wow, that's heavy. It might be due to using the "core3" neopixelbus branch that uses the new RMT channelizer API 🤔

WLED/wled00/bus_wrapper.h

Lines 254 to 256 in f7cff3d

// RMT driver selection
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#define NeoEsp32RmtMethod(x) NeoEsp32RmtX ## x ## Method

Also the V4 builds now seem to use NPB "core3", I'll try to separate that out so V5 and V4 can have different NPB versions.

In principle - if nothing in wled references the new RMT api - we could even continue to use the "normal" NPB version with the old RMT driver.

Edit: or following the suggestion by @willmmiles, we wait a bit until WLEDpixelBus is ready for merging (must run on esp-idf V5 and V4 !), and then completely swap out NPB for all esp32 variants.

@DedeHai

DedeHai commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

I'd suggest fixing up pixelbus and merging it instead of debugging NPB. We can continue to iterate on it in main.

exactly my thought, already updated the branch to main but oh so many compile errors ;)

@DedeHai

DedeHai commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

@softhack007 what is the reason we need everything to run on V4 still?

@softhack007

softhack007 commented Jul 21, 2026

Copy link
Copy Markdown
Member

@softhack007 what is the reason we need everything to run on V4 still?

Right now I still keep V4 as a "fallback" option, for back-to-back compare and for users that need features which are currently not working with V5 (analog mic, DMX serial, RMTHI flicker fixer, etc.). Its just a complication in platformio.ini, and some #if ESP_IDF_VERSION guards.

If it gets too complicated to handle, we can drop the V4 support.

@softhack007

softhack007 commented Jul 21, 2026

Copy link
Copy Markdown
Member

@DedeHai @netmindz as this is currently a show-stopper for S3 and C3 🤔 how about limiting the deviceID workaround to these two MCUs and then merge to main, and we'll try to rescue the old deviceID code in a separate PR?

It means we will collect some duplicate/bad IDs in the usage database. I guess there will just be a few reports that could be removed later, by searching for date + version. Additionally, nightly builds are off, and I hope that only a few users will install from main.

@DedeHai

DedeHai commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

@softhack007 I have a suggested fix from claude but did not check if it is legit and actually working.

@DedeHai

DedeHai commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

And I have the new WLEDpixelbus running on an S2 - RMT, I2S and BitBang appear to be working but RMT is quite fragile without the high priority interrupt: using more than two RMT outputs gives me horrible flickering but at least it works. I2S seems glitch free and bit bang as well so good progress on that front

@DedeHai

DedeHai commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

@softhack007 I don't know why it worked before but now I can not get classic ESP32 to boot, seems to be the same legacy adc driver conflict. If I do not compile AR UM it runs. #include <driver/i2s.h> pulls in the legacy driver. Does it boot for you?
edit: AI found a fix but I have no idea if it is legit: it adds dummy stubs to override the functions that pull in the legacy ADC but if this breaks something else in I2S audio input I don't know. Let me know if I should push it to this PR for testing.

@softhack007

softhack007 commented Jul 22, 2026

Copy link
Copy Markdown
Member

Well, I got AR to compile with V5 yesterday - all V5 builds before yesterday did not include AR. I need to cross-check. If driver/i2s.h is enough to create the legacy driver conflict, it means we need to exclude AR from esp32. I'll check during the day.

In fact classic esp32 is the only boards where i2s supported adc-over-i2s, so it makes sense that classic esp32 now has the adc driver conflict.

@DedeHai

DedeHai commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

@softhack007 if you can also check if S3 works, I also got a bootloop with AR but not sure I was not on the new LED driver branch which may not be fully up to date with main

@DedeHai

DedeHai commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

regarding device ID: I have a fix for the C3, ESP32 and S2 still work correctly using the deprecated function (it does not pull in the legacy driver) BUT the legacy adc stuff is no longer available in newer IDFs so I will try if I can do it without that function. S3 I could not get to produce the same ID as in 16.0. @netmindz how many S3 are in the stats and how bad would it be if those changed ID?

@softhack007

softhack007 commented Jul 22, 2026

Copy link
Copy Markdown
Member

@DedeHai bootloop on classic esp32 confirmed - it happens when audioreactive is included

Backtrace: 0x40082f81:0x3ffe3b30 0x4008d651:0x3ffe3b50 0x40090d89:0x3ffe3b70 0x4017a80f:0x3ffe3be0 0x4016e01e:0x3ffe3c00 0x40082501:0x3ffe3c30 0x400792bb:0x3ffe3c80 |&lt;-CORRUPTED

ELF file SHA256: b149e4e6e

Rebooting...

Stack Trace

Address Function Location
0 0x40082f81 panic_abort ??
1 0x4008d651 esp_system_abort ??
2 0x40090d89 abort ??
3 0x4017a80f check_adc_oneshot_driver_conflict adc_legacy.c.obj
4 0x4016e01e start_cpu0_default startup.c.obj
5 0x40082501 call_start_cpu0 ??

@softhack007

Copy link
Copy Markdown
Member

@softhack007 if you can also check if S3 works, I also got a bootloop with AR but not sure I was not on the new LED driver branch which may not be fully up to date with main

S3 works for me, also with AR. But I'll still push a change that avoids including adc.h

@bjoernh

bjoernh commented Jul 22, 2026

Copy link
Copy Markdown

I hit also the boot loop. on C3 and classic ESP32, put the discovery (from claude) as a reference here:

Confirming this fixes the C3 here, and flagging that the classic ESP32 has a second, independent path to the same abort() that this PR doesn't cover.

Re: "While it works on ESP32 and S2" — the esp32dev env still boot-loops with this patch applied, because default_usermods = audioreactive pulls in the legacy ADC driver via legacy I2S rather than via esp_adc_cal:

audio_reactive.cpp (i2s_set_clk)
  -> libdriver.a(i2s_legacy.c.obj)
  -> adc_i2s_deprecated.c.obj   (adc_set_i2s_data_source)
  -> adc_legacy.c.obj           (adc_common_gpio_init)

adc_legacy.c.obj is what carries the check_adc_oneshot_driver_conflict() constructor, so it aborts as soon as anything also links the oneshot driver — which Arduino's analogRead() always does. Removing the esp_adc_cal usage doesn't break this chain.

Reproduction

Board: ESP32-D0WD-V3 rev v3.0, 4MB flash. Tree at 17.0.0-devV5 with this PR's wled00/util.cpp diff applied, pio run -e esp32dev:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
...
entry 0x40080554

abort() was called at PC 0x40150263 on core 0

Backtrace: 0x40082edd:0x3ffe3b30 0x4008d569:0x3ffe3b50 0x40090ca1:0x3ffe3b70 0x40150263:0x3ffe3be0 0x40142bd2:0x3ffe3c00 0x4008245d:0x3ffe3c30 0x400792bb:0x3ffe3c80 |<-CORRUPTED

147 crash cycles in 12 s. Decoded:

0x40082edd: panic_abort
0x4008d569: esp_system_abort
0x40090ca1: abort
0x40150263: check_adc_oneshot_driver_conflict at adc_legacy.c.obj
0x40142bd2: start_cpu0_default at startup.c.obj
0x4008245d: call_start_cpu0

i.e. it aborts in a C constructor during start_cpu0_default, before app_main. The linker map confirms both drivers are present (adc_oneshot_new_unit from esp32-hal-adc.c, check_adc_oneshot_driver_conflict from adc_legacy.c.obj, 88 references).

Confirmation

Rebuilding esp32dev with custom_usermods = (audioreactive removed, nothing else changed) drops adc_legacy.c.obj, i2s_legacy.c.obj and the constructor from the link entirely, and the board boots normally:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
...
entry 0x40080554
Ada

One reset, zero aborts.

Notes

  • The middle link, adc_i2s_deprecated.c.obj, is the I2S-ADC path that only exists on classic ESP32, so I'd expect S3 to be genuinely fixed by this PR — this second issue looks ESP32-only. I have not verified S2/S3 on hardware.
  • On the C3 the chain is the one you describe (esp_adc_cal_characterize -> esp_adc_cal_common_legacy.c.obj -> adc_legacy.c.obj), and this PR does fix it — verified on an ESP32-C3 rev v0.4: boot-loop before, clean boot after.
  • Worth noting the C3 gives no diagnostic at all for this: the constructor's ESP_EARLY_LOGE is compiled out at the default log level and targets UART0, not USB CDC, so you only see a bare abort().

Hope it is useful, otherwise I can delete it.

@softhack007

softhack007 commented Jul 22, 2026

Copy link
Copy Markdown
Member

Hope it is useful, otherwise I can delete it.

Thanks, this confirms our observation (The tech-babble from claude is not adding anything useful, unfortunately; esp-idf is written in plain C, there is no such thing as a "C constructor". The abort is simply from the esp-idf startup code that checks if a weak symbol is not NULL).

It means that for classic esp32 only, audioreactive does not work any more in V5. It needs a full port to the new APIs.
Hint: don't ask any AI for attempting to port AR to V5, it will just burn through your tokens without any useful result.

@DedeHai

DedeHai commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

@softhack007 in general you can check the .map file: if it contains "adc_legacy" it wont boot and something pulled that in.
I will try and fix the "salt"ing without the use of calling adc calibration stuff so it won't break again immediately if we need to move to 5.6 for some reason.

@DedeHai

DedeHai commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

It means that for classic esp32 only, audioreactive does not work any more in V5. It needs a full port to the new APIs.

@softhack007 eventually yes but as I noted above, I do have a "hack fix" but I have no hardware to test if the I2S mic still works. Since the other option is to disable AR completely, I will add it to this PR for you to test with actual audio hardware.

i.e. this:

AI found a fix but I have no idea if it is legit: it adds dummy stubs to override the functions that pull in the legacy ADC but if this breaks something else in I2S audio input I don't know. Let me know if I should push it to this PR for testing.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@usermods/audioreactive/audio_reactive.cpp`:
- Around line 8-49: Update the four legacy ADC shims in the ESP32/ESP-IDF 5
block to match the exact ESP-IDF prototypes, including using adc_unit_t and
adc_channel_t for adc_i2s_mode_init, and correcting the parameter types and
return signatures of adc_set_i2s_data_source and adc1_lock_release. Preserve the
existing stub behavior and extern "C" linkage while including the appropriate
ADC declarations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 22eb3a87-98bf-48c2-a980-23247ed26e1a

📥 Commits

Reviewing files that changed from the base of the PR and between 5a5fd54 and 986f790.

📒 Files selected for processing (3)
  • platformio.ini
  • usermods/audioreactive/audio_reactive.cpp
  • wled00/util.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • platformio.ini
  • wled00/util.cpp

Comment on lines +8 to +49
#endif

// AI: below section was generated by an AI
#if defined(CONFIG_IDF_TARGET_ESP32) && defined(ARDUINO_ARCH_ESP32) && (ESP_IDF_VERSION_MAJOR >= 5)
/*
* 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) {
(void)adc_unit;
return ESP_OK;
}
#endif
// AI: end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== file outline =="
ast-grep outline usermods/audioreactive/audio_reactive.cpp --view expanded || true

echo
echo "== relevant references in repo =="
rg -n "adc_i2s_mode_init|adc_set_i2s_data_source|adc1_dma_mode_acquire|adc1_lock_release|adc_i2s_source_t" usermods/audioreactive docs -S || true

echo
echo "== local snippet around stubs =="
sed -n '1,70p' usermods/audioreactive/audio_reactive.cpp

Repository: wled/WLED

Length of output: 3928


🌐 Web query:

ESP-IDF adc_i2s_mode_init adc1_dma_mode_acquire adc1_lock_release adc_set_i2s_data_source signatures

💡 Result:

The requested functions are part of the deprecated legacy ADC driver in ESP-IDF [1]. Because these APIs are deprecated, they have been removed from modern versions of the framework in favor of the newer ADC Continuous Read (DMA) driver [2][1]. The function signatures for these legacy APIs are: 1. esp_err_t adc_i2s_mode_init(adc_unit_t adc_unit, adc_channel_t channel); This function was used to initialize I2S ADC mode [3][4]. 2. esp_err_t adc1_dma_mode_acquire(void); This function was used by I2S DMA to claim exclusive access to ADC1, preventing other tasks from using it [5][6]. 3. esp_err_t adc1_lock_release(void); This function was used to release the ADC1 lock, allowing other tasks to use the peripheral [6][7]. Note: A separate, non-deprecated function named adc_lock_release(adc_unit_t adc_unit) exists in more recent ESP-IDF versions as part of the hardware control support [8]. 4. esp_err_t adc_set_i2s_data_source(adc_i2s_source_t src); This function was used to set the source for I2S DMA data (e.g., from GPIO or ADC) [9][10]. If you are developing for modern ESP-IDF versions, you should migrate to the ADC Continuous Read driver using the headers found in esp_adc/adc_continuous.h [2][1].

Citations:


Match the legacy ADC stub signatures exactly
adc_set_i2s_data_source and adc1_lock_release don’t match the ESP-IDF declarations, and adc_i2s_mode_init should use the real adc_unit_t / adc_channel_t types. These extern "C" shims should mirror the upstream prototypes exactly.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@usermods/audioreactive/audio_reactive.cpp` around lines 8 - 49, Update the
four legacy ADC shims in the ESP32/ESP-IDF 5 block to match the exact ESP-IDF
prototypes, including using adc_unit_t and adc_channel_t for adc_i2s_mode_init,
and correcting the parameter types and return signatures of
adc_set_i2s_data_source and adc1_lock_release. Preserve the existing stub
behavior and extern "C" linkage while including the appropriate ADC
declarations.

Source: Path instructions

#endif

// AI: below section was generated by an AI
#if defined(CONFIG_IDF_TARGET_ESP32) && defined(ARDUINO_ARCH_ESP32) && (ESP_IDF_VERSION_MAJOR >= 5)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be shortened a bit, because IDF_TARGET_ESP32 implies ARDUINO_ARCH_ESP32

#if defined(CONFIG_IDF_TARGET_ESP32) && (ESP_IDF_VERSION_MAJOR > 4)

@softhack007

softhack007 commented Jul 22, 2026

Copy link
Copy Markdown
Member

i.e. this:

AI found a fix but I have no idea if it is legit: it adds dummy stubs to override the functions that pull in the legacy ADC but if this breaks something else in I2S audio input I don't know. Let me know if I should push it to this PR for testing.

@DedeHai thanks, I'll check on my boards. I can do a quick test today, and tomorrow test with real I2S and PDM hardware.

Edit: first test without mic: SUCCESS (esp32 boot complete)

Comment thread usermods/audioreactive/audio_reactive.cpp
@DedeHai DedeHai changed the title Fix bootloop on C3 and S3, remove stray flag Fix bootloops, remove stray flag Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants