Skip to content

fix(stm32wl): smaller MAX_RX_TOPHONE and PACKETHISTORY_MAX on stm32wl - #11400

Merged
caveman99 merged 3 commits into
meshtastic:developfrom
t-miura:fix/stm32wl-reduce-packet-queues
Aug 12, 2026
Merged

fix(stm32wl): smaller MAX_RX_TOPHONE and PACKETHISTORY_MAX on stm32wl#11400
caveman99 merged 3 commits into
meshtastic:developfrom
t-miura:fix/stm32wl-reduce-packet-queues

Conversation

@t-miura

@t-miura t-miura commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Reducing MAX_RX_TOPHONE and PACKETHISTORY_MAX for stm32wl platform, guarded by ARCH_STM32WL,
to save/maintain some free RAM/heap while ensuring client connection via its serial working.

for MAX_RX_TO_PHONE it's fixed to 8 and it's open question that number is enough or not.
while PACKETHISTORY_MAX is tied to MAX_NUM_NODES which is currently set to 10 for stm32wl.

related PRs(to be added):

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)
      • Seeed Wio-E5 (STM32WL)
      • Wiznet W5500-EVB-Pico2 (RP2350, paired with Wio-SX1262)

Summary by CodeRabbit

  • Performance Improvements
    • Optimized packet handling for STM32WL devices by reducing the maximum queued packets and packet history size.
    • Helps lower memory usage while retaining support for the expected number of network nodes.

@github-actions

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Note

Building this pull request… the flash button, badges and supported-board
list will appear here automatically once CI finishes.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

STM32WL builds now use MAX_RX_TOPHONE value 8 and PACKETHISTORY_MAX value MAX_NUM_NODES * 2. Other platform limits remain unchanged.

Changes

STM32WL resource limits

Layer / File(s) Summary
Platform resource configuration
src/mesh/mesh-pb-constants.h
STM32WL uses 8 for MAX_RX_TOPHONE and MAX_NUM_NODES * 2 for PACKETHISTORY_MAX.

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

Suggested labels: bugfix

Suggested reviewers: caveman99, thebentern, nomdetom

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the STM32WL-specific reductions to MAX_RX_TOPHONE and PACKETHISTORY_MAX.
Description check ✅ Passed The description explains the purpose, platform scope, implementation, testing, and attestations, with only a non-critical related-PR placeholder remaining.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@t-miura t-miura changed the title fix(stm32wl): smaller MAX_RX_TOPHONE and PACKETHISTORY_MAX on stm32 platform fix(stm32wl): smaller MAX_RX_TOPHONE and PACKETHISTORY_MAX on stm32wl Aug 11, 2026
@t-miura
t-miura marked this pull request as ready for review August 11, 2026 06:12
Comment thread src/mesh/mesh-pb-constants.h
@t-miura
t-miura requested a review from caveman99 August 11, 2026 11:22
@t-miura

t-miura commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@caveman99
sorry, the previous changes for Router.cpp was not required(did wrong cherry-pick),
reverted, and the only file this PR will change is src/mesh/mesh-pb-constants.h

@t-miura

t-miura commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@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.

🧹 Nitpick comments (1)
src/mesh/mesh-pb-constants.h (1)

32-35: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shorten the MAX_RX_TOPHONE rationale comment.

Keep this comment to one or two lines. Retain only the non-obvious RAM rationale.

As per coding guidelines, comments must normally be one or two lines and must explain only non-obvious rationale.

Proposed comment reduction
-// Each slot is a ~340 B MeshPacket in the static pool (Router.cpp MAX_PACKETS_STATIC), so 32 slots
-// cost ~11 KB of .bss on the RAM-tightest platform (2.8.0 field reports: 99% heap). 16 still doubles
-// the 8 classic ESP32 has shipped with for years; drops start when a stalled phone/serial client has
-// 16 packets queued.
+// Keep 16 slots on RAM-tight NRF52840 boards to limit static MeshPacket memory.
+// A stalled phone/serial client can fill the queue and cause drops.
🤖 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/mesh-pb-constants.h` around lines 32 - 35, Shorten the rationale
comment above MAX_RX_TOPHONE to one or two lines, retaining only the non-obvious
RAM usage rationale for the slot count and removing historical, platform, and
operational details.

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.

Nitpick comments:
In `@src/mesh/mesh-pb-constants.h`:
- Around line 32-35: Shorten the rationale comment above MAX_RX_TOPHONE to one
or two lines, retaining only the non-obvious RAM usage rationale for the slot
count and removing historical, platform, and operational details.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6ce1869f-0d65-4988-a935-4f85a5589440

📥 Commits

Reviewing files that changed from the base of the PR and between b8dee13 and 3f04401.

📒 Files selected for processing (1)
  • src/mesh/mesh-pb-constants.h

@caveman99
caveman99 enabled auto-merge August 12, 2026 06:32
@caveman99
caveman99 added this pull request to the merge queue Aug 12, 2026
Merged via the queue into meshtastic:develop with commit 9199e6b Aug 12, 2026
60 of 62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants