mirror of
https://github.com/g4klx/MMDVM_HS.git
synced 2025-12-06 07:02:00 +01:00
Optional debug messages at compile time to save FLASH space
This commit is contained in:
parent
64cad981fa
commit
37724bbabf
|
|
@ -974,6 +974,8 @@ void CIO::updateCal()
|
||||||
setRX();
|
setRX();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
|
|
||||||
uint32_t CIO::RXfreq()
|
uint32_t CIO::RXfreq()
|
||||||
{
|
{
|
||||||
return (uint32_t)((float)(ADF7021_PFD / f_div) * ((float)((32768 * m_RX_N_divider) + m_RX_F_divider) / 32768.0)) + 100000;
|
return (uint32_t)((float)(ADF7021_PFD / f_div) * ((float)((32768 * m_RX_N_divider) + m_RX_F_divider) / 32768.0)) + 100000;
|
||||||
|
|
@ -1023,3 +1025,5 @@ void CIO::printConf()
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
3
Config.h
3
Config.h
|
|
@ -63,4 +63,7 @@
|
||||||
// Disable mode LEDs blink during scan mode:
|
// Disable mode LEDs blink during scan mode:
|
||||||
// #define QUIET_MODE_LEDS
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
// #define ENABLE_DEBUG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ void CDMRIdleRX::databit(bool bit)
|
||||||
if (m_endPtr >= DMR_FRAME_LENGTH_BITS)
|
if (m_endPtr >= DMR_FRAME_LENGTH_BITS)
|
||||||
m_endPtr -= DMR_FRAME_LENGTH_BITS;
|
m_endPtr -= DMR_FRAME_LENGTH_BITS;
|
||||||
|
|
||||||
DEBUG3("SYNC MS Data found pos/end:", m_dataPtr, m_endPtr);
|
// DEBUG3("SYNC MS Data found pos/end:", m_dataPtr, m_endPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dataPtr == m_endPtr) {
|
if (m_dataPtr == m_endPtr) {
|
||||||
|
|
|
||||||
|
|
@ -382,10 +382,12 @@ 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 (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");
|
||||||
|
}
|
||||||
|
|
||||||
m_rxBufferBits = DSTAR_DATA_LENGTH_BITS;
|
m_rxBufferBits = DSTAR_DATA_LENGTH_BITS;
|
||||||
m_dataBits = 0U;
|
m_dataBits = 0U;
|
||||||
|
|
|
||||||
14
Debug.h
14
Debug.h
|
|
@ -19,8 +19,11 @@
|
||||||
#if !defined(DEBUG_H)
|
#if !defined(DEBUG_H)
|
||||||
#define DEBUG_H
|
#define DEBUG_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
|
|
||||||
#define DEBUG1(a) serial.writeDebug((a))
|
#define DEBUG1(a) serial.writeDebug((a))
|
||||||
#define DEBUG2(a,b) serial.writeDebug((a),(b))
|
#define DEBUG2(a,b) serial.writeDebug((a),(b))
|
||||||
#define DEBUG2I(a,b) serial.writeDebugI((a),(b))
|
#define DEBUG2I(a,b) serial.writeDebugI((a),(b))
|
||||||
|
|
@ -28,5 +31,16 @@
|
||||||
#define DEBUG4(a,b,c,d) serial.writeDebug((a),(b),(c),(d))
|
#define DEBUG4(a,b,c,d) serial.writeDebug((a),(b),(c),(d))
|
||||||
#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))
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define DEBUG1(a)
|
||||||
|
#define DEBUG2(a,b)
|
||||||
|
#define DEBUG2I(a,b)
|
||||||
|
#define DEBUG3(a,b,c)
|
||||||
|
#define DEBUG4(a,b,c,d)
|
||||||
|
#define DEBUG5(a,b,c,d,e)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
3
IO.h
3
IO.h
|
|
@ -122,6 +122,8 @@ public:
|
||||||
void delay_IFcal(void);
|
void delay_IFcal(void);
|
||||||
void delay_reset(void);
|
void delay_reset(void);
|
||||||
void delay_us(uint32_t us);
|
void delay_us(uint32_t us);
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
uint32_t RXfreq(void);
|
uint32_t RXfreq(void);
|
||||||
uint32_t TXfreq(void);
|
uint32_t TXfreq(void);
|
||||||
uint16_t devDSTAR(void);
|
uint16_t devDSTAR(void);
|
||||||
|
|
@ -130,6 +132,7 @@ public:
|
||||||
uint16_t devP25(void);
|
uint16_t devP25(void);
|
||||||
uint16_t devNXDN(void);
|
uint16_t devNXDN(void);
|
||||||
void printConf();
|
void printConf();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t m_RX_N_divider;
|
uint8_t m_RX_N_divider;
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,9 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
}
|
}
|
||||||
|
|
||||||
io.start();
|
io.start();
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
io.printConf();
|
io.printConf();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K)
|
if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K)
|
||||||
m_firstCal = true;
|
m_firstCal = true;
|
||||||
|
|
@ -1028,6 +1030,8 @@ void CSerialPort::writeNXDNLost()
|
||||||
writeInt(1U, reply, 3);
|
writeInt(1U, reply, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
|
|
||||||
void CSerialPort::writeDebug(const char* text)
|
void CSerialPort::writeDebug(const char* text)
|
||||||
{
|
{
|
||||||
if (!m_debug)
|
if (!m_debug)
|
||||||
|
|
@ -1183,3 +1187,6 @@ void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n
|
||||||
|
|
||||||
writeInt(1U, reply, count, true);
|
writeInt(1U, reply, count, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,14 @@ public:
|
||||||
void writeNXDNData(const uint8_t* data, uint8_t length);
|
void writeNXDNData(const uint8_t* data, uint8_t length);
|
||||||
void writeNXDNLost();
|
void writeNXDNLost();
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
void writeDebug(const char* text);
|
void writeDebug(const char* text);
|
||||||
void writeDebug(const char* text, int16_t n1);
|
void writeDebug(const char* text, int16_t n1);
|
||||||
void writeDebugI(const char* text, int32_t n1);
|
void writeDebugI(const char* text, int32_t n1);
|
||||||
void writeDebug(const char* text, int16_t n1, int16_t n2);
|
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);
|
||||||
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4);
|
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t m_buffer[256U];
|
uint8_t m_buffer[256U];
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ uint8_t countBits64(uint64_t bits)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
// Simple functions to convert from int to string
|
// Simple functions to convert from int to string
|
||||||
// Example from: https://stackoverflow.com/questions/8257714/how-to-convert-an-int-to-string-in-c
|
// Example from: https://stackoverflow.com/questions/8257714/how-to-convert-an-int-to-string-in-c
|
||||||
static uint8_t *i2str_helper(uint8_t *dest, uint32_t n, int32_t x) {
|
static uint8_t *i2str_helper(uint8_t *dest, uint32_t n, int32_t x) {
|
||||||
|
|
@ -83,3 +84,4 @@ uint8_t *i2str(uint8_t *dest, uint32_t n, int32_t x) {
|
||||||
*p = 0;
|
*p = 0;
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
4
Utils.h
4
Utils.h
|
|
@ -20,6 +20,8 @@
|
||||||
#if !defined(UTILS_H)
|
#if !defined(UTILS_H)
|
||||||
#define UTILS_H
|
#define UTILS_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
#if defined(STM32F10X_MD)
|
#if defined(STM32F10X_MD)
|
||||||
#include "stm32f10x.h"
|
#include "stm32f10x.h"
|
||||||
#elif defined(STM32F4XX)
|
#elif defined(STM32F4XX)
|
||||||
|
|
@ -36,7 +38,9 @@ uint8_t countBits32(uint32_t bits);
|
||||||
|
|
||||||
uint8_t countBits64(uint64_t bits);
|
uint8_t countBits64(uint64_t bits);
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
uint8_t *i2str(uint8_t *dest, uint32_t n, int32_t x);
|
uint8_t *i2str(uint8_t *dest, uint32_t n, int32_t x);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,4 +63,7 @@
|
||||||
// Disable mode LEDs blink during scan mode:
|
// Disable mode LEDs blink during scan mode:
|
||||||
// #define QUIET_MODE_LEDS
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
// #define ENABLE_DEBUG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -63,4 +63,7 @@
|
||||||
// Disable mode LEDs blink during scan mode:
|
// Disable mode LEDs blink during scan mode:
|
||||||
// #define QUIET_MODE_LEDS
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
// #define ENABLE_DEBUG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -63,4 +63,7 @@
|
||||||
// Disable mode LEDs blink during scan mode:
|
// Disable mode LEDs blink during scan mode:
|
||||||
// #define QUIET_MODE_LEDS
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
// #define ENABLE_DEBUG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -63,4 +63,7 @@
|
||||||
// Disable mode LEDs blink during scan mode:
|
// Disable mode LEDs blink during scan mode:
|
||||||
// #define QUIET_MODE_LEDS
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
// #define ENABLE_DEBUG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -63,4 +63,7 @@
|
||||||
// Disable mode LEDs blink during scan mode:
|
// Disable mode LEDs blink during scan mode:
|
||||||
// #define QUIET_MODE_LEDS
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
// #define ENABLE_DEBUG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -63,4 +63,7 @@
|
||||||
// Disable mode LEDs blink during scan mode:
|
// Disable mode LEDs blink during scan mode:
|
||||||
// #define QUIET_MODE_LEDS
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
// #define ENABLE_DEBUG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue