Fixes SEEED Indicator when booting to BaseUI - #11125
Conversation
⚡ Try this PR in the Web FlasherWarning This is an automated, unreviewed CI test build. Back up your device configuration Supported boards built by this PR (30)
Build artifacts expire on 2026-08-20. Updated for |
📝 WalkthroughWalkthrough
ChangesSenseCAP SPI setup
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@src/main.cpp`:
- Around line 1115-1124: Replace the multi-paragraph comment above the SPI
restart with a concise one- or two-line summary stating that the panel
initialization can stop the shared SPI2 bus and that the bus must be restarted
before using the radio. Keep the existing implementation and ordering unchanged.
🪄 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 Plus
Run ID: 2c6d2774-a164-4554-a1da-d1c9c1b997b7
📒 Files selected for processing (1)
src/main.cpp
| // The ST7701 panel shares SCK/MOSI/MISO (41/48/47) with the SX1262, and its host is SPI2_HOST, | ||
| // which on the S3 is the same peripheral as the Arduino `SPI` object (FSPI == SPI2). | ||
| // LovyanGFX bit-bangs the ST7701 init sequence on those pins, and because this variant builds | ||
| // with USE_ARDUINO_HAL_GPIO it does so via Arduino pinMode()/digitalWrite(). pinMode() calls | ||
| // perimanSetPinBus(.., ESP32_BUS_TYPE_GPIO, ..), whose deinit callback (spiDetachBus_SCK) ends | ||
| // up in spiStopBus() and gates the SPI2 clock. RadioLib then spins forever in spiTransferByte() | ||
| // waiting on cmd.update, which never clears on a stopped peripheral, and the watchdog fires. | ||
| // | ||
| // Restart the bus here, after the panel is up and before the radio is touched. Note that | ||
| // SPIClass::begin() early-returns when _spi is already non-NULL, so end() first is required. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Shorten the multi-paragraph explanatory comment.
As per coding guidelines, keep code comments minimal—one or two lines maximum—and do not add multi-paragraph explanatory blocks. Consider moving this detailed background explanation to the pull request description or a separate documentation file.
♻️ Proposed fix to simplify the comment
- // The ST7701 panel shares SCK/MOSI/MISO (41/48/47) with the SX1262, and its host is SPI2_HOST,
- // which on the S3 is the same peripheral as the Arduino `SPI` object (FSPI == SPI2).
- // LovyanGFX bit-bangs the ST7701 init sequence on those pins, and because this variant builds
- // with USE_ARDUINO_HAL_GPIO it does so via Arduino pinMode()/digitalWrite(). pinMode() calls
- // perimanSetPinBus(.., ESP32_BUS_TYPE_GPIO, ..), whose deinit callback (spiDetachBus_SCK) ends
- // up in spiStopBus() and gates the SPI2 clock. RadioLib then spins forever in spiTransferByte()
- // waiting on cmd.update, which never clears on a stopped peripheral, and the watchdog fires.
- //
- // Restart the bus here, after the panel is up and before the radio is touched. Note that
- // SPIClass::begin() early-returns when _spi is already non-NULL, so end() first is required.
+ // Restart SPI to recover the bus after LovyanGFX bit-bangs the shared LoRa pins.
+ // SPI.end() is required first because begin() early-returns if already initialized.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // The ST7701 panel shares SCK/MOSI/MISO (41/48/47) with the SX1262, and its host is SPI2_HOST, | |
| // which on the S3 is the same peripheral as the Arduino `SPI` object (FSPI == SPI2). | |
| // LovyanGFX bit-bangs the ST7701 init sequence on those pins, and because this variant builds | |
| // with USE_ARDUINO_HAL_GPIO it does so via Arduino pinMode()/digitalWrite(). pinMode() calls | |
| // perimanSetPinBus(.., ESP32_BUS_TYPE_GPIO, ..), whose deinit callback (spiDetachBus_SCK) ends | |
| // up in spiStopBus() and gates the SPI2 clock. RadioLib then spins forever in spiTransferByte() | |
| // waiting on cmd.update, which never clears on a stopped peripheral, and the watchdog fires. | |
| // | |
| // Restart the bus here, after the panel is up and before the radio is touched. Note that | |
| // SPIClass::begin() early-returns when _spi is already non-NULL, so end() first is required. | |
| // Restart SPI to recover the bus after LovyanGFX bit-bangs the shared LoRa pins. | |
| // SPI.end() is required first because begin() early-returns if already initialized. |
🤖 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/main.cpp` around lines 1115 - 1124, Replace the multi-paragraph comment
above the SPI restart with a concise one- or two-line summary stating that the
panel initialization can stop the shared SPI2 bus and that the bus must be
restarted before using the radio. Keep the existing implementation and ordering
unchanged.
Source: Coding guidelines
Summary by CodeRabbit