mirror of https://github.com/markqvist/MMDVM.git
Set debugging on a per-file basis.
parent
7d77f20ee9
commit
037f60ea06
4
Config.h
4
Config.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,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
|
||||
|
@ -19,8 +19,6 @@
|
|||
#if !defined(CONFIG_H)
|
||||
#define CONFIG_H
|
||||
|
||||
// #define WANT_DEBUG
|
||||
|
||||
// Allow the use of the COS line to lockout the modem
|
||||
// #define USE_COS_AS_LOCKOUT
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// #define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
#include "DMRIdleRX.h"
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
#include "DMRSlotRX.h"
|
||||
|
@ -119,25 +121,25 @@ bool CDMRSlotRX::processSample(q15_t sample)
|
|||
|
||||
switch (dataType) {
|
||||
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;
|
||||
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
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;
|
||||
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||
break;
|
||||
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;
|
||||
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||
break;
|
||||
|
@ -145,14 +147,14 @@ bool CDMRSlotRX::processSample(q15_t sample)
|
|||
}
|
||||
} else if (m_control == 0x20U) {
|
||||
// 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);
|
||||
m_syncCount = 0U;
|
||||
m_n = 0U;
|
||||
} else {
|
||||
m_syncCount++;
|
||||
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);
|
||||
m_syncCount = 0U;
|
||||
m_threshold = 0;
|
||||
|
|
13
DStarRX.cpp
13
DStarRX.cpp
|
@ -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
|
||||
|
@ -16,6 +16,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// #define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
#include "DStarRX.h"
|
||||
|
@ -319,7 +321,7 @@ void CDStarRX::processNone(bool bit)
|
|||
|
||||
// Exact matching of the frame sync sequence
|
||||
if (countBits32((m_patternBuffer & FRAME_SYNC_MASK) ^ FRAME_SYNC_DATA) == 0U) {
|
||||
// DEBUG1("DStarRX: found frame sync in None");
|
||||
DEBUG1("DStarRX: found frame sync in None");
|
||||
|
||||
::memset(m_rxBuffer, 0x00U, DSTAR_FEC_SECTION_LENGTH_BYTES);
|
||||
m_rxBufferBits = 0U;
|
||||
|
@ -371,7 +373,6 @@ void CDStarRX::processHeader(bool bit)
|
|||
unsigned char header[DSTAR_HEADER_LENGTH_BYTES];
|
||||
bool ok = rxHeader(m_rxBuffer, header);
|
||||
if (ok) {
|
||||
// DEBUG1("DStarRX: header checksum ok");
|
||||
io.setDecode(true);
|
||||
|
||||
serial.writeDStarHeader(header, DSTAR_HEADER_LENGTH_BYTES);
|
||||
|
@ -382,8 +383,6 @@ void CDStarRX::processHeader(bool bit)
|
|||
m_rxState = DSRXS_DATA;
|
||||
m_dataBits = MAX_SYNC_BITS;
|
||||
} else {
|
||||
// DEBUG1("DStarRX: header checksum failed");
|
||||
|
||||
// The checksum failed, return to looking for syncs
|
||||
m_rxState = DSRXS_NONE;
|
||||
}
|
||||
|
@ -401,7 +400,7 @@ void CDStarRX::processData(bool bit)
|
|||
|
||||
// Fuzzy matching of the end frame sequences
|
||||
if (countBits32((m_patternBuffer & END_SYNC_MASK) ^ END_SYNC_DATA) <= END_SYNC_ERRS) {
|
||||
// DEBUG1("DStarRX: Found end sync in Data");
|
||||
DEBUG1("DStarRX: Found end sync in Data");
|
||||
io.setDecode(false);
|
||||
|
||||
serial.writeDStarEOT();
|
||||
|
@ -440,7 +439,7 @@ void CDStarRX::processData(bool bit)
|
|||
// We've not seen a data sync for too long, signal RXLOST and change to RX_NONE
|
||||
m_dataBits--;
|
||||
if (m_dataBits == 0U) {
|
||||
// DEBUG1("DStarRX: data sync timed out, lost lock");
|
||||
DEBUG1("DStarRX: data sync timed out, lost lock");
|
||||
io.setDecode(false);
|
||||
|
||||
serial.writeDStarLost();
|
||||
|
|
2
IO.cpp
2
IO.cpp
|
@ -16,6 +16,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// #define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
#include "IO.h"
|
||||
|
|
|
@ -19,7 +19,6 @@ Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
|
||||
#include "SampleRB.h"
|
||||
#include "Debug.h"
|
||||
|
||||
CSampleRB::CSampleRB(uint16_t length) :
|
||||
m_length(length),
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// #define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
|
||||
|
@ -255,31 +257,31 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
|
|||
{
|
||||
switch (modemState) {
|
||||
case STATE_DMR:
|
||||
// DEBUG1("Mode set to DMR");
|
||||
DEBUG1("Mode set to DMR");
|
||||
dstarRX.reset();
|
||||
ysfRX.reset();
|
||||
break;
|
||||
case STATE_DSTAR:
|
||||
// DEBUG1("Mode set to D-Star");
|
||||
DEBUG1("Mode set to D-Star");
|
||||
dmrIdleRX.reset();
|
||||
dmrRX.reset();
|
||||
ysfRX.reset();
|
||||
break;
|
||||
case STATE_YSF:
|
||||
// DEBUG1("Mode set to System Fusion");
|
||||
DEBUG1("Mode set to System Fusion");
|
||||
dmrIdleRX.reset();
|
||||
dmrRX.reset();
|
||||
dstarRX.reset();
|
||||
break;
|
||||
case STATE_CALIBRATE:
|
||||
// DEBUG1("Mode set to Calibrate");
|
||||
DEBUG1("Mode set to Calibrate");
|
||||
dmrIdleRX.reset();
|
||||
dmrRX.reset();
|
||||
dstarRX.reset();
|
||||
ysfRX.reset();
|
||||
break;
|
||||
default:
|
||||
// DEBUG1("Mode set to Idle");
|
||||
DEBUG1("Mode set to Idle");
|
||||
// STATE_IDLE
|
||||
break;
|
||||
}
|
||||
|
@ -689,8 +691,6 @@ void CSerialPort::write(const uint8_t* data, uint16_t length, bool flush)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if defined(WANT_DEBUG)
|
||||
|
||||
void CSerialPort::writeDump(const uint8_t* data, uint8_t length)
|
||||
{
|
||||
ASSERT(length <= 252U);
|
||||
|
@ -870,5 +870,3 @@ void CSerialPort::writeAssert(bool cond, const char* text, const char* file, lon
|
|||
write(reply, count, true);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -44,16 +44,17 @@ public:
|
|||
|
||||
void writeCalData(const uint8_t* data, uint8_t length);
|
||||
|
||||
#if defined(WANT_DEBUG)
|
||||
void writeDump(const uint8_t* data, uint8_t length);
|
||||
|
||||
void writeSamples(const q15_t* data, uint8_t length);
|
||||
|
||||
void writeDebug(const char* text);
|
||||
void writeDebug(const char* text, int16_t n1);
|
||||
void writeDebug(const char* text, int16_t n1, int16_t n2);
|
||||
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3);
|
||||
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4);
|
||||
|
||||
void writeAssert(bool cond, const char* text, const char* file, long line);
|
||||
#endif
|
||||
|
||||
private:
|
||||
#if defined(__MBED__)
|
||||
|
|
|
@ -19,7 +19,6 @@ Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
|
||||
#include "SerialRB.h"
|
||||
#include "Debug.h"
|
||||
|
||||
CSerialRB::CSerialRB(uint16_t length) :
|
||||
m_length(length),
|
||||
|
|
|
@ -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
|
||||
|
@ -16,6 +16,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// #define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
#include "YSFRX.h"
|
||||
|
@ -503,7 +505,7 @@ void CYSFRX::processData(q15_t sample)
|
|||
// We've not seen a data sync for too long, signal RXLOST and change to RX_NONE
|
||||
m_lostCount--;
|
||||
if (m_lostCount == 0U) {
|
||||
// DEBUG1("YSFRX: sync timed out, lost lock");
|
||||
DEBUG1("YSFRX: sync timed out, lost lock");
|
||||
io.setDecode(false);
|
||||
|
||||
serial.writeYSFLost();
|
||||
|
@ -528,7 +530,7 @@ void CYSFRX::processData(q15_t sample)
|
|||
serial.writeYSFData(m_outBuffer, YSF_FRAME_LENGTH_BYTES + 1U);
|
||||
|
||||
if (ok && (FICH[0U] & 0xC0U) == 0x80U) {
|
||||
// DEBUG1("YSFRX: end of transmission");
|
||||
DEBUG1("YSFRX: end of transmission");
|
||||
io.setDecode(false);
|
||||
m_state = YSFRXS_NONE;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue