Repository navigation
feat(esp32): remove unused fl/system/arduino.h leaks; unconditional heap_caps_* - #3728
Merged
Merged
Conversation
…eap_caps_* Removes fl/system/arduino.h includes from two ESP32 TUs whose implementation is already pure IDF and never references any Arduino symbol: coroutine_esp32.impl.hpp (FreeRTOS-only) and drivers/uart/uart_peripheral_esp.cpp.hpp (driver/uart.h + the fl:: facade for micros()). Every include of that shim pulls the whole Arduino core into the TU whenever it's present, at zero benefit here. (i2s_lcd_cam_peripheral_mock.cpp.hpp's #ifdef ARDUINO fork is left alone — it's host-stub-only test infrastructure gated on !ARDUINO-or-FASTLED_STUB_IMPL at the file level, selecting between the stub Arduino shim and platforms/stub/time_stub.h for host testing. Unrelated to real ESP32 hardware builds; out of scope here.) Also rewrites platforms/esp/memory_esp32.hpp's getFreeHeap()/ getMinFreeHeap(): the #if defined(ARDUINO) fork there wasn't actually Arduino-coupled — both branches called ESP-IDF SDK functions (esp_get_free_heap_size vs heap_caps_get_free_size), just different API generations. heap_caps_* is available identically under Arduino-ESP32 and bare ESP-IDF, so the fork is unnecessary; call it unconditionally. Part of #3715. Closes #3721. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (2)
📝 WalkthroughWalkthroughESP32 platform headers remove an Arduino-specific include and replace conditional heap-statistic implementations with unconditional ESP-IDF heap capability APIs. ChangesESP32 Arduino decoupling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3721. Part of meta #3715 (ESP Arduino-decoupling).
Problem
fl/system/arduino.his a soft shim that pulls in the entire Arduino core (when present) at compile time. Two ESP32 TUs included it despite never referencing an Arduino symbol:coroutine_esp32.impl.hpp— FreeRTOS-only implementation.drivers/uart/uart_peripheral_esp.cpp.hpp— puredriver/uart.himplementation; its only "time" call isfl::micros(), the platform-agnosticfl::facade (declared inplatforms/time_platform.h), not anything fromArduino.h.Separately,
platforms/esp/memory_esp32.hppforkedgetFreeHeap()/getMinFreeHeap()ondefined(ARDUINO)— but on inspection both branches already call ESP-IDF SDK functions (esp_get_free_heap_size()vsheap_caps_get_free_size()), just from two different IDF heap-API generations. Neither branch is actually Arduino-specific, so the fork is unnecessary.Fix
fl/system/arduino.hinclude from the two pure-IDF TUs.memory_esp32.hppnow callsheap_caps_get_free_size()/heap_caps_get_minimum_free_size()unconditionally —esp_heap_caps.his a core ESP-IDF header, present identically under Arduino-ESP32 (which bundles ESP-IDF) and bare ESP-IDF.Scope note
drivers/i2s/i2s_lcd_cam_peripheral_mock.cpp.hpp's#ifdef ARDUINOfork was flagged by the original meta-issue audit but is left untouched here — it's host-stub-only test infrastructure (the whole file only compiles underFASTLED_STUB_IMPLor a non-Arduino host build) selecting between the stub Arduino shim andplatforms/stub/time_stub.hfor host testing. It has nothing to do with real ESP32 hardware builds.Test plan
bash lint --cpp— cleanbash test --cpp— 355/355 passgrep -rn "fl/system/arduino.h" src/platforms/esp/— only remaining hits are the (out-of-scope) host-mock file above and the true fallback branch incled.cpp.hpp(already scoped to esp32: cled.cpp.hpp — replace Arduino ledcAttach/ledcSetup/ledcWrite with IDF driver/ledc.h #3719)Summary by CodeRabbit