Skip to content

Fix AutoResearch lane limits and LCD chunk sizing - #2691

Merged
zackees merged 1 commit into
masterfrom
fix/2687-2688-autoresearch-lcd-chunks
Jun 3, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/2687-2688-autoresearch-lcd-chunks

Conversation

@zackees

@zackees zackees commented Jun 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Verification

  • uv run python -m pytest ci/tests/test_autoresearch_phases.py -v - 47 passed
  • bash test --cpp tests/fl/channels/validation.cpp - passed
  • bash test --cpp tests/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp - passed
  • git diff --check - clean
  • Attempted bash autoresearch esp32s3 --lcd --upload-port COM22 --lanes 16 --strip-sizes 256 --skip-lint --timeout 180 --verbose on the attached ESP32-S3 without --no-filter; fbuild stalled during compile before upload/serial verification. Compiler processes stopped advancing CPU time and were cleaned up. Related filter issue filed separately: fix(ci): let AutoResearch esp32s3 pass example filters without --no-filter #2690.

Summary by CodeRabbit

  • New Features

    • Expanded lane support from 8 to 16 lanes across AutoResearch and LCD drivers.
  • Bug Fixes

    • Simplified and improved DMA chunk sizing logic for better efficiency.
  • Documentation

    • Updated help text, examples, and test matrix documentation to reflect 16-lane maximum support.
  • Tests

    • Added validation tests for 16-lane constraints and DMA chunk sizing edge cases.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR addresses two follow-up issues from a prior review: it expands AutoResearch lane validation from 1–8 to 1–16 lanes across the CLI, firmware, tests, and documentation, and it simplifies LCD_CLOCKLESS DMA chunk sizing to round up instead of shrinking chunks, reducing interrupt overhead.

Changes

Lane Limit Expansion to 1–16

Layer / File(s) Summary
Lane constant definition and CLI validation
ci/autoresearch/phases.py
New module constant MAX_AUTORESEARCH_LANES = 16 enforces range checks in --lanes and --lane-counts argument validation with explicit error messages for out-of-range inputs.
Firmware validation layer
src/fl/channels/validation.cpp.hpp
Lane count validation in runSingleValidationTest now accepts up to 16 lanes and rejects values exceeding the limit with a matching error message.
CLI help text and autoresearch documentation
ci/autoresearch/args.py, autoresearch
Help strings for --lanes and --lane-counts document the new 1–16 range; autoresearch wrapper expanded driver documentation and replaced I2S examples with new LCD-related examples.
Example code and test infrastructure documentation
examples/AutoResearch/AutoResearch.ino, examples/AutoResearch/AutoResearchRemote.cpp, examples/AutoResearch/AutoResearchTest.h
Updated lane range documentation, test matrix size (to 96), RPC help text, and TestContext field documentation to reflect 1–16 lane and 0–15 index ranges.
Lane validation test cases
ci/tests/test_autoresearch_phases.py, tests/fl/channels/validation.cpp
Added unit tests verifying acceptance of 16 lanes, rejection of 17+ lanes, and correct error messages for overflow conditions.

DMA Chunk Sizing Optimization

Layer / File(s) Summary
DMA chunk sizing simplification
src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp
Replaced divisor-seeking loop with direct ceiling division: numChunks = ceil(maxSize / requestedChunkInputBytes), then chunkInputBytes = ceil(maxSize / numChunks), eliminating unnecessary chunk fragmentation for non-divisible frame sizes.
DMA chunk sizing test coverage
tests/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp
Added createClocklessChannelDataBytes helper and test case for awkward frame sizes (e.g., 1025 bytes), verifying correct transmit count and DMA byte allocation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • FastLED/FastLED#2648: Source PR that introduced the lane validation contract and DMA chunk sizing concerns addressed in follow-up issues #2687 and #2688.

Poem

🐰 A rabbit hops through lanes now sixteen strong,
Where chunks align and interrupt songs
No longer shrink to fit the frame,
Just round them up—much cleaner game!
From firmware down to CLI's call,
Validation stacks—consistent for all. 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: fixing AutoResearch lane limits (1-16) and LCD chunk sizing, directly matching the two linked issues (#2687 and #2688).
Linked Issues check ✅ Passed All code changes implement objectives from both linked issues: #2688 (LCD_CLOCKLESS chunk sizing logic simplified to avoid shrinking chunks) and #2687 (lane validation updated from 8 to 16 across firmware, tests, docs, and CLI).
Out of Scope Changes check ✅ Passed All changes are directly scoped to the two linked issues: lane count updates, LCD chunk sizing fixes, validation updates, test additions, and documentation changes. No unrelated modifications detected.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2687-2688-autoresearch-lcd-chunks

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Infer (1.2.0)
tests/fl/channels/validation.cpp

tests/fl/channels/validation.cpp:5:10: fatal error: 'test.h' file not found
5 | #include "test.h"
| ^~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/eb49f3c49c0fbb217a2c4b05f6f98b69e161e322-6cc435d8c3d43f02/tmp/clang_command_.tmp.0bb8ab.txt
++Contents of '/tmp/coderabbit-infer/eb49f3c49c0fbb217a2c4b05f6f98b69e161e322-6cc435d8c3d43f02/tmp/clang_command_.tmp.0bb8ab.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-clear-a

... [truncated 1058 characters] ...

ll/lib/clang/18/include"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-fdeprecated-macro" "-ferror-limit" "19" "-fgnuc-version=4.2.1"
"-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/6cc435d8c3d43f02/file.o" "-x" "c++"
"tests/fl/channels/validation.cpp" "-O0" "-fno-builtin" "-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"

examples/AutoResearch/AutoResearchRemote.cpp

In file included from examples/AutoResearch/AutoResearchRemote.cpp:14:
examples/AutoResearch/AutoResearchRemote.h:14:10: fatal error: 'fl/stl/stdint.h' file not found
14 | #include "fl/stl/stdint.h" // for uint32_t, uint8_t
| ^~~~~~~~~~~~~~~~~
1 error generated.
examples/AutoResearch/AutoResearchRemote.cpp:2776:5-12: ERROR translating statement 'ReturnStmt'
Aborting translation of method 'AutoResearchRemoteControl::startBleRemote' in file 'examples/AutoResearch/AutoResearchRemote.cpp': "Assert_failure src/clang/cAst_utils.ml:249:53"
Uncaught Internal Error: "Assert_failure src/clang/cAst_utils.ml:249:53"
Error backtrace:
Raised at ClangFrontend__CAst_utils.get_decl_from_typ_ptr in file "src/clang/cAst_utils.ml", line 249, characters 53-65
Called from ClangFrontend__CTrans.CTrans_funct.get_destructor_decl_ref in file "src/clang/cTrans.ml", line 658, characters 12-59
Called from ClangFrontend__CTrans.CTrans_funct.destructor_calls.(fun) in file "src/clang/cTrans.ml", li

... [truncated 2200 characters] ...

in file "src/istd/IExn.ml" (inlined), line 13, characters 2-50
Called from ClangFrontend__CTrans.CTrans_funct.instruction_log.(fun) in file "src/clang/cTrans.ml", line 4784, characters 10-1023
Called from ClangFrontend__CTrans.CTrans_funct.instruction in file "src/clang/cTrans.ml" (inlined), line 4765, characters 38-71
Called from ClangFrontend__CTrans.CTrans_funct.exec_with_node_creation in file "src/clang/cTrans.ml" (inlined), line 104, characters 20-38
Called from ClangFrontend__CTrans.CTrans_funct.get_clang_stmt_trans in file "src/clang/cTrans.ml" (inlined), line 5395, characters 4-69
Called from ClangFrontend__CTrans.CTrans_funct.get_custom_stmt_trans in file "src/clang/cTrans.ml", line 5401, characters 8-55
Called from ClangFrontend__CTrans.CTrans_funct.exec_trans_instrs.exec_trans_

tests/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp

tests/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp:384:1: error: extraneous closing brace ('}')
384 | } // FL_TEST_FILE
| ^
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/eb49f3c49c0fbb217a2c4b05f6f98b69e161e322-1f90fc3971ff3f3b/tmp/clang_command_.tmp.8e61ac.txt
++Contents of '/tmp/coderabbit-infer/eb49f3c49c0fbb217a2c4b05f6f98b69e161e322-1f90fc3971ff3f3b/tmp/clang_command_.tmp.8e61ac.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-di

... [truncated 1144 characters] ...

stem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-fdeprecated-macro" "-ferror-limit" "19" "-fgnuc-version=4.2.1"
"-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/1f90fc3971ff3f3b/file.o" "-x" "c++"
"tests/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp"
"-O0" "-fno-builtin" "-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp (1)

352-383: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Chunk sizing invariant is still broken: last ISR chunk can be smaller, triggering esp_lcd_panel_io_del from ISR via LcdSpiPeripheralEsp::transmit().

  • ChannelDriverLcdClockless::isrChunkDone() clamps chunkBytes to the remaining bytes (lines 268-272), so dmaBytes passed to mPeripheral->transmit() can differ between chunks when maxSize isn’t an exact multiple of mChunkInputBytes (e.g. maxSize=1025, requestedChunkInputBytes=1024 ⇒ chunkInputBytes=513, chunks: 513 then 512).
  • LcdSpiPeripheralEsp::transmit() recreates mPanelIo whenever size_bytes != mLastTransmitSize, calling esp_lcd_panel_io_del() (lines 342-352), which undermines the deadlock-avoidance rationale in the chunk sizing comment (lines 360-363).

Options:

  • Make ISR transmits always use a fixed size by not clamping chunkBytes to the remainder (encodeChunk already zero-fills beyond data.size()), so size_bytes stays constant across ISR re-arms.
  • If smaller final chunks are acceptable, update the chunk sizing comment to remove the claim that chunkInputBytes evenly divides maxSize / all ISR-driven chunks carry the same DMA byte count.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp`
around lines 352 - 383, The chunk-sizing logic still allows a smaller final ISR
chunk so dmaBytes passed to mPeripheral->transmit() can differ between ISR
transmits and cause LcdSpiPeripheralEsp::transmit() to recreate mPanelIo
(triggering esp_lcd_panel_io_del from ISR); to fix, change
ChannelDriverLcdClockless::isrChunkDone() to stop clamping chunkBytes to the
remaining bytes and always emit the full chunkInputBytes (encodeChunk already
zero-fills past data.size()), ensuring every ISR call passes the same size_bytes
to mPeripheral->transmit() and avoids mLastTransmitSize changes; alternatively,
if variable final chunks are intended, update the chunk-sizing comment around
chunkInputBytes/numChunks to remove the claim that chunks all carry the same DMA
byte count and ensure LcdSpiPeripheralEsp::transmit() does not call
esp_lcd_panel_io_del from ISR contexts.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp`:
- Around line 352-383: The chunk-sizing logic still allows a smaller final ISR
chunk so dmaBytes passed to mPeripheral->transmit() can differ between ISR
transmits and cause LcdSpiPeripheralEsp::transmit() to recreate mPanelIo
(triggering esp_lcd_panel_io_del from ISR); to fix, change
ChannelDriverLcdClockless::isrChunkDone() to stop clamping chunkBytes to the
remaining bytes and always emit the full chunkInputBytes (encodeChunk already
zero-fills past data.size()), ensuring every ISR call passes the same size_bytes
to mPeripheral->transmit() and avoids mLastTransmitSize changes; alternatively,
if variable final chunks are intended, update the chunk-sizing comment around
chunkInputBytes/numChunks to remove the claim that chunks all carry the same DMA
byte count and ensure LcdSpiPeripheralEsp::transmit() does not call
esp_lcd_panel_io_del from ISR contexts.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5158c863-8ec3-43e8-bce3-028103caa6b4

📥 Commits

Reviewing files that changed from the base of the PR and between 9e3b9eb and eb49f3c.

📒 Files selected for processing (11)
  • autoresearch
  • ci/autoresearch/args.py
  • ci/autoresearch/phases.py
  • ci/tests/test_autoresearch_phases.py
  • examples/AutoResearch/AutoResearch.ino
  • examples/AutoResearch/AutoResearchRemote.cpp
  • examples/AutoResearch/AutoResearchTest.h
  • src/fl/channels/validation.cpp.hpp
  • src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp
  • tests/fl/channels/validation.cpp
  • tests/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp

@zackees
zackees merged commit dcf1d4e into master Jun 3, 2026
9 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 3, 2026
@zackees
zackees deleted the fix/2687-2688-autoresearch-lcd-chunks branch August 21, 2026 19:15
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.

follow-up: avoid shrinking LCD_CLOCKLESS chunks from #2648 follow-up: align AutoResearch lane-count validation from #2648

1 participant