PR: Fix has_module_settings flag inconsistency in channel updates#10578
Draft
blahman5000 wants to merge 1 commit into
Draft
PR: Fix has_module_settings flag inconsistency in channel updates#10578blahman5000 wants to merge 1 commit into
blahman5000 wants to merge 1 commit into
Conversation
…ring has_module_settings=true when any module_settings field is non-zero.
Contributor
@blahman5000, 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 😄 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug where channels could be created/configured with populated
module_settings(e.g.,position_precision,is_muted) but leavehas_module_settings=false. This caused position and mute state to be ignored by downstream code.One consequence of this is that manual position requests on a channel configured for full-precision location would sometimes (depending on how the channel was created) return Null Island.
Root Cause
setChannel()was accepting incomingmeshtastic_Channelobjects without validating thehas_module_settingsflag. When a channel from an external source (phone API, etc.) carriedmodule_settingsdata but didn't set the flag, those settings would overwrite the stored channel while appearing disabled.Solution
Added normalization logic to
setChannel()andfixupChannel():If any
module_settingsfields are non-zero (position_precisionoris_muted), ensurehas_module_settings=true.Testing
Idempotent: calling
setChannel()multiple times on the same object has no side effects.fixupChannel()applies the same logic to stored channels at boot and on config changes (viaonConfigChanged()).Impact
Risk: Low — purely additive validation; no behavior changes for well-formed channels.
🤝 Attestations