From fe88e0e4c363700e24d22bfbb43dd408e5e3d9b8 Mon Sep 17 00:00:00 2001 From: mikecarper Date: Thu, 4 Jun 2026 12:41:50 -0700 Subject: [PATCH] Support direct repeater outpath --- docs/cli_commands.md | 2 ++ examples/simple_repeater/MyMesh.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/docs/cli_commands.md b/docs/cli_commands.md index 2cb818c61..1b7db6e14 100644 --- a/docs/cli_commands.md +++ b/docs/cli_commands.md @@ -749,6 +749,7 @@ This document provides an overview of CLI commands that can be sent to MeshCore **Usage:** - `get outpath` - `set outpath ` +- `set outpath direct` - `set outpath clear` - `set outpath flood` @@ -759,6 +760,7 @@ This document provides an overview of CLI commands that can be sent to MeshCore - These commands require remote client context (they target the caller's ACL entry). - The path hash size is inferred from the hop hash width. - `outpath` overrides the primary direct route used for replies to the caller. +- `direct` sets a zero-hop direct route for a caller reachable without repeaters. - `clear` forgets the current direct path and allows normal path discovery to repopulate it. - `flood` forces replies to use flood packets until the client logs in again. diff --git a/examples/simple_repeater/MyMesh.cpp b/examples/simple_repeater/MyMesh.cpp index 2cc6f117f..7cb6b005c 100644 --- a/examples/simple_repeater/MyMesh.cpp +++ b/examples/simple_repeater/MyMesh.cpp @@ -1194,6 +1194,10 @@ static bool parsePathCommand(char* raw, uint8_t* out_path, uint8_t& out_path_len out_path_len = OUT_PATH_FORCE_FLOOD; return true; } + if (strcmp(spec, "direct") == 0) { + out_path_len = 0; + return true; + } uint8_t hash_size = 0; uint8_t hop_count = 0; @@ -1251,6 +1255,10 @@ static void formatPathReply(const uint8_t* path, uint8_t path_len, char* out, si snprintf(out, out_len, "> invalid"); return; } + if ((path_len & 63) == 0) { + snprintf(out, out_len, "> direct"); + return; + } uint8_t hash_size = (path_len >> 6) + 1; uint8_t hop_count = path_len & 63;