mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-01 21:08:19 +00:00
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:
@@ -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);
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user