Skip to content

Advertise repeat capability via FEAT1 flags#1909

Open
wbijen wants to merge 1 commit intomeshcore-dev:devfrom
wbijen:feature/feat1-repeat-capability
Open

Advertise repeat capability via FEAT1 flags#1909
wbijen wants to merge 1 commit intomeshcore-dev:devfrom
wbijen:feature/feat1-repeat-capability

Conversation

@wbijen
Copy link
Contributor

@wbijen wbijen commented Mar 3, 2026

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

  • Added ADVERT_CAP_REPEAT (0x0001) — first bit in the FEAT1 bitmask, meaning "this node forwards packets".
  • buildAdvertData() and createSelfAdvert() gain an optional feat1 parameter (default 0, no extra bytes on wire).
  • Room server sets ADVERT_CAP_REPEAT when repeat is enabled (!disable_fwd).
  • Companion radio sets ADVERT_CAP_REPEAT when client_repeat is on (3 call sites: manual advert, self-export, periodic advert).
  • Dedicated repeater sets ADVERT_CAP_REPEAT for consistency, even though ADV_TYPE_REPEATER already implies it.

The generic FEAT1 naming is kept intentionally — the 16-bit field carries different kinds of information (capabilities, flags, properties) depending on context, so a neutral name fits better than something specific.

Backwards compatibility

Fully backwards compatible in both directions:

  • Old clients that see the ADV_FEAT1_MASK bit simply skip the 2-byte field (already wired up in the parser).
  • Old firmware sends feat1 = 0, so the field is omitted from the wire — no extra bytes.

Future FEAT1 bits

The uint16_t bitmask has 15 bits remaining. Some candidates:

Bit Idea Rationale Related
TBD ADVERT_FLAG_OPEN_ROOM Room server has no password (or uses default) — apps could show a lock/unlock icon without needing a round-trip and skip the login screen PR #901
TBD ADVERT_FLAG_READONLY Room server has allow_read_only enabled — apps could indicate guest access is available

These don't have concrete firmware/app consumers yet, so they're not included — just noted for future reference.

Test plan

  • Builds cleanly against heltec_v4_companion_radio_usb
  • Builds cleanly against heltec_v4_room_server
  • Builds cleanly against heltec_v4_repeater
  • Builds cleanly against heltec_v4_sensor (unchanged, still passes feat1 = 0 via default)
  • Verify on-air: companion with client_repeat on → advert includes FEAT1 field with 0x0001
  • Verify on-air: room server with repeat → advert includes FEAT1 field with 0x0001
  • Verify old companion app still parses adverts correctly (skips unknown 2 bytes)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wbijen wbijen changed the title Advertise repeat capability via capabilities bitmask Advertise repeat capability via FEAT1 flags Mar 4, 2026
@wbijen wbijen force-pushed the feature/feat1-repeat-capability branch from 4f00d2c to 2ede14e Compare March 4, 2026 09:24
@jbrazio
Copy link
Contributor

jbrazio commented Mar 6, 2026

Please see meshcore-dev/meshcore.js#17

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