diff --git a/M17Control.cpp b/M17Control.cpp index 0b5f0fd..4b2cfdc 100644 --- a/M17Control.cpp +++ b/M17Control.cpp @@ -78,7 +78,6 @@ m_rfErrs(0U), m_rfBits(1U), m_rfLSF(), m_rfLSFn(0U), -m_rfFN(0U), m_netLSF(), m_netLSFn(0U), m_rssiMapper(rssiMapper), @@ -189,7 +188,6 @@ bool CM17Control::writeModem(unsigned char* data, unsigned int len) m_aveRSSI = m_rssi; m_rssiCount = 1U; m_rfLSFn = 0U; - m_rfFN = 0U; #if defined(DUMP_M17) openFile(); @@ -238,7 +236,6 @@ bool CM17Control::writeModem(unsigned char* data, unsigned int len) m_maxRSSI = m_rssi; m_aveRSSI = m_rssi; m_rssiCount = 1U; - m_rfFN = 0U; #if defined(DUMP_M17) openFile(); @@ -257,11 +254,9 @@ bool CM17Control::writeModem(unsigned char* data, unsigned int len) unsigned char frame[M17_FN_LENGTH_BYTES + M17_PAYLOAD_LENGTH_BYTES]; unsigned int errors = conv.decodeData(data + 2U + M17_SYNC_LENGTH_BYTES + M17_LICH_FRAGMENT_FEC_LENGTH_BYTES, frame); - m_rfFN = (frame[0U] << 8) + (frame[1U] << 0); + uint16_t fn = (frame[0U] << 8) + (frame[1U] << 0); - LogDebug("M17, audio: FN: %u, errs: %u/272 (%.1f%%)", m_rfFN & 0x7FFFU, errors, float(errors) / 2.72F); - - m_rfFN++; + LogDebug("M17, audio: FN: %u, errs: %u/272 (%.1f%%)", fn & 0x7FFFU, errors, float(errors) / 2.72F); m_rfBits += 272U; m_rfErrs += errors; @@ -324,8 +319,10 @@ bool CM17Control::writeModem(unsigned char* data, unsigned int len) if (m_rfLSFn >= 6U) m_rfLSFn = 0U; - // Only check for the EOT marker if the frame has a reasonable BER - if ((m_rfFN & 0x8000U) == 0x8000U) { + bool bValid = (fn & 0x7FFFU) < (210U * 25U); // 210 seconds maximum + bool bEnd = (fn & 0x8000U) == 0x8000U; + + if (bValid && bEnd) { std::string source = m_rfLSF.getSource(); std::string dest = m_rfLSF.getDest(); diff --git a/M17Control.h b/M17Control.h index e8eab8e..5339d33 100644 --- a/M17Control.h +++ b/M17Control.h @@ -68,7 +68,6 @@ private: unsigned int m_rfBits; CM17LSF m_rfLSF; unsigned int m_rfLSFn; - unsigned int m_rfFN; CM17LSF m_netLSF; unsigned int m_netLSFn; CRSSIInterpolator* m_rssiMapper; diff --git a/M17Defines.h b/M17Defines.h index 85c07ff..dd2fe37 100644 --- a/M17Defines.h +++ b/M17Defines.h @@ -26,7 +26,6 @@ const unsigned int M17_FRAME_LENGTH_BYTES = M17_FRAME_LENGTH_BITS / 8U; const unsigned char M17_LINK_SETUP_SYNC_BYTES[] = {0x55U, 0xF7U}; const unsigned char M17_STREAM_SYNC_BYTES[] = {0xFFU, 0x5DU}; -const unsigned char M17_PACKET_SYNC_BYTES[] = {0x75U, 0xFFU}; const unsigned int M17_SYNC_LENGTH_BITS = 16U; const unsigned int M17_SYNC_LENGTH_BYTES = M17_SYNC_LENGTH_BITS / 8U; diff --git a/Sync.cpp b/Sync.cpp index 5ec1f88..6d38bbd 100644 --- a/Sync.cpp +++ b/Sync.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2018,2020,2021 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,9 +99,3 @@ void CSync::addM17StreamSync(unsigned char* data) ::memcpy(data, M17_STREAM_SYNC_BYTES, M17_SYNC_LENGTH_BYTES); } -void CSync::addM17PacketSync(unsigned char* data) -{ - assert(data != NULL); - - ::memcpy(data, M17_PACKET_SYNC_BYTES, M17_SYNC_LENGTH_BYTES); -} diff --git a/Sync.h b/Sync.h index 2ca7818..6190ae1 100644 --- a/Sync.h +++ b/Sync.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2018,2020,2021 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +35,6 @@ public: static void addM17LinkSetupSync(unsigned char* data); static void addM17StreamSync(unsigned char* data); - static void addM17PacketSync(unsigned char* data); private: }; diff --git a/Version.h b/Version.h index 25555d8..c4fd038 100644 --- a/Version.h +++ b/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20210817"; +const char* VERSION = "20210818"; #endif