From de908a83c1fb139fd2a45227ac78304ef82aaed6 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 15 Jan 2016 06:10:54 +0000 Subject: [PATCH] Start handling data frames and restrict sync detection range for DMR. --- DMRDefines.h | 3 ++- DMRSlotRX.cpp | 11 +++-------- README.md | 2 +- SerialPort.cpp | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/DMRDefines.h b/DMRDefines.h index c839bd5..2592500 100644 --- a/DMRDefines.h +++ b/DMRDefines.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2015 by Jonathan Naylor G4KLX + * Copyright (C) 2009-2016 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 @@ -75,6 +75,7 @@ const uint8_t DT_VOICE_PI_HEADER = 0U; const uint8_t DT_VOICE_LC_HEADER = 1U; const uint8_t DT_TERMINATOR_WITH_LC = 2U; const uint8_t DT_CSBK = 3U; +const uint8_t DT_DATA_HEADER = 6U; const uint8_t DT_IDLE = 9U; // All others are for data transfer diff --git a/DMRSlotRX.cpp b/DMRSlotRX.cpp index 2545a1d..c024dcb 100644 --- a/DMRSlotRX.cpp +++ b/DMRSlotRX.cpp @@ -98,7 +98,7 @@ bool CDMRSlotRX::processSample(q15_t sample) // The approximate position of the sync samples, XXX to be updated later // XXX change range when m_endPtr is set, make it tighter. - if (m_dataPtr >= 160U && m_dataPtr <= 530U) + if (m_dataPtr >= 375U && m_dataPtr <= 530U) correlateSync(sample); if (m_dataPtr == m_endPtr) { @@ -118,15 +118,10 @@ bool CDMRSlotRX::processSample(q15_t sample) frame[0U] |= dataType; switch (dataType) { + case DT_DATA_HEADER: case DT_VOICE_LC_HEADER: - DEBUG3("DMRSlotRX: LC header for slot with color code", m_slot ? 2U : 1U, colorCode); - m_receiving = true; - m_syncCount = 0U; - m_n = 0U; - serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); - break; case DT_VOICE_PI_HEADER: - DEBUG3("DMRSlotRX: PI header for slot with color code", m_slot ? 2U : 1U, colorCode); + DEBUG4("DMRSlotRX: header for slot with color code/data type", m_slot ? 2U : 1U, colorCode, dataType); m_receiving = true; m_syncCount = 0U; m_n = 0U; diff --git a/README.md b/README.md index 189b1e4..4a9b3a6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -This is the source code of the MMDVM firmware that supports D-Star, DMR< and +This is the source code of the MMDVM firmware that supports D-Star, DMR, and System Fusion. Currently it only runs on the Arduino Due, but other platforms are planned. diff --git a/SerialPort.cpp b/SerialPort.cpp index d176cff..869b7d2 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -56,7 +56,7 @@ const uint8_t MMDVM_DEBUG4 = 0xF4U; const uint8_t MMDVM_DEBUG5 = 0xF5U; const uint8_t MMDVM_SAMPLES = 0xF8U; -const uint8_t HARDWARE[] = "MMDVM 20160114 (D-Star/DMR/System Fusion)"; +const uint8_t HARDWARE[] = "MMDVM 20160115 (D-Star/DMR/System Fusion)"; const uint8_t PROTOCOL_VERSION = 1U;