mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-24 09:12:58 +00:00
companion: fix "62 hops" garbage in local-sent BLE mirror frames
The phone app interprets path_len with an unconditional `& 63`, so the OUT_PATH_SENT (0xFE) sentinel we were writing into the offline-queue frame became "62 hops" + 4 bogus path bytes in the app's UI. There are 0 LoRa hops between the sender (us) and the phone viewing the message — path_len = 0 is both correct and renders cleanly as "direct / 0 hops". The "(>>✓) " / "(>>✗) " body prefix still distinguishes wio-originated messages from incoming. OUT_PATH_SENT remains the marker for the joystick UI's own local entries (UnreadScreen, _ch_previews) — formatHopCount handles it explicitly so it's safe there.
This commit is contained in:
1 parent
516536db1c
commit
4f388c0b98
1 file changed
+9
-2
@@ -796,7 +796,12 @@ void CompanionMesh::queueLocalSentContactMessage(const ContactInfo &contact,
|
||||
}
|
||||
memcpy(&frame[i], contact.id.pub_key, 6);
|
||||
i += 6;
|
||||
frame[i++] = OUT_PATH_SENT; // mark as locally-originated
|
||||
/* path_len = 0 → phone app renders "0 hops" / direct. OUT_PATH_SENT
|
||||
* (0xFE) gets misrendered as "62 hops" because the app does
|
||||
* path_len & 63 unconditionally. We're not over the air for the
|
||||
* BLE-app mirror; "0 hops between sender and viewer" is literally
|
||||
* true when you sent it yourself. */
|
||||
frame[i++] = 0;
|
||||
frame[i++] = TXT_TYPE_PLAIN;
|
||||
put_le32(&frame[i], timestamp);
|
||||
i += 4;
|
||||
@@ -841,7 +846,9 @@ void CompanionMesh::queueLocalSentChannelMessage(uint8_t channel_idx,
|
||||
frame[i++] = PACKET_CHANNEL_MSG_RECV;
|
||||
}
|
||||
frame[i++] = channel_idx;
|
||||
frame[i++] = OUT_PATH_SENT;
|
||||
/* path_len = 0 (matches the DM mirror — phone renders "0 hops"
|
||||
* instead of garbled-modulo-63 for OUT_PATH_SENT). */
|
||||
frame[i++] = 0;
|
||||
frame[i++] = TXT_TYPE_PLAIN;
|
||||
put_le32(&frame[i], timestamp);
|
||||
i += 4;
|
||||
|
||||
Reference in new issue
Block a user