mirror of https://github.com/g4klx/MMDVM.git
Set up ring buffer overflow signalling and a little debugging.
This commit is contained in:
parent
dd17a47972
commit
d9b5f5753e
|
@ -112,7 +112,7 @@ void CDMRIdleRX::processSample(q15_t sample)
|
|||
errs += countBits8((sync[i] & DMR_SYNC_BYTES_MASK[i]) ^ DMR_MS_DATA_SYNC_BYTES[i]);
|
||||
|
||||
if (errs <= MAX_SYNC_BYTES_ERRS) {
|
||||
DEBUG4("DMRIdleRX: data sync found pos/centre/threshold", m_dataPtr, centre, threshold);
|
||||
DEBUG3("DMRIdleRX: data sync found centre/threshold", centre, threshold);
|
||||
m_maxCorr = corr;
|
||||
m_centre = centre;
|
||||
m_threshold = threshold;
|
||||
|
|
|
@ -246,6 +246,11 @@ void CDMRSlotRX::correlateSync(q15_t sample)
|
|||
void CDMRSlotRX::samplesToBits(uint16_t start, uint8_t count, uint8_t* buffer, uint16_t offset, q15_t centre, q15_t threshold)
|
||||
{
|
||||
for (uint8_t i = 0U; i < count; i++, start += DMR_RADIO_SYMBOL_LENGTH) {
|
||||
if (m_control == 0x20U || m_control == 0x40U) {
|
||||
if (i == 77U)
|
||||
DEBUG4("DMRSlotRX: slot/frame pos/sample pos", m_slot ? 2U : 1U, i, start);
|
||||
}
|
||||
|
||||
q15_t sample = m_buffer[start] - centre;
|
||||
|
||||
if (sample < -threshold) {
|
||||
|
|
10
IO.cpp
10
IO.cpp
|
@ -401,3 +401,13 @@ bool CIO::hasADCOverflow()
|
|||
return overflow;
|
||||
}
|
||||
|
||||
bool CIO::hasTXOverflow()
|
||||
{
|
||||
return m_txBuffer.hasOverflowed();
|
||||
}
|
||||
|
||||
bool CIO::hasRXOverflow()
|
||||
{
|
||||
return m_rxBuffer.hasOverflowed();
|
||||
}
|
||||
|
||||
|
|
5
IO.h
5
IO.h
|
@ -41,7 +41,10 @@ public:
|
|||
|
||||
void setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t txLevel);
|
||||
|
||||
bool hasADCOverflow();
|
||||
bool hasADCOverflow();
|
||||
|
||||
bool hasTXOverflow();
|
||||
bool hasRXOverflow();
|
||||
|
||||
private:
|
||||
#if defined(__MBED__)
|
||||
|
|
18
SampleRB.cpp
18
SampleRB.cpp
|
@ -27,7 +27,8 @@ m_samples(NULL),
|
|||
m_control(NULL),
|
||||
m_head(0U),
|
||||
m_tail(0U),
|
||||
m_full(false)
|
||||
m_full(false),
|
||||
m_overflow(false)
|
||||
{
|
||||
m_samples = new uint16_t[length];
|
||||
m_control = new uint8_t[length];
|
||||
|
@ -65,8 +66,10 @@ void CSampleRB::put(uint16_t sample, uint8_t control)
|
|||
if (m_head >= m_length)
|
||||
m_head = 0U;
|
||||
|
||||
if (m_head == m_tail)
|
||||
m_full = true;
|
||||
if (m_head == m_tail) {
|
||||
m_overflow = true;
|
||||
m_full = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CSampleRB::get(uint16_t& sample, uint8_t& control)
|
||||
|
@ -81,3 +84,12 @@ void CSampleRB::get(uint16_t& sample, uint8_t& control)
|
|||
m_tail = 0U;
|
||||
}
|
||||
|
||||
bool CSampleRB::hasOverflowed()
|
||||
{
|
||||
bool overflow = m_overflow;
|
||||
|
||||
m_overflow = false;
|
||||
|
||||
return overflow;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ public:
|
|||
|
||||
void get(uint16_t& sample, uint8_t& control);
|
||||
|
||||
bool hasOverflowed();
|
||||
|
||||
private:
|
||||
uint16_t m_length;
|
||||
volatile uint16_t* m_samples;
|
||||
|
@ -46,6 +48,7 @@ private:
|
|||
volatile uint16_t m_head;
|
||||
volatile uint16_t m_tail;
|
||||
volatile bool m_full;
|
||||
bool m_overflow;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -56,7 +56,7 @@ const uint8_t MMDVM_DEBUG4 = 0xF4U;
|
|||
const uint8_t MMDVM_DEBUG5 = 0xF5U;
|
||||
const uint8_t MMDVM_SAMPLES = 0xF8U;
|
||||
|
||||
const uint8_t HARDWARE[] = "MMDVM 20160113 (D-Star/DMR/System Fusion)";
|
||||
const uint8_t HARDWARE[] = "MMDVM 20160114 (D-Star/DMR/System Fusion)";
|
||||
|
||||
const uint8_t PROTOCOL_VERSION = 1U;
|
||||
|
||||
|
@ -120,6 +120,12 @@ void CSerialPort::getStatus() const
|
|||
if (io.hasADCOverflow())
|
||||
reply[5U] |= 0x02U;
|
||||
|
||||
if (io.hasRXOverflow())
|
||||
reply[5U] |= 0x04U;
|
||||
|
||||
if (io.hasTXOverflow())
|
||||
reply[5U] |= 0x08U;
|
||||
|
||||
if (m_dstarEnable)
|
||||
reply[6U] = dstarTX.getSpace();
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue