Skip to content

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

Merged
thebentern merged 4 commits into
developfrom
lr2021-k230
Jul 30, 2026
Merged

add LR 2021 to portduino, and allow Framebuffer devices to rotate the screen from config#11252
thebentern merged 4 commits 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 (including native/WASM builds).
    • Added configurable LR2021 maximum power limits (standard and high-frequency) with YAML import/export.
    • Added framebuffer rotation configuration via an environment value derived from the display rotation settings.
  • Bug Fixes
    • Corrected which LR2021/LR20x0 interfaces are compiled and selected for Portduino and native targets, improving build consistency.
    • Improved safety by handling failures when setting the framebuffer rotation environment value, using a default if needed.

@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-29. Updated for f83988b.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • ✅ Review completed - (🔄 Check again to review again)
📝 Walkthrough

Walkthrough

Portduino now supports LR2021 module selection, configuration, power limits, and compilation. The framebuffer display path 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, variants/native/portduino/platformio.ini
Enables LR2021 compilation for Portduino, builds it for native WASM, instantiates the radio interface, and removes temporary macro aliases.
Portduino framebuffer rotation
src/graphics/tftSetup.cpp
Calculates configured framebuffer rotation, exports it as MESHTASTIC_FB_ROTATION, and logs environment-setting failures.

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 interface
Loading

Possibly related PRs

Suggested reviewers: vidplace7

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is far shorter than the template and omits the required attestations and testing details. Replace the template text with the required sections, including attestations and any testing/regression notes, and mention if hardware was not tested.
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.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two main changes: LR2021 Portduino support and configurable framebuffer rotation.
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.
✨ Finishing Touches 💡 1
📝 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 thread src/mesh/LR11x0Interface.cpp
@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)

@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

🤖 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/graphics/tftSetup.cpp`:
- Around line 65-68: Check the return value of setenv in the rotation setup
block and call LOG_ERROR when updating MESHTASTIC_FB_ROTATION fails. Preserve
the existing rotation value formatting and environment-variable behavior on
success.
🪄 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: 2f1722ef-f2fb-41f4-ba43-93c541ac5206

📥 Commits

Reviewing files that changed from the base of the PR and between 84d0580 and 81efeb5.

📒 Files selected for processing (9)
  • 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
  • variants/native/portduino/platformio.ini
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/mesh/RadioInterface.cpp
  • src/mesh/InterfacesTemplates.cpp
  • src/mesh/LR11x0Interface.cpp
  • variants/native/portduino/platformio.ini
  • src/platform/portduino/PortduinoGlue.h
  • src/platform/portduino/PortduinoGlue.cpp
  • src/mesh/LR20x0Interface.cpp

Comment thread src/graphics/tftSetup.cpp Outdated
initLoRa() constructs LR2021Interface for Lora.Module: lr2021, so excluding
the file from the native-wasm source filter left the constructor undefined at
link time. LR20x0Interface.cpp stays excluded; it is template-only and comes in
via the InterfacesTemplates.cpp amalgamation.

Also replace the non-UTF-8 degree signs in the framebuffer rotation comment and
correct the rfswitch alias cleanup comment.
@thebentern
thebentern added this pull request to the merge queue Jul 30, 2026
Merged via the queue into develop with commit 047c4e9 Jul 30, 2026
100 checks passed
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.

3 participants