Skip to content

fix(esp32): link the WiFi stack only when a sketch uses fl::net wifi/OTA (#4726) - #4731

Merged
zackees merged 2 commits into
masterfrom
fix/4726-esp32-wifi-link
Oct 7, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/4726-esp32-wifi-link

Conversation

@zackees

@zackees zackees commented Oct 7, 2026

Copy link
Copy Markdown
Member

Fixes #4726

Approach

fl::net::OTA and the ESP32 wifi/OTA backends move out of the always-linked fl.net+ / platforms+ unity objects into their own build units: fl/build/fl.net.ota+.cpp, platforms.esp.32.net+.cpp, platforms.esp.32.ota+.cpp. Their strong esp_wifi_init references reach the linker only when a sketch uses wifi/OTA. IOTA::create() now lives in the ESP32 OTA unit, so fl::net::OTA is what pulls it in. The null-stub guard in platforms/ota.cpp.hpp now matches FL_ESP_OTA_SUPPORTED exactly, including the IDF 6 exclusion.

  • Header compatibility: fl/net/ota.h is kept as a forwarding header to fl/net/ota/ota.h.
  • In-place upgrade: no existing fl/build/*.cpp was removed or renamed, and ci/check_released_sources.py passes. The old fl/net/ota.cpp.hpp left behind by an overlay is a .cpp.hpp file, so it is never compiled.
  • network_detector.cpp.hpp is unchanged. Its weak esp_wifi_get_mode now resolves to null in Blink again.
  • The noexcept baseline edit is a path rename only. The IWYU map adds an entry for the new path.

Evidence (local fbuild, Blink, flash/RAM in bytes)

board before after s_wifi_nvs / wifi_init.c
esp32c6 361204 / 20044 360816 / 18724 gone
esp32s3 408200 / 79544 407844 / 78216 gone
esp32c3 404096 / 69884 403512 / 68572 gone
esp32dev 311076 / 26084 310960 / 26084 still linked, but by the Arduino core: esp32-hal-bt -> libbt bt.c -> phy_init -> wifi_init. No libFastLED object references it any more.

The OTA example (esp32s3, esp32c6) and AutoResearch (esp32c6) still link esp_wifi_init, s_wifi_nvs and ESP32OTA.

The esp32s3 bloat baseline is re-pinned to 367407 (bash bloat esp32s3 --build image_flash, measured locally).

Local checks: bash lint and bash test wifi|ble_notify_queue|port pass.

zackees and others added 2 commits October 6, 2026 21:04
…OTA (#4726)

Split fl::net::OTA and the ESP32 wifi/OTA backends out of the always-linked
fl.net+ and platforms+ unity objects into their own build units
(fl.net.ota+.cpp, platforms.esp.32.net+.cpp, platforms.esp.32.ota+.cpp).
Their strong esp_wifi_init references no longer pull libesp_wifi /
libnet80211 into every ESP32 sketch, so NetworkDetector's weak
esp_wifi_get_mode check again reports WiFi as not linked in Blink.

fl/net/ota.h stays as a forwarding header to fl/net/ota/ota.h.

Fixes #4726

Co-Authored-By: Claude <[email protected]>
@zackees
zackees merged commit 2e04eaf into master Oct 7, 2026
117 of 118 checks passed
@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f02e3012-34de-4a2b-a67b-d79a85a25b4c
📥 Commits

Reviewing files that changed from the base of the PR and between 6ceddf5 and df95df6.

📒 Files selected for processing (15)
  • ci/iwyu/fastled.imp
  • ci/lint_cpp_rs/src/checkers/unity_build.rs
  • ci/tools/noexcept_baseline.txt
  • src/fl/build/fl.net.ota+.cpp
  • src/fl/build/platforms.esp.32.net+.cpp
  • src/fl/build/platforms.esp.32.ota+.cpp
  • src/fl/net/_build.cpp.hpp
  • src/fl/net/ota.h
  • src/fl/net/ota/_build.cpp.hpp
  • src/fl/net/ota/ota.cpp.hpp
  • src/fl/net/ota/ota.h
  • src/platforms/esp/32/_build.cpp.hpp
  • src/platforms/esp/32/ota/ota_impl.cpp.hpp
  • src/platforms/ota.cpp.hpp
  • tests/data/esp32s3_bloat_baseline.txt
 ___________________________________________________________________________________________________
< All problems in computer science can be solved with another level of indirection. - David Wheeler >
 ---------------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ESP32: WiFi stack linked into Blink via esp_wifi_init in the platforms+ unity object (~3 KB flash, ~1.6 KB RAM)

1 participant