From 6ec7465f0a29ac568aab3e0b9a2fd341b8280802 Mon Sep 17 00:00:00 2001 From: Maia Piechocki Date: Tue, 16 Sep 2025 20:39:01 -0700 Subject: [PATCH] processByte now accounts for log length --- tinyTransfer.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tinyTransfer.cpp b/tinyTransfer.cpp index a577569..57ef70c 100644 --- a/tinyTransfer.cpp +++ b/tinyTransfer.cpp @@ -219,15 +219,23 @@ bool TinyTransferUpdateParser::processByte(uint8_t byte){ //If checksum of header matches header checksum in the array if(redo_checksum == inputPacket.headerChecksum){ - //Empty packet - still valid - if (inputPacket.payloadSize == 0) { + // Empty packet - still valid + if (inputPacket.payloadSize == 0 && inputPacket.logSize == 0) { init(); return true; } - //Transition to payload parsing - state = TINY_TRANSFER_PARSER_PAYLOAD; - position = 0; + else if (inputPacket.payloadSize == 0 && inputPacket.logSize > 0) { + state = TINY_TRANSFER_PARSER_LOG; + position = 0; + + } + else { + // Transition to payload parsing + state = TINY_TRANSFER_PARSER_PAYLOAD; + position = 0; + } + } //invalid checksum, start over again