From dc4ea2c5ddbf0486136fc37f71aa9f1db17ef0a1 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Sun, 1 Jan 2023 10:56:09 +0100 Subject: [PATCH] possible quick and dirty fix for solving wrong byteorder problem --- tnc/data_handler.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tnc/data_handler.py b/tnc/data_handler.py index 373a825b..a0ccdea5 100644 --- a/tnc/data_handler.py +++ b/tnc/data_handler.py @@ -669,6 +669,26 @@ class DATA: # static.RX_FRAME_BUFFER += static.RX_BURST_BUFFER[i] temp_burst_buffer += bytes(value) # type: ignore + # TODO: Needs to be removed as soon as mode error is fixed + # catch possible modem error which leads into false byteorder + # modem possibly decodes too late - data then is pushed to buffer + # which leads into wrong byteorder + # Lets put this in try/except so we are not crashing tnc as its hihgly experimental + # This might only work for datac1 and datac3 + try: + #area_of_interest = (modem.get_bytes_per_frame(self.mode_list[speed_level] - 1) -3) * 2 + if static.RX_FRAME_BUFFER.endswith(temp_burst_buffer[:246] and len(temp_burst_buffer) >= 246): + self.log.warning( + "[TNC] ARQ | RX | wrong byteorder received - dropping data" + ) + # we need to run a return here, so we are not sending an ACK + return + except Exception as e: + self.log.warning( + "[TNC] ARQ | RX | wrong byteorder check failed", e=e + ) + + # if frame buffer ends not with the current frame, we are going to append new data # if data already exists, we received the frame correctly, # but the ACK frame didn't receive its destination (ISS)