-
-
Notifications
You must be signed in to change notification settings - Fork 4k
🚀 Add new MCU support (C6 and C5) to the ESP-IDF V5 builds #5048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: V5
Are you sure you want to change the base?
Changes from all commits
9649125
0f10558
cf195af
db65e30
fa5aa58
152bfd1
1bc63ca
6961059
45d105e
b2d6591
62ca377
7023545
1de36ca
2df4c58
3f441f0
c73935d
c096c5b
5ecf76c
bc4b6b6
7b54be8
9f12301
f88fd07
d3e92f2
ec44fd1
c92abb8
e4d6848
d2c1313
4ebbd86
2f267a8
cf09c0d
01b1c51
8268c4a
11f5be1
35706f0
5137768
d2e6a56
1a025f5
f0acc62
83c37f8
6cefd14
16262ee
b2e0c24
a1a1905
a3a3547
b860a1a
20dd750
e9b1a53
8b98a7a
0920f0f
b30951e
6b9f90c
3c24681
9232bd4
be49f34
1800a32
9d63296
d7ab1f4
7370c10
8159768
d8616e6
5b46b9c
576e82b
e104529
6e70d0c
b72568f
d3251c5
f02e6b6
b128585
ab65e9f
ed6b82b
7014d4f
edf0cbe
d823ab4
cd911ae
4f9c48f
71cf78b
546384b
1009855
c6739d3
08ca41b
a39285a
703b90f
f8df68c
b730ce8
e046316
f8a6790
55eee94
46a1b2f
ede8a14
deaae11
5e073ce
c1dddea
7ce497b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -668,7 +668,7 @@ class AudioReactive : public Usermod { | |
| static const char _dynamics[]; | ||
| static const char _frequency[]; | ||
| static const char _inputLvl[]; | ||
| #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) | ||
| #if defined(CONFIG_IDF_TARGET_ESP32) // analog mic is only supported on classic esp32 | ||
| static const char _analogmic[]; | ||
| #endif | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| static const char _digitalmic[]; | ||
|
|
@@ -1160,23 +1160,23 @@ class AudioReactive : public Usermod { | |
|
|
||
| // Reset I2S peripheral for good measure | ||
| i2s_driver_uninstall(I2S_NUM_0); // E (696) I2S: i2s_driver_uninstall(2006): I2S port 0 has not installed | ||
| #if !defined(CONFIG_IDF_TARGET_ESP32C3) | ||
| #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) | ||
| delay(100); | ||
| periph_module_reset(PERIPH_I2S0_MODULE); // not possible on -C3 | ||
| #endif | ||
|
Comment on lines
+1163
to
1166
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
echo "=== Checking platformio.ini for ESP32-C6 environments ==="
grep -n -i 'c6\|esp32c6' platformio.ini | head -20
echo ""
echo "=== Checking if audioreactive is excluded for any boards ==="
grep -n -A2 -B2 'audioreactive' platformio.ini | head -30
echo ""
echo "=== Searching for existing CONFIG_IDF_TARGET_ESP32C6 in codebase ==="
find . -name "*.cpp" -o -name "*.h" | xargs grep -l "CONFIG_IDF_TARGET_ESP32C6" | head -10
echo ""
echo "=== Checking audio_reactive.cpp for any C6 mentions ==="
grep -n "C6\|c6" usermods/audioreactive/audio_reactive.cpp
echo ""
echo "=== Check if there are any guards using C6 anywhere ==="
rg "CONFIG_IDF_TARGET_ESP32C6" -t cpp -t h --max-count 20Repository: wled/WLED Length of output: 10066 🏁 Script executed: #!/bin/bash
echo "=== Checking what changed in this PR (if git available) ==="
git log --oneline -1 2>/dev/null || echo "Git info not available"
echo ""
echo "=== Look at the specific lines mentioned in review (1163-1166) ==="
sed -n '1160,1170p' usermods/audioreactive/audio_reactive.cpp
echo ""
echo "=== Check broader pattern - all lines with CONFIG_IDF_TARGET_ESP32C3 in audio_reactive.cpp ==="
grep -n "CONFIG_IDF_TARGET_ESP32C3" usermods/audioreactive/audio_reactive.cppRepository: wled/WLED Length of output: 3096 🏁 Script executed: #!/bin/bash
echo "=== Check if ESP32-C6 is used in any other usermods ==="
find usermods -name "*.cpp" -o -name "*.h" | xargs grep -l "CONFIG_IDF_TARGET_ESP32C6" 2>/dev/null
echo ""
echo "=== Check main WLED code for C6 support patterns ==="
find wled00 -name "*.cpp" -o -name "*.h" | xargs grep -l "CONFIG_IDF_TARGET_ESP32C6" 2>/dev/null | head -10
echo ""
echo "=== Check if there are peripheral reset guards for C6 elsewhere ==="
rg "PERIPH_I2S0_MODULE" -A2 -B2 --max-count 10Repository: wled/WLED Length of output: 944 Add ESP32-C6 to all guards that exclude C3 and C5 in this file. The audioreactive usermod is inconsistent with itself: audio_source.h includes C6 guards, but audio_reactive.cpp does not. C6 is a RISC-V chip like C3/C5 and lacks the same peripherals (PERIPH_I2S0_MODULE reset, analog ADC over I2S, PDM support). Since C6 build support exists in platformio.ini and is properly guarded elsewhere in WLED, the missing C6 checks here will cause failures if someone enables audioreactive for C6. Add 🤖 Prompt for AI Agents |
||
| delay(100); // Give that poor microphone some time to setup. | ||
|
|
||
| useBandPassFilter = false; | ||
|
|
||
| #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) | ||
| #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) | ||
| if ((i2sckPin == I2S_PIN_NO_CHANGE) && (i2ssdPin >= 0) && (i2swsPin >= 0) && ((dmType == 1) || (dmType == 4)) ) dmType = 5; // dummy user support: SCK == -1 --means--> PDM microphone | ||
| #endif | ||
|
|
||
| switch (dmType) { | ||
| #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_ESP32C5) || defined(CONFIG_IDF_TARGET_ESP32S3) | ||
| // stub cases for not-yet-supported I2S modes on other ESP32 chips | ||
| case 0: //ADC analog | ||
| #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) | ||
| #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C5) | ||
| case 5: //PDM Microphone | ||
| #endif | ||
| #endif | ||
|
|
@@ -1204,7 +1204,7 @@ class AudioReactive : public Usermod { | |
| delay(100); | ||
| if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin, mclkPin); | ||
| break; | ||
| #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) | ||
| #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) | ||
| case 5: | ||
| DEBUGSR_PRINT(F("AR: I2S PDM Microphone - ")); DEBUGSR_PRINTLN(F(I2S_PDM_MIC_CHANNEL_TEXT)); | ||
| audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE, 1.0f/4.0f); | ||
|
|
@@ -1220,7 +1220,7 @@ class AudioReactive : public Usermod { | |
| if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin, mclkPin); | ||
| break; | ||
|
|
||
| #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_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32S3) | ||
| // ADC over I2S is only possible on "classic" ESP32 | ||
| case 0: | ||
| DEBUGSR_PRINTLN(F("AR: Analog Microphone (left channel only).")); | ||
|
|
@@ -1797,7 +1797,7 @@ class AudioReactive : public Usermod { | |
| top[FPSTR(_addPalettes)] = addPalettes; | ||
|
|
||
| #ifdef ARDUINO_ARCH_ESP32 | ||
| #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_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32S3) | ||
| JsonObject amic = top.createNestedObject(FPSTR(_analogmic)); | ||
| amic["pin"] = audioPin; | ||
| #endif | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
@@ -1856,16 +1856,16 @@ class AudioReactive : public Usermod { | |
| configComplete &= getJsonValue(top[FPSTR(_addPalettes)], addPalettes); | ||
|
|
||
| #ifdef ARDUINO_ARCH_ESP32 | ||
| #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_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32S3) | ||
| configComplete &= getJsonValue(top[FPSTR(_analogmic)]["pin"], audioPin); | ||
| #else | ||
| audioPin = -1; // MCU does not support analog mic | ||
| #endif | ||
|
|
||
| configComplete &= getJsonValue(top[FPSTR(_digitalmic)]["type"], dmType); | ||
| #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_ESP32C5) || defined(CONFIG_IDF_TARGET_ESP32S3) | ||
| if (dmType == 0) dmType = SR_DMTYPE; // MCU does not support analog | ||
| #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) | ||
| #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C5) | ||
| if (dmType == 5) dmType = SR_DMTYPE; // MCU does not support PDM | ||
| #endif | ||
| #endif | ||
|
|
@@ -1903,14 +1903,14 @@ class AudioReactive : public Usermod { | |
| #ifdef ARDUINO_ARCH_ESP32 | ||
| uiScript.print(F("uxp=ux+':digitalmic:pin[]';")); // uxp = shortcut for AudioReactive:digitalmic:pin[] | ||
| uiScript.print(F("dd=addDropdown(ux,'digitalmic:type');")); | ||
| #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_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32S3) | ||
| uiScript.print(F("addOption(dd,'Generic Analog',0);")); | ||
| #endif | ||
| uiScript.print(F("addOption(dd,'Generic I2S',1);")); | ||
| uiScript.print(F("addOption(dd,'ES7243',2);")); | ||
| uiScript.print(F("addOption(dd,'SPH0654',3);")); | ||
| uiScript.print(F("addOption(dd,'Generic I2S with Mclk',4);")); | ||
| #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) | ||
| #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) | ||
| uiScript.print(F("addOption(dd,'Generic I2S PDM',5);")); | ||
| #endif | ||
| uiScript.print(F("addOption(dd,'ES8388',6);")); | ||
|
|
@@ -1946,7 +1946,7 @@ class AudioReactive : public Usermod { | |
| uiScript.print(F("addInfo(uxp,0,'<i>sd/data/dout</i>','I2S SD');")); | ||
| uiScript.print(F("addInfo(uxp,1,'<i>ws/clk/lrck</i>','I2S WS');")); | ||
| uiScript.print(F("addInfo(uxp,2,'<i>sck/bclk</i>','I2S SCK');")); | ||
| #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_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32S3) | ||
| uiScript.print(F("addInfo(uxp,3,'<i>only use -1, 0, 1 or 3</i>','I2S MCLK');")); | ||
| #else | ||
| uiScript.print(F("addInfo(uxp,3,'<i>master clock</i>','I2S MCLK');")); | ||
|
|
@@ -2069,7 +2069,7 @@ const char AudioReactive::_config[] PROGMEM = "config"; | |
| const char AudioReactive::_dynamics[] PROGMEM = "dynamics"; | ||
| const char AudioReactive::_frequency[] PROGMEM = "frequency"; | ||
| const char AudioReactive::_inputLvl[] PROGMEM = "inputLevel"; | ||
| #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) | ||
| #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32S3) | ||
| const char AudioReactive::_analogmic[] PROGMEM = "analogmic"; | ||
| #endif | ||
| const char AudioReactive::_digitalmic[] PROGMEM = "digitalmic"; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ToDO: this is a temporary hack - the root cause is solved in the latest pioarduino (and tasmota, too?). Remember to revert this change once we upgrade to latest platform packages.