From 16bf9d574535b232e8e635f9cf0def2fab8ca9e6 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 25 Jan 2019 11:38:03 +0000 Subject: [PATCH] Don't forget to descramble the byte first. --- DStarControl.cpp | 2 +- DStarDefines.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/DStarControl.cpp b/DStarControl.cpp index 6846cfd..75cef55 100644 --- a/DStarControl.cpp +++ b/DStarControl.cpp @@ -347,7 +347,7 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len) // Check for the fast data signature if (m_rfState == RS_RF_AUDIO) { - unsigned char slowDataType = data[DSTAR_VOICE_FRAME_LENGTH_BYTES + 1U] & DSTAR_SLOW_DATA_TYPE_MASK; + unsigned char slowDataType = (data[DSTAR_VOICE_FRAME_LENGTH_BYTES + 1U] ^ DSTAR_SCRAMBLER_BYTE1) & DSTAR_SLOW_DATA_TYPE_MASK; if (slowDataType == DSTAR_SLOW_DATA_TYPE_FAST_DATA1 || slowDataType == DSTAR_SLOW_DATA_TYPE_FAST_DATA2) { LogMessage("D-Star, switching to fast data mode"); m_rfState = RS_RF_DATA; diff --git a/DStarDefines.h b/DStarDefines.h index 821a7e2..3f826ac 100644 --- a/DStarDefines.h +++ b/DStarDefines.h @@ -67,6 +67,10 @@ const unsigned char DSTAR_ACK_FLAG = 0x03U; const unsigned char DSTAR_NO_RESPONSE = 0x02U; const unsigned char DSTAR_RELAY_UNAVAILABLE = 0x01U; +const unsigned char DSTAR_SCRAMBLER_BYTE1 = 0x70U; +const unsigned char DSTAR_SCRAMBLER_BYTE2 = 0x4FU; +const unsigned char DSTAR_SCRAMBLER_BYTE3 = 0x93U; + const unsigned char DSTAR_SYNC_BYTES[] = {0x55U, 0x2DU, 0x16U}; const unsigned char DSTAR_DTMF_MASK[] = { 0x82U, 0x08U, 0x20U, 0x82U, 0x00U, 0x00U, 0x82U, 0x00U, 0x00U };