From d2b858e51f157be1c6e2ee1a823c25a49e249a18 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 3 Apr 2016 19:21:24 +0100 Subject: [PATCH] Align with 48kHz branch. --- DMRSlotRX.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/DMRSlotRX.cpp b/DMRSlotRX.cpp index c95b0aa..35b48d6 100644 --- a/DMRSlotRX.cpp +++ b/DMRSlotRX.cpp @@ -104,11 +104,11 @@ bool CDMRSlotRX::processSample(q15_t sample) m_bitBuffer[m_bitPtr] |= 0x01U; if (m_state == DMRRXS_NONE) { - if (m_dataPtr >= 420U && m_dataPtr <= 500U) + if (m_dataPtr >= 420U && m_dataPtr <= 455U) correlateSync(); } else { - uint16_t min = m_syncPtr - 2U; - uint16_t max = m_syncPtr + 2U; + uint16_t min = m_syncPtr - 1U; + uint16_t max = m_syncPtr + 1U; if (m_dataPtr >= min && m_dataPtr <= max) correlateSync(); } @@ -128,8 +128,6 @@ bool CDMRSlotRX::processSample(q15_t sample) slotType.decode(frame + 1U, colorCode, dataType); if (colorCode == m_colorCode) { - DEBUG5("DMRSlotRX: data sync found slot/pos/centre/threshold", m_slot ? 2U : 1U, int16_t(m_dataPtr) - 420, m_centre, m_threshold); - m_syncCount = 0U; m_n = 0U; @@ -137,6 +135,7 @@ bool CDMRSlotRX::processSample(q15_t sample) switch (dataType) { case DT_DATA_HEADER: + DEBUG5("DMRSlotRX: data header found slot/pos/centre/threshold", m_slot ? 2U : 1U, int16_t(m_dataPtr) - 420, m_centre, m_threshold); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); m_state = DMRRXS_DATA; m_type = dataType; @@ -145,27 +144,33 @@ bool CDMRSlotRX::processSample(q15_t sample) case DT_RATE_34_DATA: case DT_RATE_1_DATA: if (m_state == DMRRXS_DATA) { - serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); - m_type = dataType; + DEBUG5("DMRSlotRX: data payload found slot/pos/centre/threshold", m_slot ? 2U : 1U, int16_t(m_dataPtr) - 420, m_centre, m_threshold); + serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); + m_type = dataType; } break; case DT_VOICE_LC_HEADER: + DEBUG5("DMRSlotRX: voice header found slot/pos/centre/threshold", m_slot ? 2U : 1U, int16_t(m_dataPtr) - 420, m_centre, m_threshold); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); m_state = DMRRXS_VOICE; break; case DT_VOICE_PI_HEADER: - if (m_state == DMRRXS_VOICE) + if (m_state == DMRRXS_VOICE) { + DEBUG5("DMRSlotRX: voice pi header found slot/pos/centre/threshold", m_slot ? 2U : 1U, int16_t(m_dataPtr) - 420, m_centre, m_threshold); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); + } m_state = DMRRXS_VOICE; break; case DT_TERMINATOR_WITH_LC: if (m_state == DMRRXS_VOICE) { + DEBUG5("DMRSlotRX: voice terminator found slot/pos/centre/threshold", m_slot ? 2U : 1U, int16_t(m_dataPtr) - 420, m_centre, m_threshold); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); m_state = DMRRXS_NONE; m_endPtr = NOENDPTR; } break; default: // DT_CSBK + DEBUG5("DMRSlotRX: csbk found slot/pos/centre/threshold", m_slot ? 2U : 1U, int16_t(m_dataPtr) - 420, m_centre, m_threshold); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); m_state = DMRRXS_NONE; m_endPtr = NOENDPTR;