From 537384ea5baf0fc153f9e5e683d6e86b22511741 Mon Sep 17 00:00:00 2001 From: zjs81 Date: Tue, 20 Jan 2026 21:50:35 -0700 Subject: [PATCH] fix: add safety margin to text message overhead calculations --- lib/connector/meshcore_protocol.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/connector/meshcore_protocol.dart b/lib/connector/meshcore_protocol.dart index 8469d61..f9241e8 100644 --- a/lib/connector/meshcore_protocol.dart +++ b/lib/connector/meshcore_protocol.dart @@ -195,8 +195,8 @@ const int maxFrameSize = 172; const int appProtocolVersion = 3; // Matches firmware MAX_TEXT_LEN (10 * CIPHER_BLOCK_SIZE). const int maxTextPayloadBytes = 160; -const int _sendTextMsgOverheadBytes = 1 + 1 + 1 + 4 + 6 + 1; -const int _sendChannelTextMsgOverheadBytes = 1 + 1 + 1 + 4 + 1; +const int _sendTextMsgOverheadBytes = 1 + 1 + 1 + 4 + 6 + 1 + 2; // +2 safety margin +const int _sendChannelTextMsgOverheadBytes = 1 + 1 + 1 + 4 + 1 + 2; // +2 safety margin int maxContactMessageBytes() { final byFrame = maxFrameSize - _sendTextMsgOverheadBytes;