Skip to content

Send has_connection's key and set_autoadd_config's hop limit - #129

Merged
fdlamotte merged 1 commit into
meshcore-dev:mainfrom
hamsolodev:has-connection-autoadd-hops
Nov 22, 2026
Merged

fdlamotte merged 1 commit into
meshcore-dev:mainfrom
hamsolodev:has-connection-autoadd-hops

Conversation

@hamsolodev

Copy link
Copy Markdown
Contributor

What was wrong (#119, B1 and B2)

  • has_connection() sent only 0x1c. The firmware handles CMD_HAS_CONNECTION only with the server's 32-byte public key after it (MyMesh.cpp:1741, len >= 1 + PUB_KEY_SIZE), so the call was always refused.
  • set_autoadd_config sent one byte, so it couldn't set the hop limit. The firmware reads an optional autoadd_max_hops after the flags, capped at 64 (MyMesh.cpp:2023-2028).

What changed

Verified

  • Unit tests next to the existing wrapper tests; test_has_connection_wrapper now expects the key. They fail on current main.
  • The whole suite passes on 3.11 and 3.14.
  • Against companion v1.18.0 under MeshBench, with a repeater held as a contact. On current main:
sent     1c
answered 01 01        (ERR_CODE_UNSUPPORTED_CMD)
sent     3a 0e

On this branch:

sent     1c bd38ecc4…a4fc
answered 01 02        (ERR_CODE_NOT_FOUND: the handler ran; a room server would be needed to see OK)
sent     3a 0e 05
answered 00
sent     3b
answered 19 0e 00

The read-back shows hop limit 0 rather than 5. The host build's own min() (meshcore-native variants/host/HostArduino.h) returns a reference to its by-value argument, and that reference dangles, so the simulator stores 0. It's a simulator fault, not the firmware's: on a radio, the third byte is stored as sent (capped at 64).

Part of #119.

- has_connection sent only the command code, which the firmware refuses
  (ERR_CODE_UNSUPPORTED_CMD): CMD_HAS_CONNECTION wants the server's 32-byte
  key after it. It now takes the destination and sends its key.
- set_autoadd_config takes an optional max_hops, sent as the byte after
  the flags (the firmware caps it at 64). get_autoadd_config already reads
  it back.

Part of meshcore-dev#119 (B1, B2).
@hamsolodev
hamsolodev marked this pull request as ready for review November 22, 2026 00:13
@fdlamotte
fdlamotte merged commit 13435a1 into meshcore-dev:main Nov 22, 2026
@hamsolodev
hamsolodev deleted the has-connection-autoadd-hops branch November 25, 2026 22:16
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