Advertise repeat capability via capabilities bitmask#1909
Open
wbijen wants to merge 1 commit intomeshcore-dev:devfrom
Open
Advertise repeat capability via capabilities bitmask#1909wbijen wants to merge 1 commit intomeshcore-dev:devfrom
wbijen wants to merge 1 commit intomeshcore-dev:devfrom
Conversation
Use the existing FEAT1 advert field as a capabilities bitmask so nodes that forward packets (but aren't dedicated repeaters) can advertise this. Rename the generic FEAT1/extra1 internals to caps/capabilities. - Room server: sets ADVERT_CAP_REPEAT when repeat is enabled - Companion radio: sets ADVERT_CAP_REPEAT when client_repeat is on - Dedicated repeater: sets ADVERT_CAP_REPEAT for consistency Fully backwards compatible: old clients skip the 2-byte field per existing parser logic; old firmware sends no caps (defaults to 0). Co-Authored-By: Claude Opus 4.6 <[email protected]>
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
Implements #1906 — nodes that forward packets but aren't dedicated repeaters (room servers with repeat enabled, companions with
client_repeat) can now advertise this via a capabilities bitmask in the existing FEAT1 advert field.This helps companion apps distinguish relay-capable nodes in path displays and resolves hash collisions where a room server was being confused with a repeater (as reported in #1866 and #1707).
What changed
ADV_FEAT1_MASK→ADV_CAPS_MASK,setFeat1()/getFeat1()→setCapabilities()/getCapabilities(),_extra1→_caps. The old name was a placeholder that didn't communicate intent; "capabilities" is the standard term for this pattern in network protocols (Wi-Fi, BLE, etc.).ADVERT_CAP_REPEAT(0x0001) — first bit in the new capabilities bitmask, meaning "this node forwards packets".ADVERT_CAP_REPEATwhen repeat is enabled (!disable_fwd).ADVERT_CAP_REPEATwhenclient_repeatis on (3 call sites: manual advert, self-export, periodic advert).ADVERT_CAP_REPEATfor consistency, even thoughADV_TYPE_REPEATERalready implies it.Backwards compatibility
Fully backwards compatible in both directions:
ADV_CAPS_MASKbit simply skip the 2-byte field (this was already wired up in the parser).caps = 0, so the field is omitted from the wire — no extra bytes.Future capabilities
The uint16_t bitmask has 15 bits remaining. Some ideas that came up during discussion:
ADVERT_CAP_GPSADVERT_CAP_TELEMETRYThese don't have concrete firmware/app consumers yet, so they're not included in this PR — just noted here for future reference.
Test plan
heltec_v4_companion_radio_usbheltec_v4_room_serverheltec_v4_repeaterheltec_v4_sensor(unchanged, still passescaps = 0via default)client_repeaton → advert includes FEAT1 field with 0x0001