Double-press: fall back to first channel with position enabled when primary precision == 0#11005
Conversation
…rimary precision == 0
📝 WalkthroughWalkthrough
ChangesPosition ping routing
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 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 |
@fgimenezm, Welcome to Meshtastic!Thanks for opening your first pull request. We really appreciate it. We discuss work as a team in discord, please join us in the #firmware channel. Welcome to the team 😄 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/mesh/MeshService.cpp (1)
311-311: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueInclude missing context in the fallback log.
Consider including
wantRepliesandchannelin this log message to match the formatting of the analogous NodeInfo ping log on line 324. This improves observability when debugging fallback routing.💡 Proposed fix
- LOG_INFO("No channel with position enabled; sending nodeinfo instead to 0x%08x", dest); + LOG_INFO("No channel with position enabled; sending nodeinfo instead to 0x%08x, wantReplies=%d, channel=%d", dest, wantReplies, node->channel);🤖 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/MeshService.cpp` at line 311, Update the fallback LOG_INFO call in MeshService to include the wantReplies and channel values, matching the formatting and context of the analogous NodeInfo ping log while retaining the existing destination information.
🤖 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/MeshService.cpp`:
- Line 311: Update the fallback LOG_INFO call in MeshService to include the
wantReplies and channel values, matching the formatting and context of the
analogous NodeInfo ping log while retaining the existing destination
information.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: bfb9017a-9f72-47c0-acc2-2c9dfd610bf7
📒 Files selected for processing (1)
src/mesh/MeshService.cpp
caveman99
left a comment
There was a problem hiding this comment.
Would it be too much to ask to test compile your code before you submit it?
Double-press: fall back to first channel with position enabled when primary precision == 0
Summary
Make the double-press "send position" action use the same channel-selection logic used by automatic position broadcasts: prefer the node's current channel, but if that channel's position precision is
0, fall back to the lowest-indexed channel (0..7) with a non-zero position precision. If no channel exposes position, fall back to sending NodeInfo.Problem / Background
PositionModule::sendOurPosition()).MeshService::trySendPosition()) historically always sent onnode->channel. If that channel'sposition_precision == 0no position message is sent.What changed
src/mesh/MeshService.cppMeshService::trySendPosition(NodeNum dest, bool wantReplies)getPositionPrecisionForChannel(node->channel) != 0, send onnode->channel(unchanged).0..7for the first channel withgetPositionPrecisionForChannel(ch) != 0and send the position on that channel.nodeInfoModule->sendOurNodeInfo(dest, wantReplies, node->channel)(mirrors the prior fallback when no valid position exists).This preserves
destandwantRepliessemantics and matches automatic broadcast selection.Rationale for NodeInfo fallback
Files changed
src/mesh/MeshService.cpp(single, localized change intrySendPosition)Test plan (manual)
module_settings.position_precision = 0module_settings.position_precision > 0INPUT_BROKER_SEND_PING.Send position ping to 0x..., channel=<secondary index>Suggested logs to verify:
Risk / compatibility
MeshService::trySendPosition.References
https://meshtastic.org/docs/configuration/tips/#sharing-location-on-a-private-secondary-channel
Summary by CodeRabbit