From 926755171f3ffd0ca91f54f51c58fc9dd53fe172 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 30 Jun 2021 07:42:48 +0100 Subject: [PATCH] Fix the M17 FN handling. --- M17Control.cpp | 7 ++++--- Version.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/M17Control.cpp b/M17Control.cpp index f043d1a..b50c4ea 100644 --- a/M17Control.cpp +++ b/M17Control.cpp @@ -266,13 +266,15 @@ bool CM17Control::writeModem(unsigned char* data, unsigned int len) bool valid = errors < 12U; if (!valid) { + m_rfFN++; + frame[0U] = (m_rfFN >> 8) & 0xFFU; frame[1U] = (m_rfFN >> 0) & 0xFFU; ::memcpy(frame + 2U + 0U, M17_3200_SILENCE, 8U); ::memcpy(frame + 2U + 8U, M17_3200_SILENCE, 8U); } else { - m_rfFN = ((frame[0U] << 8) + (frame[1U] << 0)) & 0x7FU; + m_rfFN = (frame[0U] << 8) + (frame[1U] << 0); } LogDebug("M17, FN: %u, errs: %u/272 (%.1f%%)", m_rfFN & 0x7FU, errors, float(errors) / 2.72F); @@ -333,14 +335,13 @@ bool CM17Control::writeModem(unsigned char* data, unsigned int len) } m_rfFrames++; - m_rfFN++; m_rfLSFn++; if (m_rfLSFn >= 6U) m_rfLSFn = 0U; // Only check for the EOT marker if the frame has a reasonable BER - if (valid && (m_rfFN & 0x8000U) == 0x8000U) { + if (valid && ((m_rfFN & 0x8000U) == 0x8000U)) { std::string source = m_rfLSF.getSource(); std::string dest = m_rfLSF.getDest(); diff --git a/Version.h b/Version.h index 603de9a..bdbc8df 100644 --- a/Version.h +++ b/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20210628"; +const char* VERSION = "20210630"; #endif