mirror of https://github.com/markqvist/MMDVM.git
Make modem debugging a run-time parameter, not compile-time.
parent
9c9b759db5
commit
9386fb2e11
|
@ -17,8 +17,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "CWIdTX.h"
|
#include "CWIdTX.h"
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "DMRDMORX.h"
|
#include "DMRDMORX.h"
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "DMRSlotType.h"
|
#include "DMRSlotType.h"
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "DMRIdleRX.h"
|
#include "DMRIdleRX.h"
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "DMRSlotRX.h"
|
#include "DMRSlotRX.h"
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "DMRSlotType.h"
|
#include "DMRSlotType.h"
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "DStarRX.h"
|
#include "DStarRX.h"
|
||||||
|
@ -439,12 +437,11 @@ void CDStarRX::processData(bool bit)
|
||||||
bool syncSeen = false;
|
bool syncSeen = false;
|
||||||
if (m_dataBits >= SYNC_SCAN_START && m_dataBits <= (SYNC_POS + 1U)) {
|
if (m_dataBits >= SYNC_SCAN_START && m_dataBits <= (SYNC_POS + 1U)) {
|
||||||
if (countBits32((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) <= DATA_SYNC_ERRS) {
|
if (countBits32((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) <= DATA_SYNC_ERRS) {
|
||||||
#if defined(WANT_DEBUG)
|
|
||||||
if (m_dataBits < SYNC_POS)
|
if (m_dataBits < SYNC_POS)
|
||||||
DEBUG2("DStarRX: found data sync in Data, early", SYNC_POS - m_dataBits);
|
DEBUG2("DStarRX: found data sync in Data, early", SYNC_POS - m_dataBits);
|
||||||
else
|
else
|
||||||
DEBUG1("DStarRX: found data sync in Data");
|
DEBUG1("DStarRX: found data sync in Data");
|
||||||
#endif
|
|
||||||
m_rxBufferBits = DSTAR_DATA_LENGTH_BITS;
|
m_rxBufferBits = DSTAR_DATA_LENGTH_BITS;
|
||||||
m_dataBits = 0U;
|
m_dataBits = 0U;
|
||||||
syncSeen = true;
|
syncSeen = true;
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "DStarTX.h"
|
#include "DStarTX.h"
|
||||||
|
|
16
Debug.h
16
Debug.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -20,9 +20,6 @@
|
||||||
#define DEBUG_H
|
#define DEBUG_H
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
#if defined(WANT_DEBUG)
|
|
||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
#define DEBUG1(a) serial.writeDebug((a))
|
#define DEBUG1(a) serial.writeDebug((a))
|
||||||
|
@ -32,16 +29,5 @@
|
||||||
#define DEBUG5(a,b,c,d,e) serial.writeDebug((a),(b),(c),(d),(e))
|
#define DEBUG5(a,b,c,d,e) serial.writeDebug((a),(b),(c),(d),(e))
|
||||||
#define ASSERT(a) serial.writeAssert((a),#a,__FILE__,__LINE__)
|
#define ASSERT(a) serial.writeAssert((a),#a,__FILE__,__LINE__)
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define DEBUG1(a)
|
|
||||||
#define DEBUG2(a,b)
|
|
||||||
#define DEBUG3(a,b,c)
|
|
||||||
#define DEBUG4(a,b,c,d)
|
|
||||||
#define DEBUG5(a,b,c,d,e)
|
|
||||||
#define ASSERT(a)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
7
IO.cpp
7
IO.cpp
|
@ -18,8 +18,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "IO.h"
|
#include "IO.h"
|
||||||
|
@ -346,11 +344,6 @@ void CIO::getOverflow(bool& adcOverflow, bool& dacOverflow)
|
||||||
adcOverflow = m_adcOverflow > 0U;
|
adcOverflow = m_adcOverflow > 0U;
|
||||||
dacOverflow = m_dacOverflow > 0U;
|
dacOverflow = m_dacOverflow > 0U;
|
||||||
|
|
||||||
#if defined(WANT_DEBUG)
|
|
||||||
if (m_adcOverflow > 0U || m_dacOverflow > 0U)
|
|
||||||
DEBUG3("IO: adc/dac", m_adcOverflow, m_dacOverflow);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_adcOverflow = 0U;
|
m_adcOverflow = 0U;
|
||||||
m_dacOverflow = 0U;
|
m_dacOverflow = 0U;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "P25RX.h"
|
#include "P25RX.h"
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "P25TX.h"
|
#include "P25TX.h"
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
|
@ -94,7 +92,8 @@ const uint8_t PROTOCOL_VERSION = 1U;
|
||||||
CSerialPort::CSerialPort() :
|
CSerialPort::CSerialPort() :
|
||||||
m_buffer(),
|
m_buffer(),
|
||||||
m_ptr(0U),
|
m_ptr(0U),
|
||||||
m_len(0U)
|
m_len(0U),
|
||||||
|
m_debug(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,6 +229,8 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
bool ysfLoDev = (data[0U] & 0x08U) == 0x08U;
|
bool ysfLoDev = (data[0U] & 0x08U) == 0x08U;
|
||||||
bool simplex = (data[0U] & 0x80U) == 0x80U;
|
bool simplex = (data[0U] & 0x80U) == 0x80U;
|
||||||
|
|
||||||
|
m_debug = (data[0U] & 0x10U) == 0x10U;
|
||||||
|
|
||||||
bool dstarEnable = (data[1U] & 0x01U) == 0x01U;
|
bool dstarEnable = (data[1U] & 0x01U) == 0x01U;
|
||||||
bool dmrEnable = (data[1U] & 0x02U) == 0x02U;
|
bool dmrEnable = (data[1U] & 0x02U) == 0x02U;
|
||||||
bool ysfEnable = (data[1U] & 0x04U) == 0x04U;
|
bool ysfEnable = (data[1U] & 0x04U) == 0x04U;
|
||||||
|
@ -931,6 +932,9 @@ void CSerialPort::writeRSSIData(const uint8_t* data, uint8_t length)
|
||||||
|
|
||||||
void CSerialPort::writeDebug(const char* text)
|
void CSerialPort::writeDebug(const char* text)
|
||||||
{
|
{
|
||||||
|
if (!m_debug)
|
||||||
|
return;
|
||||||
|
|
||||||
uint8_t reply[130U];
|
uint8_t reply[130U];
|
||||||
|
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
@ -948,6 +952,9 @@ void CSerialPort::writeDebug(const char* text)
|
||||||
|
|
||||||
void CSerialPort::writeDebug(const char* text, int16_t n1)
|
void CSerialPort::writeDebug(const char* text, int16_t n1)
|
||||||
{
|
{
|
||||||
|
if (!m_debug)
|
||||||
|
return;
|
||||||
|
|
||||||
uint8_t reply[130U];
|
uint8_t reply[130U];
|
||||||
|
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
@ -968,6 +975,9 @@ void CSerialPort::writeDebug(const char* text, int16_t n1)
|
||||||
|
|
||||||
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2)
|
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2)
|
||||||
{
|
{
|
||||||
|
if (!m_debug)
|
||||||
|
return;
|
||||||
|
|
||||||
uint8_t reply[130U];
|
uint8_t reply[130U];
|
||||||
|
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
@ -991,6 +1001,9 @@ void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2)
|
||||||
|
|
||||||
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3)
|
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3)
|
||||||
{
|
{
|
||||||
|
if (!m_debug)
|
||||||
|
return;
|
||||||
|
|
||||||
uint8_t reply[130U];
|
uint8_t reply[130U];
|
||||||
|
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
@ -1017,6 +1030,9 @@ void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n
|
||||||
|
|
||||||
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4)
|
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4)
|
||||||
{
|
{
|
||||||
|
if (!m_debug)
|
||||||
|
return;
|
||||||
|
|
||||||
uint8_t reply[130U];
|
uint8_t reply[130U];
|
||||||
|
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
|
|
@ -61,6 +61,7 @@ private:
|
||||||
uint8_t m_buffer[256U];
|
uint8_t m_buffer[256U];
|
||||||
uint8_t m_ptr;
|
uint8_t m_ptr;
|
||||||
uint8_t m_len;
|
uint8_t m_len;
|
||||||
|
bool m_debug;
|
||||||
|
|
||||||
void sendACK();
|
void sendACK();
|
||||||
void sendNAK(uint8_t err);
|
void sendNAK(uint8_t err);
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "YSFRX.h"
|
#include "YSFRX.h"
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define WANT_DEBUG
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "YSFTX.h"
|
#include "YSFTX.h"
|
||||||
|
|
Loading…
Reference in New Issue