sync with upstream but held off the companion CLI

This commit is contained in:
liquidraver committed 2026-08-29 22:08:59 +02:00
1 parent ca280c52ed
commit 7331ca6c58
10 files changed
+105 -30

No files matched your search

+9 -2
View File
@@ -318,6 +318,13 @@ void BaseChatMesh::onPeerDataRecv(mesh::Packet *packet, uint8_t type, int sender
} else {
sendAckTo(from, (uint8_t *)&ack_hash, 4);
}
} else {
/* Includes TXT_TYPE_CLI_COMMAND (v1.18+). Upstream's companion
* executes it when the contact carries flag 0x10; ZephCore
* deliberately does not — see devdocs/UPSTREAM_TRACKER.md. Logged
* rather than dropped silently so the case is diagnosable. */
LOG_DBG("onPeerDataRecv: unhandled text type flags=%d from '%s'",
flags, from.name);
}
} else if (type == PAYLOAD_TYPE_REQ && len > 4) {
uint32_t sender_timestamp;
@@ -533,14 +540,14 @@ int BaseChatMesh::sendMessage(const ContactInfo &recipient, uint32_t timestamp,
}
int BaseChatMesh::sendCommandData(const ContactInfo &recipient, uint32_t timestamp, uint8_t attempt,
const char *text, uint32_t &est_timeout)
uint8_t txt_type, const char *text, uint32_t &est_timeout)
{
int text_len = strlen(text);
if (text_len > MAX_TEXT_LEN) return MSG_SEND_FAILED;
uint8_t temp[5 + MAX_TEXT_LEN + 1];
memcpy(temp, &timestamp, 4);
temp[4] = (attempt & 3) | (TXT_TYPE_CLI_DATA << 2);
temp[4] = (attempt & 3) | (txt_type << 2);
memcpy(&temp[5], text, text_len + 1);
mesh::Packet *pkt = createDatagram(PAYLOAD_TYPE_TXT_MSG, recipient.id,
+5 -2
View File
@@ -193,8 +193,11 @@ public:
virtual bool sendSelfAdvert(bool flood) { (void)flood; return false; }
int sendMessage(const ContactInfo &recipient, uint32_t timestamp, uint8_t attempt, const char *text,
uint32_t &expected_ack, uint32_t &est_timeout);
int sendCommandData(const ContactInfo &recipient, uint32_t timestamp, uint8_t attempt, const char *text,
uint32_t &est_timeout);
/* @param txt_type TXT_TYPE_CLI_DATA (understood by every MeshCore version)
* or TXT_TYPE_CLI_COMMAND (v1.18+ only). Callers that must reach older
* repeaters have to keep using TXT_TYPE_CLI_DATA. */
int sendCommandData(const ContactInfo &recipient, uint32_t timestamp, uint8_t attempt,
uint8_t txt_type, const char *text, uint32_t &est_timeout);
/* @param out_hash if non-null, filled with the FNV-1a packet hash so the
* caller can later query the contention tracker for "how many neighbors
* heard and retransmitted this?" — used by the joystick UI's send-feedback
+2 -1
View File
@@ -10,8 +10,9 @@
#include <string.h>
#define TXT_TYPE_PLAIN 0 // a plain text message
#define TXT_TYPE_CLI_DATA 1 // a CLI command
#define TXT_TYPE_CLI_DATA 1 // a CLI command -or- reply
#define TXT_TYPE_SIGNED_PLAIN 2 // plain text, signed by sender
#define TXT_TYPE_CLI_COMMAND 3 // a CLI command (explicitly), v1.18+
#define DATA_TYPE_RESERVED 0x0000 // reserved for future use
#define DATA_TYPE_DEV 0xFFFF // developer namespace for experimenting with group/channel datagrams
@@ -1113,7 +1113,9 @@ bool RepeaterAdminScreen::sendCLI(const char *cmd)
}
uint32_t ts = _rtc ? _rtc->getCurrentTimeUnique() : k_uptime_get_32();
uint32_t est_timeout = 0;
int result = mesh->sendCommandData(*contact, ts, 0, cmd, est_timeout);
/* TXT_TYPE_CLI_DATA, not TXT_TYPE_CLI_COMMAND: this talks to repeaters of
* any vintage, and type 3 is only understood from v1.18 on. */
int result = mesh->sendCommandData(*contact, ts, 0, TXT_TYPE_CLI_DATA, cmd, est_timeout);
if (result == MSG_SEND_FAILED) {
_task->showAlert("Send failed", 1500);
return false;