Skip to content

🚀 Add new MCU support (C6 and C5) to the ESP-IDF V5 builds#5048

Open
netmindz wants to merge 149 commits intoV5from
V5-C6
Open

🚀 Add new MCU support (C6 and C5) to the ESP-IDF V5 builds#5048
netmindz wants to merge 149 commits intoV5from
V5-C6

Conversation

@netmindz
Copy link
Copy Markdown
Member

@netmindz netmindz commented Nov 8, 2025

C6 needs the newer ESP-IDF, so have one branch for those changes and keep this one just for the C6 specific things

Building on top of V5

Inspired by C6 Experiments

Help Us with Testing

If you own a C6 or C5 board, we like to hear from your experiences! Basic functions are working on our dev boards, but any problem you find will help us stabilize the C5/C6 versions faster. If you find an error, please create an issue ticket (bug report).

Important: Our V5 Branch is Experimental (early stage of development)

  • Firmare you find here is absolutely not suitable for "production" use
  • Basic functions are working already
  • Make sure you have access to USB, to recover a boot-looping device if necessary
  • Expect bugs, expect flickering LEDs
  • Some features had to be disabled temporarily, because they still don't build with the new framework
  • analog LEDs not working yet
  • OTA update is not yet possible on some boards
  • Ethernet support is totally untested
  • Some Usermods still don't compile
  • Audioreactive is not ported yet
  • DMX serial is not ported yet

You can find a summary of currently open ends here (open ends for C5, C6), here (modernization opportunities) and here (generic problems with V5).

Using Development Tools (VSCode) - recommended

You can build your own C5 or C6 firmware using our standard development environment (VSCode+platformio) on your own computer. Use Platformio "upload and monitor" to write firmware to your board.

image

Experimental Binaries

In case you are not feeling comfortable using development tools, you can find some firmware binaries that are automatically created by GitHub after each commit.

  • scroll down to the box "All checks have passed"
  • expand the box with the icon on the right side
  • click on a build that matches your board, for example WLED CI / wled_build / Build Environments (esp32c6dev_4MB) (push)
  • click on "Summary"
  • scroll down until you see "Artifacts"
  • download the firmware.bin for your board
image image

Help Us with Coding

Helpful information and migration guidance

coding guides

We should make sure that the "V5" branch will still compile for "V4" as a backup solution.
When adding code that only works in the new framework, it should be conditionally compiled, like in the examples below

  • "V5" code only for esp32-P4 or esp32-C6:
 #if defined(CONFIG_IDF_TARGET_ESP32C6)
    // https://docs.espressif.com/projects/esp-idf/en/latest/esp32c6/api-reference/peripherals/gpio.html
    // strapping pins: 4, 5, 8, 9
    if (gpio > 11 && gpio < 14) return false;     // 12-13 USB-JTAG
    if (gpio > 23 && gpio < 31) return false;     // 24-30 SPI FLASH
#elif defined(CONFIG_IDF_TARGET_ESP32P4)
    // strapping pins: 34,35,36,37,38
    if (             gpio <   2) return false;     // NC
    if (gpio > 13 && gpio <  20) return false;     // ESP-Hosted WiFi pins
    if (gpio > 23 && gpio <  26) return false;     // USB Pins
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
  // .... existing code
#else
  // .... existing code
#endif
  • "V5" code that is not specific to new boards
    #if defined(ESP_IDF_VERSION) && (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0))
      ledcAttach(pwmPin, 25000, 8);  // New API: ledcAttach(pin, freq, resolution)
    #else
      ledcSetup(pwmChannel, 25000, 8);
      // attach the channel to the GPIO to be controlled
      ledcAttachPin(pwmPin, pwmChannel);
    #endif

related


Here's the comprehensive summary of open points for the C6/C5/P4 port, organized by WLED feature area:

📋 Open Points Summary for ESP32-C6/C5/P4 Support

🌐 Networking

NTP

  • ESP32-C5: crashes when user enables NTP (network time) (comment)

OTA Updates

  • ESP32-C6: Not supported yet (comment)

    • Error: "ESP32-C6 update not supported yet" (wled00/ota_update.cpp:433)
    • Action needed: Implement bootloader validation logic
  • ESP32-P4: MAC address retrieval fails (comment)

    • Error: E (27) system_api: 0 mac type is incorrect (not found)
    • Proposed solution: Use esp_wifi_remote_get_mac() from esp_wifi_remote_api.h (see esp-idf#16251)

ESP-NOW

  • 🔧 ESP32-C6: Temporarily disabled (platformio.ini:477, 482)
    • Comment: "ToDO: temporarily disabled, until we find a solution for esp-now build errors with -C6"
    • Action needed: Investigate and resolve C6-specific build errors

MQTT

  • 🔧 V5 (all boards): Disabled pending library updates (platformio.ini:229, 251, 341)
    • Comment: "TODO: remove once we have updated library for V5"

💡 LED Drivers

NeoPixelBus

  • ESP32-C5: Critical RMT channel bug (comment, analysis)

    • Bug: Constructor ignores channel parameter, causing second WS2812B output to fail
    • Root cause: Driver doesn't use WLED's channel parameter; rmt_new_tx_channel() allocates channels without TX capability validation
    • Impact: Only 1 digital output works on C5 (should support 2 TX channels)
    • Action needed: @jonny190 to fix NeoPixelBus fork (lines 70-122 in NeoEsp32RmtXMethod.h)
    • Temporary workaround: Limit C5 to 1 digital output in const.h
  • 🔧 ESP32-C5: Custom fork maintenance (platformio.ini:412-418)

NeoEsp32RmtHI

  • 🔧 V5 (all ESP32): Check if still needed (platformio.ini:339, 680, 684)
    • Comment: "ToDO: check if NeoESP32RmtHI is still needed with V5 (see discussion in PR#4838)"
    • Currently ignored in C6 builds

🎛️ Hardware Features

Infrared (IR)

  • 🔧 V5 (all boards): Disabled pending library updates
    • Locations: platformio.ini:175, 230, 340, 594, 645, 658, 679
    • Library: IRremoteESP8266 @ 2.8.2
    • Comment: "TODO: remove once we have updated library for V5" / "TODO: add back"
    • Build flag: -D WLED_DISABLE_INFRARED

DMX

  • ESP32-C5 Input: Not supported (platformio.ini:422)

    • esp_dmx library doesn't support C5 UART registers
    • Library explicitly ignored for C5
  • 🔧 V4 regression test: Compile errors (platformio.ini:675, 685-686)

    • Comment: "TODO: fix lots of compile errors in dmx_input.cpp"

PWM/LEDC (Analog LEDs)

  • V5 (all boards): LEDC API breaking changes (discussion, analysis)
    • Breaking changes:
      • Clock source: C5/C6/P4 require LEDC_USE_PLL_DIV_CLK (no APB clock)
      • Channel count: 6 on C3/C5/C6 (vs 8 on others)
      • Duty field: P4 changed to duty_r.duty_r, C5 duty range is now inclusive
      • High-speed mode: Only classic ESP32 supports it
    • Impact: Direct LEDC struct access in bus_manager.cpp (lines 549-556) won't work with V5
    • Action needed: Complete rewrite using HAL API calls (see comment for detailed strategy)
    • Related PR: #4838

🎨 Effects & Usermods

Audio Reactive

  • 🔧 V5: Not yet compatible (platformio.ini:141)
    • Comment: "TODO: add back audioreactive once V5 compatible"

Usermods (General)

  • 🔧 V5: Disabled until core stable (platformio.ini:41, 952)
    • Comment: "TODO: disabled until the core is building" / "ToDO: fix usermods build once the main V5 build works without errors and warnings"

🏗️ Build & Configuration

S2/S3 Special Flash Boards

  • 🔧 Multiple S2/S3 variants: NeoEsp32RmtMethodIsr disabled (platformio.ini:28, 32-40)
    • Affected: lolin_s2_mini, esp32s3dev_16MB_opi, esp32s3dev_8MB_opi, esp32s3dev_8MB_qspi, esp32s3_4M_qspi, esp32S3_wroom2
    • Comment: "TODO: disabled NeoEsp32RmtMethodIsr"

Chip Identification

  • 🔧 UI: Rework chip detection in settings_leds.htm (comment)
    • Current: Guesses chip type from parameters (lines 66-71)
    • Action needed: Use direct chip info string (similar to appendGPIOinfo in xml.cpp:95)

🔧 Code Quality & Modernization

Deprecated APIs

  • ⚠️ Legacy ADC/DAC: Migration needed for IDF V5 compatibility

    • Migrate to esp_adc/adc_oneshot.h and driver/dac_oneshot.h
    • Multiple warnings in build logs
  • ⚠️ NetworkUDP (Espalexa.h:382)

    • Warning: 'virtual void NetworkUDP::flush()' is deprecated: Use clear() instead
    • Fix: Replace flush() with clear()
    • Repeated 15+ times

Global Variable Declarations

  • ⚠️ Missing extern declarations (comment)
    • Timezone* tz (ntp.cpp:14) — used in util.cpp, cfg.cpp
    • decode_results results (ir.cpp:11) — used in wled.cpp, json.cpp, colors.cpp, FXparticleSystem.cpp
    • uint32_t lastValidCode (ir.cpp:13) — used in remote.cpp
    • Action needed: Add extern declarations to appropriate headers

Completed/Verified

  • Chip-specific guards simplification (proposed, verified)
    • wled_boards.h centralized capability defines added
    • Verification confirmed all conditions preserved correctly

📊 Priority Summary

Priority Count Items
Critical 3 OTA (C6), NeoPixelBus RMT bug (C5), LEDC API rewrite (V5)
High 4 ESP-NOW (C6), P4 MAC address, IR (V5), Audio (V5)
Medium 8 MQTT, DMX, NeoEsp32RmtHI check, Usermods, Chip ID UI, Global declarations
Low 5 Code modernization warnings, S2/S3 flash boards

Total open items: 20


This summary will be continuously updated as issues are resolved. Items marked ✅ are completed; 🔧 are in progress; ❌ are blockers; ⚠️ are technical debt.


Summary by CodeRabbit

Release Notes

  • New Features

    • Added WiFi band mode selection (2.4 GHz, 5 GHz, Auto) for compatible devices
    • Added WiFi channel display in connection information
    • Extended maximum TX power options in WiFi settings
    • Support for new ESP32 hardware variants (C5, C6, C61, P4)
  • Bug Fixes

    • Improved WiFi scanning and connection validation logic
    • Fixed bounds checking in network configuration
  • Configuration

    • Added build configurations for new ESP32 board variants
    • Updated device version to 17.0.0-devV5

netmindz and others added 3 commits November 8, 2025 13:33
due to Arduino 3.0.1, a few updated libraries are required:
* Tasmota Platform - official platfomio lacks arduino support for C6
* FastLED (latest + C6 build patches)
* AsyncTCP (latest + C6 build patches)
* AsyncWebServer (latest + C6 build patches)
* NeoPixelBus (lastest)
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 8, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7c25750e-52dc-4c2c-a8e2-862526685daf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds ESP32-C5 and ESP32-C6 build environments and PlatformIO config; expands many CONFIG_IDF_TARGET_* guards across sources so C5/C6 (and P4) are treated like C3 for I2S/touch/PSRAM/DMX/pin-safety and other platform-specific logic.

Changes

Cohort / File(s) Summary
PlatformIO / build environments
platformio.ini
Adds [esp32c6] and [esp32c5] generic sections, multiple new envs (esp32c6dev_8MB/4MB, esp32c5dev, qspi variants), default_envs update, per-env partitions/flash/memory hints, and lib_deps note for patched FastLED.
Bus / I2S / PWM / RMT
wled00/bus_wrapper.h, wled00/bus_manager.cpp, wled00/FX_fcn.cpp, wled00/FX.h
Expanded preprocessor guards to include ESP32C5/C6/P4 alongside C3; disabled parallel I2S paths on those targets; added C5-specific LEDC duty register access; adjusted dithering/LEDC mutex and esp32RMTInvertIdle early-returns.
Touch / Buttons / Pin safety
wled00/button.cpp, wled00/pin_manager.cpp
Touch/button guards extended to exclude ESP32C5/C6/P4; added per-target pin-safety rules (SPI flash / USB-JTAG reserved GPIO ranges) for ESP32C5 and ESP32C6.
PSRAM / allocation / constants
wled00/util.cpp, wled00/const.h
Broadened PSRAM and allocation guards to include C3/C5/C6/P4 (and others); aligned MAX_LEDS/MAX_LED_MEMORY and WLED_MAX_DIGITAL_CHANNELS for C5/C6 with C3.
Config / JSON / OTA / network
wled00/cfg.cpp, wled00/json.cpp, wled00/ota_update.cpp, wled00/network.cpp, wled00/udp.cpp
Gated parallel-I2S flags for C5/C6/P4; serializeInfo sets arch="esp32" for CONFIG_IDF_TARGET_ESP32; added wifi channel/band (5GHz detection) and UDP node-type handling for C5/C6; added explicit ESP32-C5 bootloader chip-id checks and blocks updates.
DMX / dependencies
wled00/dmx_output.cpp, wled00/src/dependencies/dmx/*
Added ESP32C5 to DMX init/preprocessor guards so DMX code compiles/initializes for C5 alongside existing targets.
Audio / FX / particle systems / UI
usermods/audioreactive/audio_reactive.cpp, wled00/FXparticleSystem.cpp, wled00/data/index.js, wled00/FX_fcn.cpp
Extended guards to include C5/C6 for audio/I2S/PDM branches and FX fast-paths; updated UI device mapping to recognize ESP32-C5/C6; added WiFi band row in UI JSON rendering.
Build scripts / metadata / tooling
pio-scripts/set_metadata.py, .vscode/extensions.json
set_metadata now injects CPPDEFINES into env in-place and prints debug info (repo, WLED_VERSION); VSCode recommendations updated to include PlatformIO Arduino extension.
Misc / small fixes
wled00/wled.cpp, wled00/wled.h, wled00/set.cpp, wled00/mbedtls_sha1_shim.cpp, wled00/NodeStruct.h, wled00/improv.cpp, wled00/data/index.js, wled00/udp.cpp
MAC fallback via esp_read_mac for ESP32, added C5 5GHz logging, widened RX/TX/config guards to include C5/C6/P4, narrowed mbedTLS shim IDF gate, EOF newline fix, and a small bounds-check change in findWiFi.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • netmindz
  • willmmiles
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main objective: adding ESP32-C6 and ESP32-C5 MCU support to ESP-IDF V5 builds. It is specific, clear, and directly reflects the primary changes throughout the changeset.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch V5-C6

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 and usage tips.

Comment thread platformio.ini Outdated
Comment on lines +14 to +28
;nodemcuv2
;esp8266_2m
;esp01_1m_full
;nodemcuv2_160
;esp8266_2m_160
;esp01_1m_full_160
;nodemcuv2_compat
;esp8266_2m_compat
;esp01_1m_full_compat
;esp32dev
;esp32dev_debug
;esp32_eth
;esp32_wrover
; lolin_s2_mini ;; TODO: disabled NeoEsp32RmtMethodIsr
esp32c3dev
;esp32c3dev
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

TODO: revert before merge, here to save CI build time

@netmindz
Copy link
Copy Markdown
Member Author

netmindz commented Nov 8, 2025

@softhack007 I've started trying to cherry-pick your changes over, quite a few don't apply due to the changes with MM, but I'll try and resolve the merge conflicts for those that are simple

* more debug output
* added my own fork of FastLED ( looks like more bugs to solve ....)
Comment thread platformio.ini
@softhack007
Copy link
Copy Markdown
Member

@softhack007 I've started trying to cherry-pick your changes over, quite a few don't apply due to the changes with MM, but I'll try and resolve the merge conflicts for those that are simple

@netmindz thanks, I'll try to help once I'm finished with some open ends in WLED-MM 😁 december

@netmindz
Copy link
Copy Markdown
Member Author

netmindz commented Nov 8, 2025

Possibly also worth looking at #4626 to see if there are any changes there that are helpful

@softhack007 softhack007 added this to the 0.17.0 milestone Nov 18, 2025
@softhack007 softhack007 mentioned this pull request Nov 18, 2025
13 tasks
@netmindz

This comment was marked as resolved.

@softhack007

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@softhack007

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@wled wled deleted a comment from coderabbitai bot Mar 27, 2026
* mbedtls_sha1_... functions have different names
* use CONFIG_SOC_ADC_RTC_MAX_BITWIDTH
* legacy adc calibration API is not supported on new MCUs (-C5, -C6, -C61, -P4)
coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@softhack007

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@softhack007

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@coderabbitai

This comment was marked as duplicate.

show "not connected" instead of "unknown"
coderabbitai[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
usermods/audioreactive/audio_reactive.cpp (1)

1377-1440: ⚠️ Potential issue | 🟡 Minor

Mirror the new C5 analog/PDM exclusions in audio_source.h line 8.

The .cpp file excludes CONFIG_IDF_TARGET_ESP32C5 from analog mic (line 1424) and PDM (lines 1377, 1411) support. However, audio_source.h line 8 still includes the deprecated ADC headers for C5:

`#if` !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32C3)
`#include` <driver/adc_deprecated.h>
`#include` <driver/adc_types_deprecated.h>
`#endif`

Add && !defined(CONFIG_IDF_TARGET_ESP32C5) to this guard to prevent the header mismatch.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@usermods/audioreactive/audio_reactive.cpp` around lines 1377 - 1440, The
preprocessor guard in audio_source.h still allows including deprecated ADC
headers for ESP32C5 even though audio_reactive.cpp excludes
CONFIG_IDF_TARGET_ESP32C5 for ADC/PDM; update the `#if` that currently reads `#if`
!defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32S3) &&
!defined(CONFIG_IDF_TARGET_ESP32C3) to also exclude CONFIG_IDF_TARGET_ESP32C5 so
the includes for <driver/adc_deprecated.h> and <driver/adc_types_deprecated.h>
are skipped on C5, matching the behavior in audio_reactive.cpp and the switch
cases (functions/classes referenced: audioSource initialization, I2SAdcSource,
I2SSource, and the CONFIG_IDF_TARGET_ESP32C5 macro).
🧹 Nitpick comments (6)
wled00/dmx_output.cpp (1)

72-75: This C5/C6/C61 branch is currently dead code.

wled00/wled.h still hard-stops DMX builds for these targets before the DMX headers are included, so extending this condition does not affect current behavior. I’d either key this off the same centralized capability macro or leave only the actually supported targets here to keep the DMX support matrix in one place.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wled00/dmx_output.cpp` around lines 72 - 75, The preprocessor branch around
dmx.init/dmx.initWrite uses ESP32C3/C5/C6/C61 macros that are currently dead
because the upstream DMX include is prevented for those targets; update the
conditional to use the centralized DMX capability macro (the same one used in
wled.h) or else remove the unsupported target macros and only keep the targets
that actually enable DMX today; edit the block containing dmx.init and
dmx.initWrite so it references that central capability macro (or the minimal set
of supported target macros) to keep the DMX support matrix consistent (symbols
to look for: dmx.init, dmx.initWrite and the existing preprocessor condition
around them).
usermods/audioreactive/audio_source.h (1)

25-32: If these MCUs are intentionally unsupported, fail the build instead of warning.

On targets with SOC_I2S_NUM >= 1, this still compiles the usermod after a #warning, even though the message says the MCU is unsupported. If the plan is to keep C5/C6/C61 disabled until the port is validated, switch the warning path to #error or guard the usermod out earlier.

⚙️ Small tightening
-  `#warning` This audio reactive usermod does not support your MCU yet.
+  `#error` This audio reactive usermod does not support your MCU yet.

Based on learnings: failing fast at compile time is preferred over allowing potentially broken builds until a full refactor is completed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@usermods/audioreactive/audio_source.h` around lines 25 - 32, The `#warning`
path currently allows compilation for targets matching the MCU list when
SOC_I2S_NUM >= 1 despite being unsupported; change the logic in audio_source.h
so that the unsupported MCU branch fails the build instead of emitting a
warning—replace the `#warning` with `#error` (or move the entire unsupported-MCU
check earlier) so that targets matched by the conditionals (the block using
CONFIG_IDF_TARGET_ESP32C2 / ESP32C5 / ESP32C6 / ESP32C61 / ESP32H2 / ESP8266 /
ESP8265 and the SOC_I2S_NUM check) cause a compile-time error, preventing the
usermod from being built on those MCUs until a validated port exists.
wled00/pin_manager.cpp (2)

257-277: Keep the P4 connector mask separate from the MCU-wide validity rules.

Most isPinOk() branches only reject silicon-reserved pins, but this one also rejects pins just because they are not exposed on one specific board. Since the guard is CONFIG_IDF_TARGET_ESP32P4, any other P4 board definition will inherit those DevKit-specific exclusions too. A board-level mask/table would age better than hardcoding connector availability in the MCU path.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wled00/pin_manager.cpp` around lines 257 - 277, The CONFIG_IDF_TARGET_ESP32P4
block in isPinOk() mixes MCU-reserved pins with board-specific (DevKit P4
connector) exclusions (e.g., gpio==9, ranges >13&&<20, >23&&<26, >27&&<32,
>33&&<36, >38&&<45, >48&&<53, gpio==54); extract those connector-specific checks
out of the CONFIG_IDF_TARGET_ESP32P4 branch and implement a separate board-level
connector mask/table (e.g., isPinOnP4Connector() or p4_connector_mask[]) that is
applied only for the specific DevKit board build/config, leaving the MCU-wide
silicon-reserved checks in the existing CONFIG_IDF_TARGET_ESP32P4 code path and
calling the new board-level filter from isPinOk() where board definitions are
handled.

415-427: Update the function comment to match the new ADC2 behavior.

After this change, Line 403 is no longer true for ESP32-S3 and the generic ADC2-capable path, because both can now return true for ADC2 pins. Keeping the comment in sync will prevent the next cleanup from “fixing” an intentional behavior. Based on learnings: the ADC2/WiFi hard block applies only to classic ESP32; S2/S3 and newer oneshot paths are expected to stay enabled.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wled00/pin_manager.cpp` around lines 415 - 427, Update the function comment
above the ADC-capability check (near where adc_channel is computed via
digitalPinToAnalogChannel) to reflect that ADC2 pins may now return true on
ESP32-S3 and on the generic ADC2-capable path; state that the ADC2/WiFi hard
block applies only to classic ESP32 (not S2/S3 or newer oneshot paths), and that
checks using SOC_ADC_CHANNEL_NUM, SOC_ADC_PERIPH_NUM and SOC_ADC_MAX_CHANNEL_NUM
can legitimately allow ADC2 channels to be treated as usable. Ensure the comment
mentions the specific behavior for ESP32-S3 (channels 0-9) and the generic
branch logic that permits ADC2 channels to return true so future cleanups don’t
revert this intentional behavior.
wled00/wled_boards.h (1)

18-25: Consider turning the placeholder capability TODOs into named macros now.

This header is already the central capability map. Giving the RMT/DMX entries real names here would make it easier for new call sites to depend on a capability flag instead of spelling out target lists again.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wled00/wled_boards.h` around lines 18 - 25, Add concrete capability macro
definitions for the placeholder TODOs so callers can `#ifdef` on capability flags
instead of repeating target lists: define macros like WLED_HAVE_TOUCH,
WLED_HAVE_I2S0_LEDS, WLED_HAVE_I2S1_LEDS, WLED_ALLOW_LOLIN_WIFI_FIX, plus two
descriptive RMT/DMX capability macros (e.g., WLED_RMT_LIMITED_CHANNELS and
WLED_HAVE_SPARKFUN_DMX) in this central header; ensure each macro is
conditionally set based on existing platform macros used elsewhere (so code in
button.cpp, bus_wrapper.h, wled.h and dmx_output.cpp can simply `#ifdef`
WLED_HAVE_TOUCH / WLED_HAVE_I2S0_LEDS / WLED_HAVE_I2S1_LEDS /
WLED_RMT_LIMITED_CHANNELS / WLED_HAVE_SPARKFUN_DMX / WLED_ALLOW_LOLIN_WIFI_FIX).
wled00/wled.cpp (1)

552-557: Consider extracting WiFi band-mode application into a small helper.

The same setBandMode + failure log pattern appears in three places with only mode/context differences.

♻️ Proposed refactor
+#if defined(ARDUINO_ARCH_ESP32) && (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 2))
+static inline void applyWiFiBandMode(wifi_band_mode_t mode, const char* where) {
+  if (!WiFi.setBandMode(mode)) {
+    DEBUG_PRINTF_P(PSTR("%s: WiFi band configuration failed!\n"), where);
+  }
+}
+#endif
-  if (!WiFi.setBandMode(WIFI_BAND_MODE_AUTO)) {   // WIFI_BAND_MODE_AUTO = 5GHz+2.4GHz; WIFI_BAND_MODE_5G_ONLY, WIFI_BAND_MODE_2G_ONLY
-    DEBUG_PRINTLN(F("setup(): Wifi band configuration failed!\n"));
-  }
+  applyWiFiBandMode(WIFI_BAND_MODE_AUTO, "setup()");
-  if (!WiFi.setBandMode(WIFI_BAND_MODE_AUTO)) {
-    DEBUG_PRINTLN(F("initAP(): Wifi band configuration failed!\n"));
-  }
+  applyWiFiBandMode(WIFI_BAND_MODE_AUTO, "initAP()");
-      if (!WiFi.setBandMode((wifi_band_mode_t)wifiBandMode)) {
-        DEBUG_PRINTLN(F("initConnection(): WiFi band configuration failed!"));
-      }
+      applyWiFiBandMode((wifi_band_mode_t)wifiBandMode, "initConnection()");

Also applies to: 692-699, 787-791

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wled00/wled.cpp` around lines 552 - 557, Extract the repeated pattern that
calls WiFi.setBandMode(...) and logs failure into a small helper like
applyWifiBandMode(mode, context) that calls WiFi.setBandMode(mode), returns the
boolean result, and logs a contextual failure message with DEBUG_PRINTLN
(include the provided context string in the log). Replace the three duplicated
blocks that call WiFi.setBandMode(...) followed by DEBUG_PRINTLN(F("... Wifi
band configuration failed!\n")) with calls to applyWifiBandMode(...) passing the
appropriate WIFI_BAND_MODE_* value and a short context string (e.g., "setup", or
the specific init step) so the same behavior is preserved and code is
deduplicated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@platformio.ini`:
- Around line 32-33: The default_envs entry esp32p4_16MB is included without a
configured memory interface and must be removed from default_envs or explicitly
configured; either delete esp32p4_16MB from the default_envs list, or restore
and set board_build.arduino.memory_type = opi_hpi (and ensure the pinned
esp32-p4-evboard.json platform/package supports that memory_type) so CI builds
succeed for that target.

---

Outside diff comments:
In `@usermods/audioreactive/audio_reactive.cpp`:
- Around line 1377-1440: The preprocessor guard in audio_source.h still allows
including deprecated ADC headers for ESP32C5 even though audio_reactive.cpp
excludes CONFIG_IDF_TARGET_ESP32C5 for ADC/PDM; update the `#if` that currently
reads `#if` !defined(CONFIG_IDF_TARGET_ESP32S2) &&
!defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32C3) to
also exclude CONFIG_IDF_TARGET_ESP32C5 so the includes for
<driver/adc_deprecated.h> and <driver/adc_types_deprecated.h> are skipped on C5,
matching the behavior in audio_reactive.cpp and the switch cases
(functions/classes referenced: audioSource initialization, I2SAdcSource,
I2SSource, and the CONFIG_IDF_TARGET_ESP32C5 macro).

---

Nitpick comments:
In `@usermods/audioreactive/audio_source.h`:
- Around line 25-32: The `#warning` path currently allows compilation for targets
matching the MCU list when SOC_I2S_NUM >= 1 despite being unsupported; change
the logic in audio_source.h so that the unsupported MCU branch fails the build
instead of emitting a warning—replace the `#warning` with `#error` (or move the
entire unsupported-MCU check earlier) so that targets matched by the
conditionals (the block using CONFIG_IDF_TARGET_ESP32C2 / ESP32C5 / ESP32C6 /
ESP32C61 / ESP32H2 / ESP8266 / ESP8265 and the SOC_I2S_NUM check) cause a
compile-time error, preventing the usermod from being built on those MCUs until
a validated port exists.

In `@wled00/dmx_output.cpp`:
- Around line 72-75: The preprocessor branch around dmx.init/dmx.initWrite uses
ESP32C3/C5/C6/C61 macros that are currently dead because the upstream DMX
include is prevented for those targets; update the conditional to use the
centralized DMX capability macro (the same one used in wled.h) or else remove
the unsupported target macros and only keep the targets that actually enable DMX
today; edit the block containing dmx.init and dmx.initWrite so it references
that central capability macro (or the minimal set of supported target macros) to
keep the DMX support matrix consistent (symbols to look for: dmx.init,
dmx.initWrite and the existing preprocessor condition around them).

In `@wled00/pin_manager.cpp`:
- Around line 257-277: The CONFIG_IDF_TARGET_ESP32P4 block in isPinOk() mixes
MCU-reserved pins with board-specific (DevKit P4 connector) exclusions (e.g.,
gpio==9, ranges >13&&<20, >23&&<26, >27&&<32, >33&&<36, >38&&<45, >48&&<53,
gpio==54); extract those connector-specific checks out of the
CONFIG_IDF_TARGET_ESP32P4 branch and implement a separate board-level connector
mask/table (e.g., isPinOnP4Connector() or p4_connector_mask[]) that is applied
only for the specific DevKit board build/config, leaving the MCU-wide
silicon-reserved checks in the existing CONFIG_IDF_TARGET_ESP32P4 code path and
calling the new board-level filter from isPinOk() where board definitions are
handled.
- Around line 415-427: Update the function comment above the ADC-capability
check (near where adc_channel is computed via digitalPinToAnalogChannel) to
reflect that ADC2 pins may now return true on ESP32-S3 and on the generic
ADC2-capable path; state that the ADC2/WiFi hard block applies only to classic
ESP32 (not S2/S3 or newer oneshot paths), and that checks using
SOC_ADC_CHANNEL_NUM, SOC_ADC_PERIPH_NUM and SOC_ADC_MAX_CHANNEL_NUM can
legitimately allow ADC2 channels to be treated as usable. Ensure the comment
mentions the specific behavior for ESP32-S3 (channels 0-9) and the generic
branch logic that permits ADC2 channels to return true so future cleanups don’t
revert this intentional behavior.

In `@wled00/wled_boards.h`:
- Around line 18-25: Add concrete capability macro definitions for the
placeholder TODOs so callers can `#ifdef` on capability flags instead of repeating
target lists: define macros like WLED_HAVE_TOUCH, WLED_HAVE_I2S0_LEDS,
WLED_HAVE_I2S1_LEDS, WLED_ALLOW_LOLIN_WIFI_FIX, plus two descriptive RMT/DMX
capability macros (e.g., WLED_RMT_LIMITED_CHANNELS and WLED_HAVE_SPARKFUN_DMX)
in this central header; ensure each macro is conditionally set based on existing
platform macros used elsewhere (so code in button.cpp, bus_wrapper.h, wled.h and
dmx_output.cpp can simply `#ifdef` WLED_HAVE_TOUCH / WLED_HAVE_I2S0_LEDS /
WLED_HAVE_I2S1_LEDS / WLED_RMT_LIMITED_CHANNELS / WLED_HAVE_SPARKFUN_DMX /
WLED_ALLOW_LOLIN_WIFI_FIX).

In `@wled00/wled.cpp`:
- Around line 552-557: Extract the repeated pattern that calls
WiFi.setBandMode(...) and logs failure into a small helper like
applyWifiBandMode(mode, context) that calls WiFi.setBandMode(mode), returns the
boolean result, and logs a contextual failure message with DEBUG_PRINTLN
(include the provided context string in the log). Replace the three duplicated
blocks that call WiFi.setBandMode(...) followed by DEBUG_PRINTLN(F("... Wifi
band configuration failed!\n")) with calls to applyWifiBandMode(...) passing the
appropriate WIFI_BAND_MODE_* value and a short context string (e.g., "setup", or
the specific init step) so the same behavior is preserved and code is
deduplicated.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d67c3ad0-944a-4b0a-b652-4318d6e3cdb2

📥 Commits

Reviewing files that changed from the base of the PR and between 9232bd4 and 7193790.

📒 Files selected for processing (31)
  • platformio.ini
  • usermods/audioreactive/audio_reactive.cpp
  • usermods/audioreactive/audio_source.h
  • wled00/FX.h
  • wled00/FX_fcn.cpp
  • wled00/FXparticleSystem.cpp
  • wled00/bus_manager.cpp
  • wled00/bus_wrapper.h
  • wled00/button.cpp
  • wled00/cfg.cpp
  • wled00/const.h
  • wled00/data/index.js
  • wled00/data/settings_wifi.htm
  • wled00/dmx_output.cpp
  • wled00/fcn_declare.h
  • wled00/improv.cpp
  • wled00/json.cpp
  • wled00/network.cpp
  • wled00/ota_update.cpp
  • wled00/pin_manager.cpp
  • wled00/set.cpp
  • wled00/src/dependencies/dmx/ESPDMX.cpp
  • wled00/src/dependencies/dmx/SparkFunDMX.cpp
  • wled00/udp.cpp
  • wled00/util.cpp
  • wled00/wled.cpp
  • wled00/wled.h
  • wled00/wled_boards.h
  • wled00/wled_metadata.cpp
  • wled00/ws.cpp
  • wled00/xml.cpp
✅ Files skipped from review due to trivial changes (3)
  • wled00/ota_update.cpp
  • wled00/data/index.js
  • wled00/src/dependencies/dmx/ESPDMX.cpp
🚧 Files skipped from review as they are similar to previous changes (13)
  • wled00/improv.cpp
  • wled00/src/dependencies/dmx/SparkFunDMX.cpp
  • wled00/network.cpp
  • wled00/FXparticleSystem.cpp
  • wled00/button.cpp
  • wled00/set.cpp
  • wled00/FX_fcn.cpp
  • wled00/util.cpp
  • wled00/wled.h
  • wled00/cfg.cpp
  • wled00/json.cpp
  • wled00/bus_wrapper.h
  • wled00/const.h

Comment thread platformio.ini
* removed unnecessary arduino.memory_type
* removed board_build.f_cpu (set in board manifest.json)
* added example debug flags
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
wled00/FX_fcn.cpp (1)

1166-1186: ⚠️ Potential issue | 🟠 Major

Use assigned iType (not requested driverType) for I2S DMA estimation.

Line 1166-Line 1186 infer useParallelI2S from requested driverType, and Line 1205 treats I_NONE (0) as I2S due to parity. This can overestimate DMA memory and trip the placeholder path at Line 1217 for configs that didn’t actually get I2S.

🔧 Suggested fix
-  // validate the bus config: count I2S buses and check if they meet requirements
-  unsigned i2sBusCount = 0;
-
-  for (const auto &bus : busConfigs) {
-    if (Bus::isDigital(bus.type) && !Bus::is2Pin(bus.type)) {
-      digitalCount++;
-      if (bus.driverType == 1)
-        i2sBusCount++;
-    }
-  }
-  DEBUG_PRINTF_P(PSTR("Digital buses: %u, I2S buses: %u\n"), digitalCount, i2sBusCount);
-
-  // Determine parallel vs single I2S usage (used for memory calculation only)
-  bool useParallelI2S = false;
-  `#if` defined(CONFIG_IDF_TARGET_ESP32S3)
-  // ESP32-S3 always uses parallel LCD driver for I2S
-  if (i2sBusCount > 0) {
-    useParallelI2S = true;
-  }
-  `#else`
-  if (i2sBusCount > 1) {
-    useParallelI2S = true;
-  }
-  `#endif`
+  // Determine bus iType first; memory sizing must use assigned drivers.
+  for (auto &bus : busConfigs) {
+    bus.iType = BusManager::getI(bus.type, bus.pins, bus.driverType);
+  }
+
+  unsigned i2sBusCount = 0;
+  for (const auto &bus : busConfigs) {
+    if (Bus::isDigital(bus.type) && !Bus::is2Pin(bus.type)) {
+      digitalCount++;
+      if (bus.iType != I_NONE && ((bus.iType & 0x01) == 0)) i2sBusCount++;
+    }
+  }
+  DEBUG_PRINTF_P(PSTR("Digital buses: %u, I2S buses: %u\n"), digitalCount, i2sBusCount);
+
+  bool useParallelI2S = false;
+  `#if` defined(CONFIG_IDF_TARGET_ESP32S3)
+  useParallelI2S = (i2sBusCount > 0);
+  `#else`
+  useParallelI2S = (i2sBusCount > 1);
+  `#endif`
...
-  for (auto &bus : busConfigs) {
-    // assign bus types: call to getI() determines bus types/drivers, allocates and tracks polybus channels
-    // store the result in iType for later use during bus creation (getI() must only be called once per BusConfig)
-    // note: this needs to be determined for all buses prior to creating them as it also determines parallel I2S usage
-    bus.iType = BusManager::getI(bus.type, bus.pins, bus.driverType);
-  }
   for (auto &bus : busConfigs) {
...
-    bool usesI2S = (bus.iType & 0x01) == 0; // I2S bus types are even numbered, can't use bus.driverType == 1 as getI() may have defaulted to RMT
+    bool usesI2S = (bus.iType != I_NONE) && ((bus.iType & 0x01) == 0); // I2S bus types are even numbered

Based on learnings: In WLED, both parallel I2S and single I2S modes require DMA accounting based on which buses actually use I2S hardware.

Also applies to: 1193-1206, 1213-1217

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wled00/FX_fcn.cpp` around lines 1166 - 1186, The code currently increments
i2sBusCount based on the requested driverType; instead use the bus's assigned
iType (the actual instantiated driver) when determining I2S usage so DMA memory
is estimated only for buses that truly use I2S hardware—update the loop over
busConfigs (and the other occurrences noted around the blocks at 1193-1206 and
1213-1217) to check bus.iType against the I2S types (not bus.driverType or
I_NONE parity) when incrementing i2sBusCount and when computing useParallelI2S,
leaving the ESP32-S3 conditional logic intact but driven by assigned iType.
♻️ Duplicate comments (1)
wled00/wled.cpp (1)

492-501: ⚠️ Potential issue | 🟡 Minor

Handle esp_read_mac() failure before deriving escapedMac.

At Line 495 / Line 497, esp_read_mac() return values are ignored. If the call fails, escapedMac can still be overwritten from zeroed bytes, which risks non-unique identity values (AP SSID/topic suffixes).

Suggested patch
   if (escapedMac == "000000000000") {
     uint8_t mac[6] = {0};
+    esp_err_t macErr = ESP_FAIL;
     `#if` defined(CONFIG_IDF_TARGET_ESP32P4)  // P4 does not have on-chip WIFI, use ethernet MAC
-      esp_read_mac(mac, ESP_MAC_ETH);
+      macErr = esp_read_mac(mac, ESP_MAC_ETH);
     `#else`
-      esp_read_mac(mac, ESP_MAC_WIFI_STA);
+      macErr = esp_read_mac(mac, ESP_MAC_WIFI_STA);
     `#endif`
-    char buf[13];
-    sprintf(buf, "%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
-    escapedMac = buf;
+    if (macErr == ESP_OK) {
+      char buf[13];
+      snprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+      escapedMac = buf;
+    } else {
+      DEBUG_PRINTF_P(PSTR("esp_read_mac failed: %d\n"), macErr);
+    }
   }
#!/bin/bash
# Verify esp_read_mac result handling in the current tree
sed -n '488,503p' wled00/wled.cpp
echo "----"
rg -n 'esp_read_mac\s*\(' wled00/wled.cpp -C2
echo "----"
rg -n '=\s*esp_read_mac\s*\(' wled00/wled.cpp -C2

# Expected:
# - Each esp_read_mac(...) call is assigned to esp_err_t
# - A subsequent check for ESP_OK exists before formatting/assigning escapedMac
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wled00/wled.cpp` around lines 492 - 501, The esp_read_mac() return value is
ignored, so escapedMac may be derived from a zero MAC; modify the block that
calls esp_read_mac(...) to store its return into an esp_err_t (or int) result,
check that the result equals ESP_OK before using the mac[] buffer and formatting
into escapedMac, and on failure skip assigning escapedMac (or log/handle the
error) so we do not overwrite escapedMac with a zero MAC; update the branch
containing esp_read_mac(...), the local mac[] and sprintf into buf, and the
assignment escapedMac = buf to only occur after the ESP_OK check.
🧹 Nitpick comments (2)
wled00/pin_manager.cpp (1)

239-255: Make the USB/JTAG pin guard independent of board-package defaults.

These branches only reserve the USB/JTAG pins when ARDUINO_USB_CDC_ON_BOOT or ARDUINO_USB_DFU_ON_BOOT evaluates to 1, but the new C5/C6 envs in platformio.ini only set the CDC flag and never define the DFU flag. That leaves the protection here partly controlled by external board.json defaults, so a platform package change can silently make GPIO 12/13/14 look user-assignable again. Please set both macros explicitly in the envs, or collapse this behind a repo-owned capability define.

Also applies to: 264-266

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wled00/pin_manager.cpp` around lines 239 - 255, The pin-guard currently
depends on external ARDUINO_USB_CDC_ON_BOOT/ARDUINO_USB_DFU_ON_BOOT macros which
can be altered by board-package defaults, so update pin_manager.cpp to stop
relying solely on those: add a repo-owned capability macro (e.g.
WLED_PROTECT_USB_JTAG) and use it in the USB-JTAG checks (replace the existing
`#if` ARDUINO_USB_CDC_ON_BOOT == 1 || ARDUINO_USB_DFU_ON_BOOT == 1 blocks around
the gpio == 12/13/14 checks) or, alternatively, ensure both
ARDUINO_USB_CDC_ON_BOOT and ARDUINO_USB_DFU_ON_BOOT are explicitly set to 1 in
the project envs for all C5/C6 platformio.ini envs so the protection for GPIO
12/13/14 is always applied; make the same change for the other occurrence noted
in the diff.
wled00/cfg.cpp (1)

166-170: Redundant preprocessor check inside already-guarded block.

The #if defined(ARDUINO_ARCH_ESP32) && ... on line 166 is inside an #ifdef ARDUINO_ARCH_ESP32 block (line 164), making the ARDUINO_ARCH_ESP32 check redundant.

♻️ Suggested simplification
 `#ifdef` ARDUINO_ARCH_ESP32
   CJSON(txPower, wifi[F("txpwr")]);
-  `#if` defined(ARDUINO_ARCH_ESP32) && (ESP_IDF_VERSION_MAJOR > 4)
+  `#if` ESP_IDF_VERSION_MAJOR > 4
     txPower = min(max((int)txPower, (int)WIFI_POWER_2dBm), (int)WIFI_POWER_21dBm);  // V5 allows WIFI_POWER_21dBm = 84 ... WIFI_POWER_MINUS_1dBm = -4
   `#else`
     txPower = min(max((int)txPower, (int)WIFI_POWER_2dBm), (int)WIFI_POWER_19_5dBm);
   `#endif`
 `#endif`
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wled00/cfg.cpp` around lines 166 - 170, The inner preprocessor check
redundantly re-tests ARDUINO_ARCH_ESP32 inside an outer `#ifdef`
ARDUINO_ARCH_ESP32 block; simplify the condition by replacing the inner "#if
defined(ARDUINO_ARCH_ESP32) && (ESP_IDF_VERSION_MAJOR > 4)" with a direct check
of ESP_IDF_VERSION_MAJOR (e.g., "#if (ESP_IDF_VERSION_MAJOR > 4)"), keeping the
two branches that clamp txPower using WIFI_POWER_21dBm and WIFI_POWER_19_5dBm
respectively; update the block around txPower so only the ESP_IDF_VERSION_MAJOR
test remains while preserving the existing min/max logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@wled00/FX_fcn.cpp`:
- Around line 1166-1186: The code currently increments i2sBusCount based on the
requested driverType; instead use the bus's assigned iType (the actual
instantiated driver) when determining I2S usage so DMA memory is estimated only
for buses that truly use I2S hardware—update the loop over busConfigs (and the
other occurrences noted around the blocks at 1193-1206 and 1213-1217) to check
bus.iType against the I2S types (not bus.driverType or I_NONE parity) when
incrementing i2sBusCount and when computing useParallelI2S, leaving the ESP32-S3
conditional logic intact but driven by assigned iType.

---

Duplicate comments:
In `@wled00/wled.cpp`:
- Around line 492-501: The esp_read_mac() return value is ignored, so escapedMac
may be derived from a zero MAC; modify the block that calls esp_read_mac(...) to
store its return into an esp_err_t (or int) result, check that the result equals
ESP_OK before using the mac[] buffer and formatting into escapedMac, and on
failure skip assigning escapedMac (or log/handle the error) so we do not
overwrite escapedMac with a zero MAC; update the branch containing
esp_read_mac(...), the local mac[] and sprintf into buf, and the assignment
escapedMac = buf to only occur after the ESP_OK check.

---

Nitpick comments:
In `@wled00/cfg.cpp`:
- Around line 166-170: The inner preprocessor check redundantly re-tests
ARDUINO_ARCH_ESP32 inside an outer `#ifdef` ARDUINO_ARCH_ESP32 block; simplify the
condition by replacing the inner "#if defined(ARDUINO_ARCH_ESP32) &&
(ESP_IDF_VERSION_MAJOR > 4)" with a direct check of ESP_IDF_VERSION_MAJOR (e.g.,
"#if (ESP_IDF_VERSION_MAJOR > 4)"), keeping the two branches that clamp txPower
using WIFI_POWER_21dBm and WIFI_POWER_19_5dBm respectively; update the block
around txPower so only the ESP_IDF_VERSION_MAJOR test remains while preserving
the existing min/max logic.

In `@wled00/pin_manager.cpp`:
- Around line 239-255: The pin-guard currently depends on external
ARDUINO_USB_CDC_ON_BOOT/ARDUINO_USB_DFU_ON_BOOT macros which can be altered by
board-package defaults, so update pin_manager.cpp to stop relying solely on
those: add a repo-owned capability macro (e.g. WLED_PROTECT_USB_JTAG) and use it
in the USB-JTAG checks (replace the existing `#if` ARDUINO_USB_CDC_ON_BOOT == 1 ||
ARDUINO_USB_DFU_ON_BOOT == 1 blocks around the gpio == 12/13/14 checks) or,
alternatively, ensure both ARDUINO_USB_CDC_ON_BOOT and ARDUINO_USB_DFU_ON_BOOT
are explicitly set to 1 in the project envs for all C5/C6 platformio.ini envs so
the protection for GPIO 12/13/14 is always applied; make the same change for the
other occurrence noted in the diff.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 401fcb8d-bb7e-4f97-8972-b5c089925999

📥 Commits

Reviewing files that changed from the base of the PR and between 9232bd4 and 65d7528.

📒 Files selected for processing (31)
  • platformio.ini
  • usermods/audioreactive/audio_reactive.cpp
  • usermods/audioreactive/audio_source.h
  • wled00/FX.h
  • wled00/FX_fcn.cpp
  • wled00/FXparticleSystem.cpp
  • wled00/bus_manager.cpp
  • wled00/bus_wrapper.h
  • wled00/button.cpp
  • wled00/cfg.cpp
  • wled00/const.h
  • wled00/data/index.js
  • wled00/data/settings_wifi.htm
  • wled00/dmx_output.cpp
  • wled00/fcn_declare.h
  • wled00/improv.cpp
  • wled00/json.cpp
  • wled00/network.cpp
  • wled00/ota_update.cpp
  • wled00/pin_manager.cpp
  • wled00/set.cpp
  • wled00/src/dependencies/dmx/ESPDMX.cpp
  • wled00/src/dependencies/dmx/SparkFunDMX.cpp
  • wled00/udp.cpp
  • wled00/util.cpp
  • wled00/wled.cpp
  • wled00/wled.h
  • wled00/wled_boards.h
  • wled00/wled_metadata.cpp
  • wled00/ws.cpp
  • wled00/xml.cpp
✅ Files skipped from review due to trivial changes (4)
  • usermods/audioreactive/audio_source.h
  • wled00/ota_update.cpp
  • wled00/src/dependencies/dmx/ESPDMX.cpp
  • wled00/set.cpp
🚧 Files skipped from review as they are similar to previous changes (8)
  • wled00/dmx_output.cpp
  • wled00/improv.cpp
  • wled00/src/dependencies/dmx/SparkFunDMX.cpp
  • wled00/button.cpp
  • wled00/FXparticleSystem.cpp
  • wled00/wled.h
  • wled00/const.h
  • platformio.ini

only one usecase:

WLED_MAX_DIGITAL_CHANNELS=0 on C5/C6 will prevent very frequent RMT timeout warnings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

keep This issue will never become stale/closed automatically magic major This is a non-trivial major feature and will take some time to implement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants