Skip to content

add LR 2021 to portduino, and allow Framebuffer devices to rotate the screen from config - #11252

Open
caveman99 wants to merge 1 commit into
developfrom
lr2021-k230
Open

add LR 2021 to portduino, and allow Framebuffer devices to rotate the screen from config#11252
caveman99 wants to merge 1 commit into
developfrom
lr2021-k230

Conversation

@caveman99

@caveman99 caveman99 commented Jul 27, 2026

Copy link
Copy Markdown
Member

Requires meshtastic/device-ui#355 and supersedes #10567 and #11138

Many thanks to the original authors https://github.com/a-li3n and https://github.com/jessm33

N.B. This PR enables meshtasticd with framebuffer MUI on Lilygo T-Display K230

Summary by CodeRabbit

  • New Features

    • Added Portduino support for selecting and initializing the LR2021 LoRa module.
    • Added configurable LR2021 maximum power settings, including high-frequency operation.
    • Added configurable framebuffer display rotation for Portduino setups.
  • Bug Fixes

    • Improved configuration handling to prevent display and radio settings from interfering with one another.
    • Enabled LR2021 support across applicable Portduino builds.

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Flash this PR in the Web Flasher

firmware commit boards expires

Warning

This is an automated, unreviewed CI test build. Back up your device configuration
before flashing, and only flash devices you are able to recover.

Supported boards built by this PR (31)
Device Board Platform
Crowpanel Adv 3.5 TFT elecrow-adv-35-tft esp32-s3
Heltec HT62 heltec-ht62-esp32c3-sx1262 esp32-c3
Heltec Mesh Node 096 heltec-mesh-node-t096 nrf52840
Heltec Mesh Node T1 heltec-mesh-node-t1 nrf52840
Heltec Mesh Node T114 heltec-mesh-node-t114 nrf52840
Heltec V3 heltec-v3 esp32-s3
Heltec V4 heltec-v4 esp32-s3
Meshnology W10 meshnology_w10 esp32-s3
Meshnology W12 meshnology_w12 esp32-s3
Raspberry Pi Pico pico rp2040
Raspberry Pi Pico W picow rp2040
RAK WisMesh Pocket V3 rak_wismesh_pocket nrf52840
RAK WisMesh Pod rak_wismesh_pod nrf52840
RAK WisMesh Repeater Mini V2 rak_wismesh_repeater_mini nrf52840
RAK WisMesh Tag rak_wismeshtag nrf52840
RAK WisBlock 11200 rak11200 esp32
RAK WisBlock 11310 rak11310 rp2040
RAK3312 rak3312 esp32-s3
RAK WisBlock 4631 rak4631 nrf52840
Seeed SenseCAP Mesh-Tracker-X1 seeed_mesh_tracker_X1 nrf52840
Seeed Wio Tracker L1 seeed_wio_tracker_L1 nrf52840
Seeed Xiao NRF52840 Kit seeed_xiao_nrf52840_kit nrf52840
Seeed Xiao ESP32-S3 seeed-xiao-s3 esp32-s3
Station G2 station-g2 esp32-s3
Station G3 station-g3 esp32-s3
LILYGO T-Deck t-deck-tft esp32-s3
LILYGO T-Echo t-echo nrf52840
LILYGO T-Echo Plus t-echo-plus nrf52840
LILYGO T-Impulse Plus t-impulse-plus nrf52840
LilyGo T3-C6 tlora-c6 esp32-c6
Seeed SenseCAP T1000-E tracker-t1000-e nrf52840

Build artifacts expire on 2026-08-26. Updated for 79a3b6b.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Portduino now supports LR2021 module selection, configuration, power limits, and compilation. The framebuffer display path also exports configured rotation through MESHTASTIC_FB_ROTATION, while radio interface files clean up Portduino macro aliases.

Changes

Portduino LR2021 enablement

Layer / File(s) Summary
LR2021 configuration contract
src/platform/portduino/PortduinoGlue.h, src/platform/portduino/PortduinoGlue.cpp
Adds the use_lr2021 module, LR2021 power settings, YAML parsing, and conditional YAML emission.
LR2021 build and radio selection
src/mesh/LR2021Interface.cpp, src/mesh/LR20x0Interface.cpp, src/mesh/InterfacesTemplates.cpp, src/mesh/LR11x0Interface.cpp, src/mesh/RadioInterface.cpp
Enables LR2021 compilation for Portduino, instantiates the required template and radio interface, and removes temporary macro aliases.
Portduino framebuffer rotation
src/graphics/tftSetup.cpp
Calculates configured framebuffer rotation and exports it as MESHTASTIC_FB_ROTATION.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PortduinoConfig
  participant RadioInterface
  participant LR2021Interface
  PortduinoConfig->>RadioInterface: select use_lr2021
  RadioInterface->>LR2021Interface: construct LR2021Interface
  LR2021Interface-->>RadioInterface: provide radio interface
Loading

Possibly related PRs

Suggested labels: hardware-support, enhancement

Suggested reviewers: thebentern, nomdetom, vidplace7

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description is far shorter than the required template and omits the attestations, testing checklist, and bug-fix details. Replace the template boilerplate with a real summary and complete the attestations/testing checklist, including which devices were tested or not tested.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the two main changes: Portduino LR2021 support and framebuffer screen rotation from config.
✨ 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 lr2021-k230

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/platform/portduino/PortduinoGlue.h (1)

105-106: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use camelCase for the new member variables.

Rename lr2021_max_power and lr2021_max_power_hf to lr2021MaxPower and lr2021MaxPowerHf, updating their parser, emitter, and macro references accordingly.

As per coding guidelines, use PascalCase for classes, camelCase for functions and member variables, and UPPER_SNAKE_CASE for constants and defines.

🤖 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/platform/portduino/PortduinoGlue.h` around lines 105 - 106, Rename the
member variables lr2021_max_power and lr2021_max_power_hf to lr2021MaxPower and
lr2021MaxPowerHf, and update every parser, emitter, and macro reference to use
the new names consistently.

Source: Coding guidelines

🤖 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/LR11x0Interface.cpp`:
- Around line 381-385: Correct the cleanup comment above the `#undef` directives
to reference the actual member path portduino_config.rfswitch_dio_pins, removing
the duplicated portduino_config qualifier while leaving the macro cleanup
unchanged.

---

Nitpick comments:
In `@src/platform/portduino/PortduinoGlue.h`:
- Around line 105-106: Rename the member variables lr2021_max_power and
lr2021_max_power_hf to lr2021MaxPower and lr2021MaxPowerHf, and update every
parser, emitter, and macro reference to use the new names 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 Plus

Run ID: d6c95ece-98fc-4919-b359-b4c0208ab207

📥 Commits

Reviewing files that changed from the base of the PR and between 1e982fa and 79a3b6b.

📒 Files selected for processing (8)
  • src/graphics/tftSetup.cpp
  • src/mesh/InterfacesTemplates.cpp
  • src/mesh/LR11x0Interface.cpp
  • src/mesh/LR2021Interface.cpp
  • src/mesh/LR20x0Interface.cpp
  • src/mesh/RadioInterface.cpp
  • src/platform/portduino/PortduinoGlue.cpp
  • src/platform/portduino/PortduinoGlue.h

Comment on lines +381 to +385

// Undo the ARCH_PORTDUINO macro aliases. This would pollute
// `portduino_config.portduino_config.rfswitch_dio_pins`.
#undef rfswitch_dio_pins
#undef rfswitch_table

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the duplicated member qualifier in the cleanup comment.

The comment refers to portduino_config.portduino_config.rfswitch_dio_pins; the actual path is portduino_config.rfswitch_dio_pins.

Proposed fix
-// `portduino_config.portduino_config.rfswitch_dio_pins`.
+// `portduino_config.rfswitch_dio_pins`.
📝 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.

Suggested change
// Undo the ARCH_PORTDUINO macro aliases. This would pollute
// `portduino_config.portduino_config.rfswitch_dio_pins`.
#undef rfswitch_dio_pins
#undef rfswitch_table
// Undo the ARCH_PORTDUINO macro aliases. This would pollute
// `portduino_config.rfswitch_dio_pins`.
`#undef` rfswitch_dio_pins
`#undef` rfswitch_table
🤖 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/mesh/LR11x0Interface.cpp` around lines 381 - 385, Correct the cleanup
comment above the `#undef` directives to reference the actual member path
portduino_config.rfswitch_dio_pins, removing the duplicated portduino_config
qualifier while leaving the macro cleanup unchanged.

@caveman99 caveman99 added enhancement New feature or request hardware-support Hardware related: new devices or modules, problems specific to hardware labels Jul 27, 2026

@vidplace7 vidplace7 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently breaks the native-wasm target at link-time.

Linking .pio/build/native-wasm/meshnode.mjs
wasm-ld: error: .pio/build/native-wasm/src/mesh/RadioInterface.cpp.o: undefined symbol: LR2021Interface::LR2021Interface(LockingArduinoHal*, unsigned int, unsigned int, unsigned int, unsigned int)
em++: error: '/home/runner/work/firmware/firmware/emsdk-cache/emsdk-main/upstream/bin/wasm-ld @/tmp/emscripten_w_bs6_zi.rsp.utf-8' failed (returned 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request hardware-support Hardware related: new devices or modules, problems specific to hardware

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants