fix(lr2021): live LF↔HF reconfigure via full begin() - #11279
fix(lr2021): live LF↔HF reconfigure via full begin()#11279Ethan-chen1234-zy wants to merge 3 commits into
Conversation
…06 / assert when live-switching Sub-GHz ↔ LORA_24.
⚡ 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 (31)
Build artifacts expire on 2026-08-29. Updated for |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesRadio reconfiguration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant LR20x0Interface
participant lora
participant RX
LR20x0Interface->>LR20x0Interface: Compare requested and previous frequency bands
LR20x0Interface->>lora: Run full begin() for a band hop
lora-->>LR20x0Interface: Return initialization result
LR20x0Interface->>RX: Restart reception
LR20x0Interface->>lora: Apply incremental settings within the same band
lora-->>LR20x0Interface: Return parameter results
LR20x0Interface->>RX: Restart reception
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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/mesh/LR20x0Interface.cpp`:
- Around line 193-225: Update the band-hop branch around lora.begin() to mirror
init()’s LF/HF reinitialization: apply the appropriate RF-switch GPIO state for
the new frequency, wait for TCXO settling, retry SPI command failures after the
established delay, and retry without TCXO for TCXO_OPTIONAL when applicable.
Replace the ignored setCRC, setRfSwitchTable, and setRxBoostedGainMode results
with the same error checking and logging used by init() and the same-band path,
preserving failure returns and critical-error handling.
🪄 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: f231aa66-9918-4a01-b6a6-1e31655b23bc
📒 Files selected for processing (1)
src/mesh/LR20x0Interface.cpp
…switch GPIOs, SPI/TCXO retries, and log CRC/RX-gain errors.
|
@Ethan-chen1234-zy please run trunk fmt. Thanks |
|
Done — ran trunk fmt and pushed. Thanks. |
|
@caveman99 Thanks — I tried #11234 alone on LR2021 dual-band HW (live US → LORA_24). #11234 alone avoids HardFault, but setOutputPower still fails while prefs save region=LORA_24. RF stays broken even after switching back to US (until reboot / cold begin()): INFO | Set radio: region=LORA_24, name=LongFast, config=0, ch=25, power=10
|
|
I opened a focused companion PR against this branch: Ethan-chen1234-zy#1 It fixes a MHz/Hz mismatch in the external LF/HF RF-switch GPIO selection, propagates rejected reconfiguration steps instead of restarting RX and returning success, and adds LF/HF boundary plus bidirectional transition tests. I do not have LR2021 hardware attached. The remaining useful check is the same live |
Summary
reconfigure()(no reboot).setOutputPoweracross Sub-GHz ↔ 2.4 GHz can return RadioLib-706; the oldassertHardFaulted before config save.lora.begin(...); same-band changes stay on the incremental path. Power failures are logged +CRITICALERRORinstead of asserting.Scope
src/mesh/LR20x0Interface.cpponly (USE_LR2021).init()→begin()), non-LR2021 radios, or same-band live reconfigure.Test plan
lora.region=LORA_24: logLF/HF band hop ... full begin(), no-706/ reset; region persists.LORA_24still OK.USE_LR2021boards if available.Summary by CodeRabbit