Don't forget to descramble the byte first.

This commit is contained in:
Jonathan Naylor 2019-01-25 11:38:03 +00:00
parent a9b7179d13
commit 16bf9d5745
2 changed files with 5 additions and 1 deletions

View file

@ -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;

View file

@ -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 };