Add sync location debugging messages.

This commit is contained in:
Jonathan Naylor 2016-03-07 18:17:26 +00:00
parent 1e7b5a7951
commit 8bb07f62bd
2 changed files with 20 additions and 12 deletions

View File

@ -19,16 +19,16 @@
#if !defined(CONFIG_H) #if !defined(CONFIG_H)
#define CONFIG_H #define CONFIG_H
// #define WANT_DEBUG #define WANT_DEBUG
// Allow the use of the COS line to lockout the modem // Allow the use of the COS line to lockout the modem
// #define USE_COS_AS_LOCKOUT // #define USE_COS_AS_LOCKOUT
// For the original Arduino Due pin layout // For the original Arduino Due pin layout
// #define ARDUINO_DUE_PAPA #define ARDUINO_DUE_PAPA
// For the new Arduino Due pin layout // For the new Arduino Due pin layout
#define ARDUINO_DUE_ZUM // #define ARDUINO_DUE_ZUM
// For the SP8NTH board // For the SP8NTH board
// #define ARDUINO_DUE_NTH // #define ARDUINO_DUE_NTH

View File

@ -119,25 +119,25 @@ bool CDMRSlotRX::processSample(q15_t sample)
switch (dataType) { switch (dataType) {
case DT_DATA_HEADER: case DT_DATA_HEADER:
DEBUG3("DMRSlotRX: data header for slot/data type", m_slot ? 2U : 1U, dataType); // DEBUG3("DMRSlotRX: data header for slot/data type", m_slot ? 2U : 1U, dataType);
m_endPtr = NOENDPTR; m_endPtr = NOENDPTR;
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
break; break;
case DT_VOICE_LC_HEADER: case DT_VOICE_LC_HEADER:
DEBUG3("DMRSlotRX: voice header for slot/data type", m_slot ? 2U : 1U, dataType); // DEBUG3("DMRSlotRX: voice header for slot/data type", m_slot ? 2U : 1U, dataType);
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
break; break;
case DT_VOICE_PI_HEADER: case DT_VOICE_PI_HEADER:
DEBUG3("DMRSlotRX: pi header for slot/data type", m_slot ? 2U : 1U, dataType); // DEBUG3("DMRSlotRX: pi header for slot/data type", m_slot ? 2U : 1U, dataType);
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
break; break;
case DT_TERMINATOR_WITH_LC: case DT_TERMINATOR_WITH_LC:
DEBUG2("DMRSlotRX: terminator for slot", m_slot ? 2U : 1U); // DEBUG2("DMRSlotRX: terminator for slot", m_slot ? 2U : 1U);
m_endPtr = NOENDPTR; m_endPtr = NOENDPTR;
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
break; break;
default: default:
DEBUG3("DMRSlotRX: data sync for slot/data type", m_slot ? 2U : 1U, dataType); // DEBUG3("DMRSlotRX: data sync for slot/data type", m_slot ? 2U : 1U, dataType);
m_endPtr = NOENDPTR; m_endPtr = NOENDPTR;
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
break; break;
@ -145,14 +145,14 @@ bool CDMRSlotRX::processSample(q15_t sample)
} }
} else if (m_control == 0x20U) { } else if (m_control == 0x20U) {
// Voice sync // Voice sync
DEBUG2("DMRSlotRX: voice sync for slot", m_slot ? 2U : 1U); // DEBUG2("DMRSlotRX: voice sync for slot", m_slot ? 2U : 1U);
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
m_syncCount = 0U; m_syncCount = 0U;
m_n = 0U; m_n = 0U;
} else { } else {
m_syncCount++; m_syncCount++;
if (m_syncCount >= MAX_SYNC_LOST_FRAMES) { if (m_syncCount >= MAX_SYNC_LOST_FRAMES) {
DEBUG2("DMRSlotRX: lost for slot", m_slot ? 2U : 1U); // DEBUG2("DMRSlotRX: lost for slot", m_slot ? 2U : 1U);
serial.writeDMRLost(m_slot); serial.writeDMRLost(m_slot);
m_syncCount = 0U; m_syncCount = 0U;
m_threshold = 0; m_threshold = 0;
@ -224,7 +224,11 @@ void CDMRSlotRX::correlateSync(q15_t sample)
errs += countBits8((sync[i] & DMR_SYNC_BYTES_MASK[i]) ^ DMR_MS_DATA_SYNC_BYTES[i]); errs += countBits8((sync[i] & DMR_SYNC_BYTES_MASK[i]) ^ DMR_MS_DATA_SYNC_BYTES[i]);
if (errs <= MAX_SYNC_BYTES_ERRS) { if (errs <= MAX_SYNC_BYTES_ERRS) {
// DEBUG5("DMRSlotRX: data sync found slot/pos/centre/threshold", m_slot ? 2U : 1U, m_dataPtr, centre, threshold);
if (m_endPtr == NOENDPTR)
DEBUG5("DMRSlotRX: data sync found slot/pos/centre/threshold", m_slot ? 2U : 1U, m_dataPtr, centre, threshold); DEBUG5("DMRSlotRX: data sync found slot/pos/centre/threshold", m_slot ? 2U : 1U, m_dataPtr, centre, threshold);
else
DEBUG3("DMRSlotRX: data sync found slot/rel pos", m_slot ? 2U : 1U, int16_t(m_dataPtr) - int16_t(m_syncPtr));
m_maxCorr = corr; m_maxCorr = corr;
m_centre = centre; m_centre = centre;
m_threshold = threshold; m_threshold = threshold;
@ -238,7 +242,11 @@ void CDMRSlotRX::correlateSync(q15_t sample)
errs += countBits8((sync[i] & DMR_SYNC_BYTES_MASK[i]) ^ DMR_MS_VOICE_SYNC_BYTES[i]); errs += countBits8((sync[i] & DMR_SYNC_BYTES_MASK[i]) ^ DMR_MS_VOICE_SYNC_BYTES[i]);
if (errs <= MAX_SYNC_BYTES_ERRS) { if (errs <= MAX_SYNC_BYTES_ERRS) {
// DEBUG5("DMRSlotRX: voice sync found slot/pos/centre/threshold", m_slot ? 2U : 1U, m_dataPtr, centre, threshold);
if (m_endPtr == NOENDPTR)
DEBUG5("DMRSlotRX: voice sync found slot/pos/centre/threshold", m_slot ? 2U : 1U, m_dataPtr, centre, threshold); DEBUG5("DMRSlotRX: voice sync found slot/pos/centre/threshold", m_slot ? 2U : 1U, m_dataPtr, centre, threshold);
else
DEBUG3("DMRSlotRX: voice sync found slot/rel pos", m_slot ? 2U : 1U, int16_t(m_dataPtr) - int16_t(m_syncPtr));
m_maxCorr = corr; m_maxCorr = corr;
m_centre = centre; m_centre = centre;
m_threshold = threshold; m_threshold = threshold;