Skip to content

Re-enable wantresponse and other fields in simradio when on the decoded path#10934

Merged
thebentern merged 2 commits into
meshtastic:developfrom
ianmcorvidae:reallow-simradio-wantresponse
Jul 8, 2026
Merged

Re-enable wantresponse and other fields in simradio when on the decoded path#10934
thebentern merged 2 commits into
meshtastic:developfrom
ianmcorvidae:reallow-simradio-wantresponse

Conversation

@ianmcorvidae

@ianmcorvidae ianmcorvidae commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This was regressed by Copilot due to c92e69d#r3420608957

My machine's assessment suggests that this change was & is correct on the carryEncrypted branch added by that PR (#10730) generally, but on the existing side it clears out all the fields on the SIMULATOR_APP packet that are needed -- want_response is the one that mattered for my testing (running traceroutes over a simulated network) but other fields are also cleared by it.

Let me know if the machine has been too verbose in the commenting, heh.

Found due to work on meshtastic/python#946

🤝 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:
    • Portduino (native-tft)

Summary by CodeRabbit

  • Bug Fixes
    • Fixed simulator loopback so decoded packet details are only cleared for encrypted transmissions; non-encrypted sends now preserve previously decoded fields instead of unintentionally resetting them.
    • Improved consistency of how simulator packets are prepared before receive handling, resulting in more accurate message fields during simulation.

@github-actions

github-actions Bot commented Jul 7, 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 (27)
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
Raspberry Pi Pico pico rp2040
Raspberry Pi Pico W picow rp2040
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-06. Updated for 123f365.

@ianmcorvidae ianmcorvidae requested a review from thebentern July 7, 2026 21:36
@github-actions github-actions Bot added needs-review Needs human review bugfix Pull request that fixes bugs labels Jul 7, 2026
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8394cfd8-b1fd-4cad-a69a-71e3be2ed9b2

📥 Commits

Reviewing files that changed from the base of the PR and between ce1f709 and 123f365.

📒 Files selected for processing (1)
  • src/platform/portduino/SimRadio.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/platform/portduino/SimRadio.cpp

📝 Walkthrough

Walkthrough

The change modifies SimRadio::startSend() so that p->decoded is only reset when carryEncrypted is true. On the non-encrypted path, previously decoded Data fields are preserved, while payload and portnum are still updated for simulator loopback.

Changes

SimRadio Decoded Packet Handling

Layer / File(s) Summary
Conditional decoded field clearing in startSend
src/platform/portduino/SimRadio.cpp
p->decoded is cleared only when carryEncrypted is true; on the non-encrypted path, existing decoded fields are preserved while payload and portnum are still set for sim loopback.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: preserving decoded-path fields in SimRadio for simulator packets.
Description check ✅ Passed The description explains the regression, the fix, and includes the required attestations with testing details.
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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/platform/portduino/SimRadio.cpp (1)

255-265: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Logic looks correct; comment blocks exceed the repo comment-length rule.

The conditional clearing is sound: on the !carryEncrypted path perhapsDecode() has already produced a valid Data, and preserving want_response/reply_id/bitfield/… lets them survive the sim loopback (downstream PacketCache::cache and unpackAndReceive() only replace payload/portnum), which matches the PR intent. Union aliasing is also respected since c is a stack local and all p->encrypted reads complete before pb_encode_to_bytes writes p->decoded.payload.bytes.

The two explanatory blocks (Lines 256-259 and 262-265) are 4-line comments. The tradeoff is real here—the union-aliasing rationale is genuinely non-obvious—but consider tightening each to one or two lines to conform.

As per coding guidelines: "Keep code comments minimal: use at most one or two lines, only when the reason is not obvious; do not add multi-paragraph explanatory comments or restate what the next line does."

🤖 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/SimRadio.cpp` around lines 255 - 265, The logic in
SimRadio::... is fine, but the inline comments around the carryEncrypted branch
are too verbose and violate the repo’s comment-length rule. Tighten the two
explanatory blocks near p->decoded = meshtastic_Data_init_zero to one or two
lines each, keeping only the essential reason about preserving decoded fields on
the !carryEncrypted path and clearing the struct on the encrypted path.

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/platform/portduino/SimRadio.cpp`:
- Around line 255-265: The logic in SimRadio::... is fine, but the inline
comments around the carryEncrypted branch are too verbose and violate the repo’s
comment-length rule. Tighten the two explanatory blocks near p->decoded =
meshtastic_Data_init_zero to one or two lines each, keeping only the essential
reason about preserving decoded fields on the !carryEncrypted path and clearing
the struct on the encrypted path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: be943c82-5502-4aa2-8ca3-f2f622315356

📥 Commits

Reviewing files that changed from the base of the PR and between 8d20606 and ce1f709.

📒 Files selected for processing (1)
  • src/platform/portduino/SimRadio.cpp

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Firmware Size Report

23 targets | vs develop: 21 increased, 1 decreased, net +422,872 (+413.0 KB)

Target Flash vs develop RAM RAM vs develop
picow 1,273,780 📈 +28,900 (+28.2 KB) 152,508 n/a
pico2w 1,248,288 📈 +27,772 (+27.1 KB) 158,988 n/a
rak11310 832,856 📈 +27,432 (+26.8 KB) 86,320 n/a
pico 810,104 📈 +27,416 (+26.8 KB) 85,876 n/a
seeed_xiao_rp2040 808,304 📈 +27,400 (+26.8 KB) 85,868 n/a
Show 18 more target(s)
Target Flash vs develop RAM RAM vs develop
pico2 796,232 📈 +26,456 (+25.8 KB) 92,376 n/a
seeed_xiao_rp2350 794,384 📈 +26,448 (+25.8 KB) 92,368 n/a
t-deck-tft 3,833,600 📈 +22,928 (+22.4 KB) 108,008 n/a
heltec-vision-master-e213-inkhud 2,249,136 📈 +21,776 (+21.3 KB) 92,408 n/a
elecrow-adv-35-tft 3,436,944 📈 +20,320 (+19.8 KB) 94,640 n/a
rak3312 2,290,272 📈 +18,032 (+17.6 KB) 102,032 n/a
heltec-ht62-esp32c3-sx1262 2,152,400 📈 +17,408 (+17.0 KB) 112,004 n/a
seeed-xiao-s3 2,293,392 📈 +17,248 (+16.8 KB) 102,064 n/a
station-g3 2,283,392 📈 +17,040 (+16.6 KB) 101,848 n/a
station-g2 2,283,376 📈 +17,024 (+16.6 KB) 101,848 n/a
rak11200 1,877,536 📈 +16,928 (+16.5 KB) 87,052 n/a
heltec-v3 2,280,992 📈 +16,912 (+16.5 KB) 130,232 n/a
t-eth-elite 2,507,648 📈 +16,160 (+15.8 KB) 103,068 n/a
heltec-v4 2,293,152 📈 +15,856 (+15.5 KB) 101,112 n/a
tlora-c6 2,384,000 📈 +15,696 (+15.3 KB) 102,764 n/a
rak3172 182,824 📉 -3,472 (-3.4 KB) 25,000 n/a
wio-e5 239,820 📈 +1,192 (+1.2 KB) 26,640 n/a
meshnology_w10 2,463,776 136,212 n/a

Size budgets

Env Metric Measured Budget Used
rak4631 RAM (.data+.bss) n/a 113,000 n/a
rak4631 flash n/a 786,000 n/a

Budgets live in bin/ram_budgets.json and are raised deliberately in the PR that needs the headroom - never automatically.


Updated for ff7a707

@ianmcorvidae

Copy link
Copy Markdown
Contributor Author

I rather suspect that flash usage report isn't accurate given this PR is adding an if statement in portduino-only code, heh

@thebentern

Copy link
Copy Markdown
Contributor

I rather suspect that flash usage report isn't accurate given this PR is adding an if statement in portduino-only code, heh

It's totally off. Tom is investigating. Every PR shouldn't be growing 25k 😅

@thebentern thebentern merged commit ade4283 into meshtastic:develop Jul 8, 2026
94 of 96 checks passed
@ianmcorvidae ianmcorvidae deleted the reallow-simradio-wantresponse branch July 8, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants