diff --git a/docs/cli_commands.md b/docs/cli_commands.md index cfbbe25ad..d1cba8f96 100644 --- a/docs/cli_commands.md +++ b/docs/cli_commands.md @@ -943,6 +943,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` - `get altpath` @@ -956,6 +957,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. - `altpath` is an optional second direct route used for duplicate response attempts. diff --git a/docs/halo_keymind_settings.md b/docs/halo_keymind_settings.md index 72fd0db7d..ca2c08032 100644 --- a/docs/halo_keymind_settings.md +++ b/docs/halo_keymind_settings.md @@ -77,7 +77,7 @@ set flood.retry.ignore none | `battery.alert.low` | Warning threshold percentage. Must be greater than `battery.alert.critical`. | `get battery.alert.low`, `set battery.alert.low <1-100>` | `set battery.alert.low 20` | | `battery.alert.critical` | Critical threshold percentage. Critical warnings repeat more often. | `get battery.alert.critical`, `set battery.alert.critical <0-99>` | `set battery.alert.critical 10` | | `recent.repeater` | Shows, seeds, or clears the recent repeater prefix/SNR table used by direct retry and bridge freshness checks. | `get recent.repeater`, `get recent.repeater `, `set recent.repeater `, `clear recent.repeater` | `set recent.repeater A1B2C3 -8.5` | -| `outpath` | Overrides the primary direct route used for replies to the current remote client. | `get outpath`, `set outpath `, `set outpath clear`, `set outpath flood` | `set outpath A1B2C3,D4E5F6` | +| `outpath` | Overrides the primary direct route used for replies to the current remote client. | `get outpath`, `set outpath `, `set outpath direct`, `set outpath clear`, `set outpath flood` | `set outpath A1B2C3,D4E5F6` | | `altpath` | Optional second direct route used for duplicate response attempts to the current remote client. | `get altpath`, `set altpath `, `set altpath clear` | `set altpath A1B2C3,D4E5F6` | ## Other Keymind Commands @@ -155,6 +155,7 @@ hex characters, and all hops in one path must use the same width. ```text get outpath set outpath A1B2C3,D4E5F6 +set outpath direct set outpath clear set outpath flood @@ -163,10 +164,11 @@ set altpath A1B2C3,D4E5F6 set altpath clear ``` -`set outpath clear` forgets the override and lets normal path discovery fill it -again. `set outpath flood` forces replies to use flood packets until the client -logs in again. `altpath` sends a duplicate reply over a second direct route; -clearing it returns replies to a single route. +`set outpath direct` sets a zero-hop direct route for a client reachable without +repeaters. `set outpath clear` forgets the override and lets normal path +discovery fill it again. `set outpath flood` forces replies to use flood packets +until the client logs in again. `altpath` sends a duplicate reply over a second +direct route; clearing it returns replies to a single route. ## Direct Retry Settings diff --git a/examples/simple_repeater/MyMesh.cpp b/examples/simple_repeater/MyMesh.cpp index d6e8a0c13..46508c32f 100644 --- a/examples/simple_repeater/MyMesh.cpp +++ b/examples/simple_repeater/MyMesh.cpp @@ -579,7 +579,7 @@ static bool pathsEqual(const uint8_t* a, uint8_t a_len, const uint8_t* b, uint8_ } static bool hasUsablePath(const uint8_t* path, uint8_t path_len) { - return path != NULL && mesh::Packet::isValidPathLen(path_len) && (path_len & 63) > 0; + return path != NULL && mesh::Packet::isValidPathLen(path_len); } static bool buildRepeatersChannel(mesh::GroupChannel& channel) { @@ -2529,6 +2529,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; @@ -2586,6 +2590,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;