mirror of
https://github.com/g4klx/MMDVM.git
synced 2026-08-21 14:36:21 +02:00
Revert the demodulator lock stiffening for D-Star and System Fusion.
This commit is contained in:
+9
-19
@@ -25,10 +25,9 @@
|
||||
|
||||
const unsigned int BUFFER_LENGTH = 200U;
|
||||
|
||||
const uint32_t PLLMAX = 0x10000U;
|
||||
const uint32_t PLLINC = PLLMAX / DSTAR_RADIO_BIT_LENGTH;
|
||||
const uint32_t INC_LOCK = PLLINC / 64U;
|
||||
const uint32_t INC_UNLOCK = PLLINC / 32U;
|
||||
const uint32_t PLLMAX = 0x10000U;
|
||||
const uint32_t PLLINC = PLLMAX / DSTAR_RADIO_BIT_LENGTH;
|
||||
const uint32_t INC = PLLINC / 32U;
|
||||
|
||||
const unsigned int MAX_SYNC_BITS = 50U * DSTAR_DATA_LENGTH_BITS;
|
||||
|
||||
@@ -244,7 +243,6 @@ const uint16_t CCITT_TABLE[] = {
|
||||
CDStarRX::CDStarRX() :
|
||||
m_pll(0U),
|
||||
m_prev(false),
|
||||
m_inc(INC_UNLOCK),
|
||||
m_rxState(DSRXS_NONE),
|
||||
m_patternBuffer(0x00U),
|
||||
m_rxBuffer(),
|
||||
@@ -266,7 +264,6 @@ void CDStarRX::reset()
|
||||
{
|
||||
m_pll = 0U;
|
||||
m_prev = false;
|
||||
m_inc = INC_UNLOCK;
|
||||
m_rxState = DSRXS_NONE;
|
||||
m_patternBuffer = 0x00U;
|
||||
m_rxBufferBits = 0U;
|
||||
@@ -283,9 +280,9 @@ void CDStarRX::samples(const q15_t* samples, uint8_t length)
|
||||
|
||||
if (bit != m_prev) {
|
||||
if (m_pll < (PLLMAX / 2U))
|
||||
m_pll += m_inc;
|
||||
m_pll += INC;
|
||||
else
|
||||
m_pll -= m_inc;
|
||||
m_pll -= INC;
|
||||
}
|
||||
|
||||
m_prev = bit;
|
||||
@@ -336,7 +333,7 @@ void CDStarRX::processNone(bool bit)
|
||||
// Exact matching of the data sync bit sequence
|
||||
if (countBits32((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) == 0U) {
|
||||
DEBUG1("DStarRX: found data sync in None");
|
||||
locked(true);
|
||||
io.setDecode(true);
|
||||
|
||||
#if defined(WANT_DEBUG)
|
||||
q15_t min = 16000;
|
||||
@@ -376,7 +373,7 @@ void CDStarRX::processHeader(bool bit)
|
||||
unsigned char header[DSTAR_HEADER_LENGTH_BYTES];
|
||||
bool ok = rxHeader(m_rxBuffer, header);
|
||||
if (ok) {
|
||||
locked(true);
|
||||
io.setDecode(true);
|
||||
|
||||
serial.writeDStarHeader(header, DSTAR_HEADER_LENGTH_BYTES);
|
||||
|
||||
@@ -404,7 +401,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");
|
||||
locked(false);
|
||||
io.setDecode(false);
|
||||
|
||||
serial.writeDStarEOT();
|
||||
|
||||
@@ -443,7 +440,7 @@ void CDStarRX::processData(bool bit)
|
||||
m_dataBits--;
|
||||
if (m_dataBits == 0U) {
|
||||
DEBUG1("DStarRX: data sync timed out, lost lock");
|
||||
locked(false);
|
||||
io.setDecode(false);
|
||||
|
||||
serial.writeDStarLost();
|
||||
|
||||
@@ -696,10 +693,3 @@ bool CDStarRX::checksum(const uint8_t* header) const
|
||||
return crc8[0U] == header[DSTAR_HEADER_LENGTH_BYTES - 2U] && crc8[1U] == header[DSTAR_HEADER_LENGTH_BYTES - 1U];
|
||||
}
|
||||
|
||||
void CDStarRX::locked(bool lock)
|
||||
{
|
||||
io.setDecode(lock);
|
||||
|
||||
m_inc = lock ? INC_LOCK : INC_UNLOCK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user