mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-02 02:39:30 +00:00
joystick UI: channel-send heard-repeat feedback
After broadcasting a group message, wait 5s to see if any neighbor
repeated the flood and use the outcome to mark the on-device entry
and the BLE-app mirror.
- ContentionTracker gets extractDupeCount(hash): finds the tracked
entry, captures dupe_count, finalizes (folds into EMA, marks
inactive), returns the count or -1.
- BaseChatMesh::sendGroupMessage gains an optional out_hash param;
when set, the FNV-1a packet hash is also pre-registered with the
contention tracker so heard retransmits get counted (originated
floods weren't tracked before, only relays).
- Mesh::getContentionTracker() promoted to public so the UI can
query after the feedback window.
JoystickUITask grows a 4-slot pending-channel table with per-slot
k_timer (5s one-shot). startPendingChannel() broadcasts, adds the
local _ch_previews entry with path_len = OUT_PATH_SENT, and starts
the feedback timer. The timer ISR sets a feedback_due flag; the
loop's processPendingChannelFeedback() picks it up, calls
extractDupeCount(), and rewrites the preview's path_len to
OUT_PATH_SENT_HEARD (0xFD) or OUT_PATH_SENT_UNHEARD (0xFC) — which
formatHopCount renders as "sent+" / "sent?".
The deferred BLE-app mirror queues only on outcome with body prefix
"(>>✓) " (heard) or "(>>✗) " (not heard). queueLocalSentChannelMessage
gains a heard_repeat parameter for the selection.
Both channel send entry points (sendComposedMessage's channel branch
and sendChannelMessage) now route through startPendingChannel().
This commit is contained in:
@@ -502,7 +502,7 @@ int BaseChatMesh::sendCommandData(const ContactInfo &recipient, uint32_t timesta
|
||||
}
|
||||
|
||||
bool BaseChatMesh::sendGroupMessage(uint32_t timestamp, mesh::GroupChannel &channel,
|
||||
const char *sender_name, const char *text, int text_len)
|
||||
const char *sender_name, const char *text, int text_len, uint32_t *out_hash)
|
||||
{
|
||||
uint8_t temp[5 + MAX_TEXT_LEN + 32];
|
||||
memcpy(temp, ×tamp, 4);
|
||||
@@ -518,6 +518,15 @@ bool BaseChatMesh::sendGroupMessage(uint32_t timestamp, mesh::GroupChannel &chan
|
||||
|
||||
mesh::Packet *pkt = createGroupDatagram(PAYLOAD_TYPE_GRP_TXT, channel, temp, 5 + prefix_len + text_len);
|
||||
if (pkt) {
|
||||
if (out_hash) {
|
||||
/* Stash the FNV-1a hash for the caller and pre-register it with
|
||||
* the contention tracker so heard retransmits get counted. The
|
||||
* hash is content-only (payload_type + first 8 payload bytes),
|
||||
* unaffected by sendFlood's later path-hash bookkeeping. */
|
||||
uint32_t h = mesh::ContentionTracker::computePacketHash32(pkt);
|
||||
*out_hash = h;
|
||||
getContentionTracker().trackRetransmit(h, (uint32_t)_ms->getMillis());
|
||||
}
|
||||
sendFloodScoped(channel, pkt);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user