feat(repeater/bot): !link, and move the path question to the node that can answer it

Correcting how I split the two bots. I gave !path to the Solo node and kept only
analyzer trivia here, which gets the direction backwards.

When you drive away with the handheld and ask "what link do I have home?", the
handheld's own !path is useless: it describes packets the handheld RECEIVED,
i.e. the reverse leg. Only a fixed node at home can answer the forward one,
because it is the thing your packet actually arrived at. So !path belongs here,
and !link joins it: hops + path + SNR + RSSI in one reply, so the question is one
command and not two while driving.

No duplicate answers in that scenario: when the question comes FROM the handheld,
the handheld is the sender and does not answer its own message, so only this node
replies. Two answers only appear when a third node asks -- which is exactly what
my earlier test did, which is why I mistook it for a general problem.

Second reason to answer from here, found while reading the Solo tree: a Solo
node's own bot reply is INVISIBLE in the phone app. tryBotReplyChannel() echoes
only to the local screen under #ifdef DISPLAY_CLASS
(MeshCore-solo/examples/companion_radio/MyMeshBot.h:220), and the only path into
a connected client is onChannelMessageRecv(), which runs for RECEIVED packets
only. A reply from a different node arrives over the air, so the app shows it
like any other message. Answering from here therefore fixes the "I cannot see
what my node said" confusion for free, with no change to the Solo firmware.

Verified live on #tth-test: !link -> "0 hop direct, SNR 13.2 dB, RSSI -43 dBm",
reply counter 2 -> 3.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5 committed 2026-08-04 19:45:15 +02:00
1 parent 58038729e9
commit 27f1339ac9
1 file changed
+11 -1
+11 -1
View File
@@ -57,7 +57,7 @@
#define BOT_REPLY_LEN 120 // well under the 184 B packet payload
#define BOT_TEXT_LEN 160 // inbound text, after the "<sender>: " prefix
#define BOT_PATH_STR_LEN 64 // "3f:a1:c8..." -- caps how many hops we print
#define BOT_FRAG_LEN 56 // one !command's answer
#define BOT_FRAG_LEN 72 // one !command's answer (!link je nejdelsi)
static int bot_hex_nibble(char c) {
if (c >= '0' && c <= '9') return c - '0';
@@ -179,6 +179,16 @@ int MyMesh::botCommandReply(char* out, int max_len, const char* cmd, const mesh:
botFormatPath(path, pkt);
return snprintf(out, max_len, "path %s (%d hop)", path, (int)pkt->getPathHashCount());
}
if (strcmp(cmd, "link") == 0) {
// "Jaky mam link domu?" v jednom prikazu. Zamerne slouceny path+snr: tohle
// se pta clovek v aute, ktery nema chut psat dva prikazy -- a jde o cestu
// JEHO paketu k NAM, cili presne ten smer, ktery si na svem uzlu overit
// neumi (tam vidi jen to, co prijima).
char path[BOT_PATH_STR_LEN];
botFormatPath(path, pkt);
return snprintf(out, max_len, "%d hop %s, SNR %.1f dB, RSSI %d dBm",
(int)pkt->getPathHashCount(), path, pkt->getSNR(), pkt->getRSSI());
}
if (strcmp(cmd, "snr") == 0) {
// Straight off the frame that carried the request -- the same numbers
// captureRx() files into the rxlog ring.