mirror of https://github.com/g4klx/MMDVM.git
Revert the demodulator lock stiffening for D-Star and System Fusion.
This commit is contained in:
parent
2c11137d27
commit
428dcaa7d6
28
DStarRX.cpp
28
DStarRX.cpp
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ public:
|
|||
private:
|
||||
uint32_t m_pll;
|
||||
bool m_prev;
|
||||
uint32_t m_inc;
|
||||
DSRX_STATE m_rxState;
|
||||
uint32_t m_patternBuffer;
|
||||
uint8_t m_rxBuffer[100U];
|
||||
|
@ -63,7 +62,6 @@ private:
|
|||
void viterbiDecode(int* data);
|
||||
void traceBack();
|
||||
bool checksum(const uint8_t* header) const;
|
||||
void locked(bool lock);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
26
YSFRX.cpp
26
YSFRX.cpp
|
@ -27,10 +27,9 @@ const unsigned int BUFFER_LENGTH = 200U;
|
|||
|
||||
const q15_t SCALING_FACTOR = 19505; // Q15(0.60)
|
||||
|
||||
const uint32_t PLLMAX = 0x10000U;
|
||||
const uint32_t PLLINC = PLLMAX / YSF_RADIO_SYMBOL_LENGTH;
|
||||
const uint32_t INC_UNLOCK = PLLINC / 32U;
|
||||
const uint32_t INC_LOCK = PLLINC / 64U;
|
||||
const uint32_t PLLMAX = 0x10000U;
|
||||
const uint32_t PLLINC = PLLMAX / YSF_RADIO_SYMBOL_LENGTH;
|
||||
const uint32_t INC = PLLINC / 32U;
|
||||
|
||||
const uint8_t SYNC_SYMBOL_ERRS = 2U;
|
||||
const uint8_t SYNC_BIT_ERRS = 4U;
|
||||
|
@ -312,7 +311,6 @@ static const unsigned short CCITT_TABLE[] = {
|
|||
CYSFRX::CYSFRX() :
|
||||
m_pll(0U),
|
||||
m_prev(false),
|
||||
m_inc(INC_UNLOCK),
|
||||
m_state(YSFRXS_NONE),
|
||||
m_bitBuffer(0x00U),
|
||||
m_symbols(),
|
||||
|
@ -337,7 +335,6 @@ void CYSFRX::reset()
|
|||
{
|
||||
m_pll = 0U;
|
||||
m_prev = false;
|
||||
m_inc = INC_UNLOCK;
|
||||
m_state = YSFRXS_NONE;
|
||||
m_bitBuffer = 0x00U;
|
||||
m_bufferPtr = 0U;
|
||||
|
@ -354,9 +351,9 @@ void CYSFRX::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;
|
||||
|
@ -443,7 +440,7 @@ void CYSFRX::processNone(q15_t sample)
|
|||
m_lostCount = MAX_SYNC_FRAMES;
|
||||
m_bufferPtr = YSF_SYNC_LENGTH_BITS;
|
||||
m_state = YSFRXS_DATA;
|
||||
locked(true);
|
||||
io.setDecode(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -509,7 +506,7 @@ void CYSFRX::processData(q15_t sample)
|
|||
m_lostCount--;
|
||||
if (m_lostCount == 0U) {
|
||||
DEBUG1("YSFRX: sync timed out, lost lock");
|
||||
locked(false);
|
||||
io.setDecode(false);
|
||||
|
||||
serial.writeYSFLost();
|
||||
|
||||
|
@ -534,7 +531,7 @@ void CYSFRX::processData(q15_t sample)
|
|||
|
||||
if (ok && (FICH[0U] & 0xC0U) == 0x80U) {
|
||||
DEBUG1("YSFRX: end of transmission");
|
||||
locked(false);
|
||||
io.setDecode(false);
|
||||
m_state = YSFRXS_NONE;
|
||||
} else {
|
||||
// Start the next frame
|
||||
|
@ -699,10 +696,3 @@ bool CYSFRX::checksum(const uint8_t* fich) const
|
|||
return crc8[0U] == fich[5U] && crc8[1U] == fich[4U];
|
||||
}
|
||||
|
||||
void CYSFRX::locked(bool lock)
|
||||
{
|
||||
io.setDecode(lock);
|
||||
|
||||
m_inc = lock ? INC_LOCK : INC_UNLOCK;
|
||||
}
|
||||
|
||||
|
|
2
YSFRX.h
2
YSFRX.h
|
@ -38,7 +38,6 @@ public:
|
|||
private:
|
||||
uint32_t m_pll;
|
||||
bool m_prev;
|
||||
uint32_t m_inc;
|
||||
YSFRX_STATE m_state;
|
||||
uint32_t m_symbolBuffer;
|
||||
uint64_t m_bitBuffer;
|
||||
|
@ -65,7 +64,6 @@ private:
|
|||
uint32_t getSyndrome23127(uint32_t pattern) const;
|
||||
uint32_t golay24128(const uint8_t* bytes) const;
|
||||
bool checksum(const uint8_t* fich) const;
|
||||
void locked(bool lock);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue