From 4f388c0b981f324e2729bed3ad15a579b1c3b0b8 Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Fri, 22 May 2026 09:11:12 +0200 Subject: [PATCH] companion: fix "62 hops" garbage in local-sent BLE mirror frames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- zephcore/app/CompanionMesh.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/zephcore/app/CompanionMesh.cpp b/zephcore/app/CompanionMesh.cpp index 9df3eae..ccf8fc8 100644 --- a/zephcore/app/CompanionMesh.cpp +++ b/zephcore/app/CompanionMesh.cpp @@ -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;