Repository navigation
fix(esp32-s3): LCD_CLOCKLESS GPIO crash fix + autoresearch --lcd/--lcd-spi - #2273
Conversation
…-spi Hardware bring-up for PR #2260 (LCD_CAM ISR-driven chunked DMA). Crash fix ChannelDriverLcdClockless defaulted dc_gpio=22 and clock_gpio=21. GPIO 22 does not exist on common ESP32-S3 packages, so esp_lcd_new_i80_bus -> lcd_i80_bus_configure_gpio -> gpio_func_sel hit an error-log path that detected heap poisoning and triggered a Guru Meditation panic. Changed both defaults to GPIO 0 (same convention as the legacy I2S LCD_CAM driver this replaces). autoresearch CLI --lcd now maps to LCD_CLOCKLESS (was the legacy I2S name). Added --lcd-spi mapping to LCD_SPI (APA102/SK9822 via LCD_CAM I80). Both auto-select the esp32s3 environment and are included in --all. autoresearch RX decoder AutoResearchTest.cpp recognises LCD_CLOCKLESS and reconstructs the RX timing for wave3 or wave8 encoding using the same fl::canUseWave3() eligibility check the firmware uses at runtime. GPIO pre-test timing Bumped RpcClient boot_wait from 3s to 8s and enabled drain_boot in gpio.py. The ESP32-S3 AutoResearch setup() takes ~5-7s before the RPC dispatcher is ready, so the old 3s wait raced the first ping against setup and produced intermittent GPIO PRE-TEST timeouts. Hardware verification (ESP32-S3 @ COM13, jumper GPIO 1 -> GPIO 2) LCD_SPI: 4/4 patterns pass (passed:true) LCD_CLOCKLESS: 4/4 patterns pass (passed:true, after GPIO fix) Host unit tests: 299/299 pass. Lint clean. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
.autoresearch_last.log is rewritten by every autoresearch run and .claude/scheduled_tasks.lock is a lockfile managed by Claude Code's background-task system. Neither should be tracked. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
📝 WalkthroughWalkthroughAdds LCD_SPI driver wiring to AutoResearch (CLI flag, phase selection, example support), increases RPC boot-wait and ping timeout for GPIO tests, updates default GPIO assignments in LCD clockless driver files, and adjusts host waveform selection to support wave3 and wave8 for LCD_CLOCKLESS. Changes
Sequence Diagram(s)sequenceDiagram
participant Host
participant AutoResearch_CLI
participant RPC_Client
participant Device
participant Driver
Host->>AutoResearch_CLI: run with --lcd-spi
AutoResearch_CLI->>Host: set Args.lcd_spi
AutoResearch_CLI->>RPC_Client: start client (boot_wait=8.0, drain_boot=true)
RPC_Client->>Device: open connection
RPC_Client->>Device: ping(timeout=15.0)
Device-->>RPC_Client: pong
AutoResearch_CLI->>Host: select final_environment="esp32s3"
Host->>Driver: load LCD_SPI / LCD_CLOCKLESS path
Driver->>Device: beginTransmission / configure GPIOs (defaults possibly updated)
Host->>Driver: capture() chooses wave3 or wave8 via fl::canUseWave3()
Driver->>Device: transmit using chosen waveform
Device-->>Host: capture result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
📊 Header Compilation PerformanceTotal Time: 1226.16ms Top 5 Slowest Headers
Warnings
Full Report |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ci/autoresearch/gpio.py (1)
82-90:⚠️ Potential issue | 🟡 MinorLatent
NameError: asyncioin the DTR-reset fallback path.
asynciois not imported at the top of this file, butawait asyncio.sleep(3.0)is called here (and again at line 276 inrun_pin_discovery). If the initial ping fails and this recovery branch is taken, the fallback itself crashes withNameErrorbefore the retryclient.connect()runs, turning a recoverable idle-device case into a hard failure — which is exactly the scenario the increasedboot_wait=8.0is intended to help with.Also, after bumping the primary
connect()toboot_wait=8.0with the rationale above, the retry at line 90 (and line 284) is stillboot_wait=3.0. Post-DTR-reset the device re-runs the samesetup(), so the same race applies — consider using 8.0 here too for consistency.🛠 Proposed fix
@@ from dataclasses import dataclass from typing import TYPE_CHECKING +import asyncio @@ - await client.connect(boot_wait=3.0, drain_boot=True) + await client.connect(boot_wait=8.0, drain_boot=True)And analogously at line 284 in
run_pin_discovery.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ci/autoresearch/gpio.py` around lines 82 - 90, The fallback DTR-reset path in the GPIO logic calls await asyncio.sleep(...) but asyncio is not imported, causing a NameError and hard-failing recovery; add "import asyncio" at the top of the file and change the retry client.connect(...) calls in the DTR-reset branch and in run_pin_discovery to use the same extended boot_wait value (use 8.0) as the primary connect so the post-reset setup has the same timeout; update references to RpcClient.connect(boot_wait=3.0, ...) to RpcClient.connect(boot_wait=8.0, ...) for consistency and ensure run_pin_discovery uses asyncio.sleep as well.
🧹 Nitpick comments (2)
.gitignore (1)
114-117: Good additions; consider simplifying the log pattern.Both entries are appropriate for
.gitignore:
.claude/scheduled_tasks.lockcorrectly excludes the IDE lock file.autoresearch_last.logprovides explicit documentation for the AutoResearch logHowever, note that
.autoresearch_last.logis already covered by the existing./*.logpattern on line 102. While the explicit entry serves as documentation, you might consider removing it to avoid redundancy.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.gitignore around lines 114 - 117, Remove the redundant explicit .autoresearch_last.log entry from .gitignore since it is already matched by the existing ./*.log pattern; keep the .claude/scheduled_tasks.lock line (it’s not covered by that pattern) and leave a comment only if you want documentation for the log exclusion instead of duplicating the entry.examples/AutoResearch/AutoResearchTest.cpp (1)
560-562: Tolerance widening to 200 ns for wave3 deserves a quick sanity check at the wave3 tick width.Wave3 tick width is
period/3(~417 ns for an 800 kHz chipset), versus ~125 ns for wave8. A ±200 ns tolerance on a 417 ns tick is ~48% of one tick, which is workable but tighter relative to bit-width than the wave8 case (200 ns / 125 ns ≈ 160%). On the other hand, a wave3-encoded "0" pulse may be only1*tick = ~417nswide, so 200 ns leaves a 217 ns floor before false positives against random noise — verify against your captured ESP32-S3 traces that the 4/4 pass margin isn't accidentally narrow here.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@examples/AutoResearch/AutoResearchTest.cpp` around lines 560 - 562, The hardcoded tolerance set by the const uint32_t tolerance = (uses_wave8 || uses_wave3) ? 200 : 170; is unsafe for wave3 because wave3 tick_width = period/3 is much larger than wave8/8; instead compute tolerance relative to the actual tick width: calculate tick_width = period / (uses_wave3 ? 3 : 8) and set tolerance using a bounded fraction of that tick (e.g., tolerance = std::min(200u, static_cast<uint32_t>(tick_width / 2)) for wave3, and keep 200 for wave8 or 170 for others), updating the code that references tolerance and ensuring variables period, uses_wave3, uses_wave8 and tolerance are used consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ci/autoresearch/phases.py`:
- Around line 199-208: Update the failing test_lcd_forces_esp32s3 to assert the
actual driver name appended by phases.py: replace the assertion that checks for
"I2S" in result.drivers with an assertion that "LCD_CLOCKLESS" is in
result.drivers (keep using the same test function name test_lcd_forces_esp32s3
and the same result.drivers reference).
In `@examples/AutoResearch/AutoResearchTest.cpp`:
- Around line 534-556: The host-side Wave3 quantization recomputes
ticks_bit0/ticks_bit1 and builds tx_timing in the uses_wave3 branch but lacks a
defensive validation: add a check after computing ticks_bit0 and ticks_bit1 (in
the same block that computes actual_t0h/actual_t1h and tx_timing) to ensure
ticks_bit0 and ticks_bit1 are within the expected range (1..2) and are distinct
(matching canUseWave3 semantics); if the guard fails, log an error/warning (use
FL_WARN or FL_ERROR) and fall back to a safe non-wave3 path or abort the wave3
assignment so tx_timing is not set with degenerate values. Ensure the check
references uses_wave3, ticks_bit0, ticks_bit1, and tx_timing so it’s easy to
locate and maintain.
In `@src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp`:
- Around line 373-384: The current defaulting of config.clock_gpio and
config.dc_gpio to 0 can collide with active data lanes (e.g., when
channels[i]->getPin() == 0); update the block that sets config.clock_gpio and
config.dc_gpio so it first scans config.data_gpios (and/or channels[]) to pick a
fallback pin that does not appear in data_gpios, and if no safe unused pad can
be found emit an FL_WARN documenting the overlap and chosen fallback; ensure you
reference and check config.data_gpios, config.clock_gpio, config.dc_gpio and
channels[i]->getPin() when implementing this guard and add a short comment
explaining the constraint.
---
Outside diff comments:
In `@ci/autoresearch/gpio.py`:
- Around line 82-90: The fallback DTR-reset path in the GPIO logic calls await
asyncio.sleep(...) but asyncio is not imported, causing a NameError and
hard-failing recovery; add "import asyncio" at the top of the file and change
the retry client.connect(...) calls in the DTR-reset branch and in
run_pin_discovery to use the same extended boot_wait value (use 8.0) as the
primary connect so the post-reset setup has the same timeout; update references
to RpcClient.connect(boot_wait=3.0, ...) to RpcClient.connect(boot_wait=8.0,
...) for consistency and ensure run_pin_discovery uses asyncio.sleep as well.
---
Nitpick comments:
In @.gitignore:
- Around line 114-117: Remove the redundant explicit .autoresearch_last.log
entry from .gitignore since it is already matched by the existing ./*.log
pattern; keep the .claude/scheduled_tasks.lock line (it’s not covered by that
pattern) and leave a comment only if you want documentation for the log
exclusion instead of duplicating the entry.
In `@examples/AutoResearch/AutoResearchTest.cpp`:
- Around line 560-562: The hardcoded tolerance set by the const uint32_t
tolerance = (uses_wave8 || uses_wave3) ? 200 : 170; is unsafe for wave3 because
wave3 tick_width = period/3 is much larger than wave8/8; instead compute
tolerance relative to the actual tick width: calculate tick_width = period /
(uses_wave3 ? 3 : 8) and set tolerance using a bounded fraction of that tick
(e.g., tolerance = std::min(200u, static_cast<uint32_t>(tick_width / 2)) for
wave3, and keep 200 for wave8 or 170 for others), updating the code that
references tolerance and ensuring variables period, uses_wave3, uses_wave8 and
tolerance are used consistently.
🪄 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: fde830ac-74da-49f8-9773-78699092a001
📒 Files selected for processing (6)
.gitignoreci/autoresearch/args.pyci/autoresearch/gpio.pyci/autoresearch/phases.pyexamples/AutoResearch/AutoResearchTest.cppsrc/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp
| drivers = [ | ||
| "PARLIO", | ||
| "RMT", | ||
| "SPI", | ||
| "UART", | ||
| "LCD_CLOCKLESS", | ||
| "LCD_SPI", | ||
| "LCD_RGB", | ||
| "OBJECTFLED", | ||
| ] |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find any remaining references to the old "I2S" driver string in the autoresearch
# pipeline / firmware that may need to be updated to LCD_CLOCKLESS / LCD_SPI.
rg -nP -C2 '"I2S"' --type=py --type=cpp --type=c
rg -nP -C2 '\bLCD_CLOCKLESS\b|\bLCD_SPI\b' --type=py --type=cpp --type=cRepository: FastLED/FastLED
Length of output: 21026
🏁 Script executed:
head -n 310 ci/tests/test_autoresearch_phases.py | tail -n 20Repository: FastLED/FastLED
Length of output: 965
🏁 Script executed:
grep -n "I2S\|LCD_CLOCKLESS\|LCD_SPI" ci/tests/test_autoresearch_phases.pyRepository: FastLED/FastLED
Length of output: 101
🏁 Script executed:
sed -n '290,310p' ci/tests/test_autoresearch_phases.pyRepository: FastLED/FastLED
Length of output: 1004
🏁 Script executed:
sed -n '195,225p' ci/autoresearch/phases.pyRepository: FastLED/FastLED
Length of output: 858
🏁 Script executed:
grep -n 'assert.*"I2S"' ci/tests/test_autoresearch_phases.pyRepository: FastLED/FastLED
Length of output: 101
🏁 Script executed:
grep -n 'assert.*LCD_CLOCKLESS\|assert.*LCD_SPI' ci/tests/test_autoresearch_phases.pyRepository: FastLED/FastLED
Length of output: 41
🏁 Script executed:
grep -rn 'assert.*in.*drivers\|"I2S".*drivers' ci/tests/ --type=pyRepository: FastLED/FastLED
Length of output: 179
🏁 Script executed:
# Check if there are other tests or code paths that consume the drivers list
grep -rn 'result\.drivers\|\.drivers\[' ci/tests/ --type=py -A 2 -B 2Repository: FastLED/FastLED
Length of output: 179
🏁 Script executed:
rg 'assert.*in.*drivers|"I2S".*drivers' ci/tests/ -A 2 -B 2Repository: FastLED/FastLED
Length of output: 912
🏁 Script executed:
rg 'result\.drivers|\.drivers\[' ci/tests/ -A 2 -B 2Repository: FastLED/FastLED
Length of output: 2288
🏁 Script executed:
sed -n '290,305p' ci/tests/test_autoresearch_phases.pyRepository: FastLED/FastLED
Length of output: 755
🏁 Script executed:
# Check the test method name to understand context better
sed -n '285,310p' ci/tests/test_autoresearch_phases.pyRepository: FastLED/FastLED
Length of output: 1214
🏁 Script executed:
# Check for any other test files that might reference I2S driver
rg -l '"I2S"' ci/tests/ --type pyRepository: FastLED/FastLED
Length of output: 95
🏁 Script executed:
# Check the complete test to understand what it's testing
sed -n '293,298p' ci/tests/test_autoresearch_phases.pyRepository: FastLED/FastLED
Length of output: 401
The test test_lcd_forces_esp32s3 will fail because it asserts the wrong driver name.
The test at line 298 of ci/tests/test_autoresearch_phases.py checks assert "I2S" in result.drivers, but phases.py line 219 now appends "LCD_CLOCKLESS" when args.lcd=True. Update the test assertion to assert "LCD_CLOCKLESS" in result.drivers.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@ci/autoresearch/phases.py` around lines 199 - 208, Update the failing
test_lcd_forces_esp32s3 to assert the actual driver name appended by phases.py:
replace the assertion that checks for "I2S" in result.drivers with an assertion
that "LCD_CLOCKLESS" is in result.drivers (keep using the same test function
name test_lcd_forces_esp32s3 and the same result.drivers reference).
| } else if (uses_wave3) { | ||
| // Wave3 encoding: 3 ticks per LED bit, clock = 3/(T1+T2+T3) Hz | ||
| const uint32_t period = timing.t1_ns + timing.t2_ns + timing.t3_ns; | ||
| const uint32_t tick_ns = period / 3; | ||
| const uint32_t ticks_bit0 = static_cast<uint32_t>( | ||
| static_cast<float>(timing.t1_ns) / period * 3.0f + 0.5f); | ||
| const uint32_t ticks_bit1 = static_cast<uint32_t>( | ||
| static_cast<float>(timing.t1_ns + timing.t2_ns) / period * 3.0f + 0.5f); | ||
| const uint32_t actual_t0h = ticks_bit0 * tick_ns; | ||
| const uint32_t actual_t1h = ticks_bit1 * tick_ns; | ||
| const uint32_t actual_period = 3 * tick_ns; | ||
| tx_timing = fl::ChipsetTiming{ | ||
| actual_t0h, | ||
| actual_t1h - actual_t0h, | ||
| actual_period - actual_t1h, | ||
| timing.reset_us, | ||
| "LCD_CLOCKLESS_wave3" | ||
| }; | ||
| FL_WARN("[RX TIMING] LCD_CLOCKLESS_wave3: ticks_bit0=" << ticks_bit0 | ||
| << " ticks_bit1=" << ticks_bit1 | ||
| << " tick_ns=" << tick_ns | ||
| << " -> T1=" << tx_timing.T1 << " T2=" << tx_timing.T2 | ||
| << " T3=" << tx_timing.T3); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Inspect canUseWave3 to confirm it rules out the degenerate cases above
# (ticks_bit0 == 0, ticks_bit1 == ticks_bit0, ticks_bit1 == 3).
ast-grep --pattern $'bool canUseWave3($$$) {
$$$
}'
rg -nP -C5 '\bcanUseWave3\b'Repository: FastLED/FastLED
Length of output: 15249
🏁 Script executed:
sed -n '25,60p' src/fl/channels/wave3.cpp.hppRepository: FastLED/FastLED
Length of output: 1338
🏁 Script executed:
sed -n '480,560p' examples/AutoResearch/AutoResearchTest.cppRepository: FastLED/FastLED
Length of output: 4723
Add defensive check to catch degenerate Wave3 quantization values.
The canUseWave3() check at line 498 validates that the quantized ticks_bit0 and ticks_bit1 fall within valid ranges [1, 2] and are distinct. However, the host recalculation at lines 537–538 performs the same quantization without re-validating, relying entirely on the firmware's eligibility check. While the mathematical guarantees should hold (since the formula and rounding are identical), adding an explicit check would provide defensive protection against:
- Future changes to
canUseWave3()that don't account for all edge cases - Subtle divergence between firmware quantization logic (used in actual drivers) and host quantization logic (used here for RX threshold reconstruction)
Suggested guard
const uint32_t ticks_bit0 = static_cast<uint32_t>(
static_cast<float>(timing.t1_ns) / period * 3.0f + 0.5f);
const uint32_t ticks_bit1 = static_cast<uint32_t>(
static_cast<float>(timing.t1_ns + timing.t2_ns) / period * 3.0f + 0.5f);
+ if (ticks_bit0 == 0 || ticks_bit1 <= ticks_bit0 || ticks_bit1 >= 3) {
+ FL_WARN("[RX TIMING] LCD_CLOCKLESS_wave3: degenerate quantization "
+ "(ticks_bit0=" << ticks_bit0 << " ticks_bit1=" << ticks_bit1
+ << ") — host/firmware canUseWave3() may be out of sync");
+ }
const uint32_t actual_t0h = ticks_bit0 * tick_ns;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@examples/AutoResearch/AutoResearchTest.cpp` around lines 534 - 556, The
host-side Wave3 quantization recomputes ticks_bit0/ticks_bit1 and builds
tx_timing in the uses_wave3 branch but lacks a defensive validation: add a check
after computing ticks_bit0 and ticks_bit1 (in the same block that computes
actual_t0h/actual_t1h and tx_timing) to ensure ticks_bit0 and ticks_bit1 are
within the expected range (1..2) and are distinct (matching canUseWave3
semantics); if the guard fails, log an error/warning (use FL_WARN or FL_ERROR)
and fall back to a safe non-wave3 path or abort the wave3 assignment so
tx_timing is not set with degenerate values. Ensure the check references
uses_wave3, ticks_bit0, ticks_bit1, and tx_timing so it’s easy to locate and
maintain.
| // PCLK and DC pins are required by the LCD I80 bus API but the | ||
| // signals are not connected to LEDs for clockless output (data | ||
| // streams out on data_gpios). Use GPIO 0 for both (same convention | ||
| // as the legacy I2S LCD_CAM driver this replaces — proven safe on | ||
| // ESP32-S3 because the strapping pin tolerates being multiplexed | ||
| // to unused peripheral functions). | ||
| if (config.clock_gpio < 0) { | ||
| config.clock_gpio = 21; | ||
| config.clock_gpio = 0; | ||
| } | ||
| if (config.dc_gpio < 0) { | ||
| config.dc_gpio = 22; // another unused GPIO | ||
| config.dc_gpio = 0; | ||
| } |
There was a problem hiding this comment.
Potential pin collision when a user assigns GPIO 0 as a data lane.
The fix to default clock_gpio/dc_gpio to 0 resolves the ESP32-S3 boot crash, but it now silently overlaps with data_gpios if the caller assigns GPIO 0 to one of the lanes (e.g., channels[i]->getPin() == 0). Three signals would then be muxed onto the same pad, which can corrupt the data stream on that lane without an obvious diagnostic. Consider either:
- Picking a guaranteed-unused fallback by scanning
config.data_gpios[]and avoiding any pin already assigned, or - Emitting an
FL_WARNwhen the chosen dummy pin overlaps with an active data lane.
A quick guard would also document the constraint for future readers.
🛡️ Suggested guard
if (config.clock_gpio < 0) {
config.clock_gpio = 0;
}
if (config.dc_gpio < 0) {
config.dc_gpio = 0;
}
+ // Warn if the dummy pins collide with an active data lane.
+ for (size_t i = 0; i < channels.size() && i < 16; i++) {
+ int p = config.data_gpios[i];
+ if (p == config.clock_gpio || p == config.dc_gpio) {
+ FL_WARN("ChannelDriverLcdClockless: data_gpios["
+ << i << "]=" << p
+ << " collides with dummy PCLK/DC pin");
+ }
+ }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp`
around lines 373 - 384, The current defaulting of config.clock_gpio and
config.dc_gpio to 0 can collide with active data lanes (e.g., when
channels[i]->getPin() == 0); update the block that sets config.clock_gpio and
config.dc_gpio so it first scans config.data_gpios (and/or channels[]) to pick a
fallback pin that does not appear in data_gpios, and if no safe unused pad can
be found emit an FL_WARN documenting the overlap and chosen fallback; ensure you
reference and check config.data_gpios, config.clock_gpio, config.dc_gpio and
channels[i]->getPin() when implementing this guard and add a short comment
explaining the constraint.
Both ChannelDriverLcdClockless and ChannelDriverLcdSpi destructors had an "intentional leak" branch that skipped freeRingBuffers() whenever waitTransmitDone() returned false, on the theory that DMA might still be reading the buffers. In the unit-test mocks (LcdSpiPeripheralMock), waitTransmitDone() returns false immediately whenever mPendingTransmits > 0 — so any test that does not explicitly drain via simulateTransmitComplete() hits the leak path, and LeakSanitizer (active in CI --debug runs) rejects the test. A 2 s stall on real hardware already indicates the DMA is lost; the leak-to-be-safe strategy never actually helps production code and it strictly breaks tests. Free unconditionally and log a warning instead. Both failing CI jobs pass locally: bash test channel_driver_lcd_clockless --debug --clean PASS bash test channel_driver_lcd_spi --debug PASS Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
📊 Header Compilation PerformanceTotal Time: 1202.41ms Top 5 Slowest Headers
Warnings
Full Report |
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp (1)
381-386:⚠️ Potential issue | 🟡 MinorPin collision when a data lane is assigned to GPIO 0.
Setting both
clock_gpioanddc_gpioto 0 still silently overlaps withconfig.data_gpios[i]if any channel's pin is GPIO 0. Three signals muxed onto the same pad will corrupt that lane's output without diagnostics. A one-shotFL_WARNwhen the dummy pins collide with an active data lane would at least surface this to the user.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp` around lines 381 - 386, After defaulting config.clock_gpio and config.dc_gpio to 0, add a one-shot diagnostic that checks for collisions with any active data lane: loop over config.data_gpios[] and if any element equals 0 while config.clock_gpio==0 or config.dc_gpio==0, call FL_WARN once (use a static bool or similar to ensure a single warning) with a clear message including which dummy pin (clock or dc) collides and the data lane index; reference config.clock_gpio, config.dc_gpio and config.data_gpios to locate where to insert this check and use the existing FL_WARN logging macro for the warning.
🧹 Nitpick comments (1)
src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp (1)
375-386: Mirror the GPIO 0 default fordc_gpioinchannel_driver_lcd_spi.cpp.hpp.The clockless driver now defaults
dc_gpioto 0, but the SPI sibling atchannel_driver_lcd_spi.cpp.hpplines 337–339 still defaults to 21. Since both drivers route through the sameLcdSpiPeripheralEsp(which falls back to GPIO 0 with a warning if unset), aligning the SPI driver's default to 0 would remove inconsistency and eliminate a latent safety issue, especially given the rationale that GPIO 21/22 are unsafe defaults on common ESP32-S3 packages.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp` around lines 375 - 386, The SPI LCD driver defaults dc_gpio to 21 which conflicts with the clockless driver and the LcdSpiPeripheralEsp fallback; update the default in channel_driver_lcd_spi.cpp.hpp so that when config.dc_gpio < 0 it is set to 0 (mirror the change made for config.clock_gpio in the clockless driver). Locate the dc_gpio assignment in the SPI driver (the config.dc_gpio check near the existing config.clock_gpio handling) and change the fallback value from 21 to 0 to match LcdSpiPeripheralEsp and the clockless driver behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp`:
- Around line 381-386: After defaulting config.clock_gpio and config.dc_gpio to
0, add a one-shot diagnostic that checks for collisions with any active data
lane: loop over config.data_gpios[] and if any element equals 0 while
config.clock_gpio==0 or config.dc_gpio==0, call FL_WARN once (use a static bool
or similar to ensure a single warning) with a clear message including which
dummy pin (clock or dc) collides and the data lane index; reference
config.clock_gpio, config.dc_gpio and config.data_gpios to locate where to
insert this check and use the existing FL_WARN logging macro for the warning.
---
Nitpick comments:
In `@src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp`:
- Around line 375-386: The SPI LCD driver defaults dc_gpio to 21 which conflicts
with the clockless driver and the LcdSpiPeripheralEsp fallback; update the
default in channel_driver_lcd_spi.cpp.hpp so that when config.dc_gpio < 0 it is
set to 0 (mirror the change made for config.clock_gpio in the clockless driver).
Locate the dc_gpio assignment in the SPI driver (the config.dc_gpio check near
the existing config.clock_gpio handling) and change the fallback value from 21
to 0 to match LcdSpiPeripheralEsp and the clockless driver behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 712eb181-afac-402c-88fe-8e3e2388a969
📒 Files selected for processing (2)
src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hppsrc/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_spi.cpp.hpp
Summary
Follow-up to #2260 (merged). Fixes a boot crash in
LCD_CLOCKLESSon real ESP32-S3 hardware and wires the autoresearch CLI so--lcdand--lcd-spiboth work.Crash fix
ChannelDriverLcdClocklessdefaulteddc_gpio=22andclock_gpio=21. GPIO 22 does not exist on common ESP32-S3 packages, soesp_lcd_new_i80_bus→lcd_i80_bus_configure_gpio→gpio_func_selhit an error-log path that detected heap poisoning and triggered a Guru Meditation panic.Changed both defaults to GPIO 0, matching the legacy I2S LCD_CAM driver this replaces (the strapping pin tolerates being multiplexed to the unused PCLK/DC peripheral functions).
autoresearch CLI
--lcdnow maps toLCD_CLOCKLESS(was the legacyI2Sname).--lcd-spiflag maps toLCD_SPI(APA102/SK9822 via LCD_CAM I80).esp32s3environment and are included in--all.autoresearch RX decoder
examples/AutoResearch/AutoResearchTest.cppnow recognisesLCD_CLOCKLESSand reconstructs the RX timing for wave3 or wave8 encoding using the samefl::canUseWave3()eligibility check the firmware uses at runtime.GPIO pre-test timing
Bumped
RpcClientboot_waitfrom 3s to 8s and enableddrain_bootinci/autoresearch/gpio.py. The ESP32-S3 AutoResearchsetup()takes ~5-7s before the RPC dispatcher is ready, so the old 3s wait raced the first ping against setup and produced intermittentGPIO PRE-TEST TIMEOUTfailures..gitignore
Added
.autoresearch_last.logand.claude/scheduled_tasks.lock— both are transient, rewritten by autoresearch runs and Claude Code's background-task system respectively.Hardware verification (ESP32-S3 @ COM13, jumper GPIO 1 → GPIO 2)
LCD_SPIpassed:true)LCD_CLOCKLESSpassed:true, after GPIO fix)Related
Issue #2270 (follow-up) documents a shared-singleton re-init fragility between
LCD_SPIandLCD_CLOCKLESSthat this PR does not attempt to fix — single-driver sessions (the autoresearch case) work reliably.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Chores