joystick UI: handle SENT_HEARD/UNHEARD in buildChannelReplyPrefix

After Phase J, the joystick UI rewrites a sent channel message's
path_len from OUT_PATH_SENT (0xFE) to OUT_PATH_SENT_HEARD (0xFD) or
OUT_PATH_SENT_UNHEARD (0xFC) once the feedback window resolves.
buildChannelReplyPrefix only excluded OUT_PATH_SENT, so a reply to
one of the user's own messages (post-feedback) would treat it as
incoming and build a garbled "@[<random body>]" prefix.

Also cleans up an awkward `class ContentionTracker&` qualifier in
Mesh.h.
This commit is contained in:
liquidraver
2026-05-21 22:31:51 +02:00
parent 03fcc60fa9
commit e778326ad0
2 changed files with 10 additions and 6 deletions
@@ -541,13 +541,16 @@ static inline void renderT9Keypad(JoystickDisplay &display, const char * const *
/* ===== buildChannelReplyPrefix ===== */
/* Builds "@[SenderName] " from a "SenderName: text" channel message.
* Returns false for outbound messages (OUT_PATH_SENT) or if no ": " separator
* is found. out_buf must be at least (name_len + 5) bytes; 38 is always safe. */
* Returns false for outbound messages (any OUT_PATH_SENT* marker) or if
* no ": " separator is found. out_buf must be at least (name_len + 5)
* bytes; 38 is always safe. */
static inline bool buildChannelReplyPrefix(
const char *msg, uint8_t path_len,
char *out_buf, size_t out_size
){
if (path_len == OUT_PATH_SENT) return false;
if (path_len == OUT_PATH_SENT ||
path_len == OUT_PATH_SENT_HEARD ||
path_len == OUT_PATH_SENT_UNHEARD) return false;
const char *sep = strstr(msg, ": ");
if (!sep || sep == msg) return false;
size_t nlen = (size_t)(sep - msg);
+4 -3
View File
@@ -34,13 +34,14 @@ class Mesh : public Dispatcher {
void routeDirectRecvAcks(Packet *packet, uint32_t delay_millis);
DispatcherAction forwardMultipartDirect(Packet *pkt);
protected:
ContentionTracker _contention;
public:
/* Made public so the UI layer can query/extract per-packet dupe counts
* for outbound-flood feedback (joystick channel-send "heard a repeat?"). */
class ContentionTracker& getContentionTracker() { return _contention; }
const class ContentionTracker& getContentionTracker() const { return _contention; }
ContentionTracker& getContentionTracker() { return _contention; }
const ContentionTracker& getContentionTracker() const { return _contention; }
protected:
ContentionTracker _contention;
#ifdef CONFIG_ZEPHCORE_APC
PowerController _power_ctrl;
PowerController& getPowerController() { return _power_ctrl; }