Fix preamble and NRZI.

This commit is contained in:
Jonathan Naylor 2020-06-28 15:27:58 +01:00
parent 759efd1da4
commit a73376671c
2 changed files with 5 additions and 10 deletions

View File

@ -92,7 +92,7 @@ uint8_t CAX25TX::writeData(const uint8_t* data, uint16_t length)
m_nrzi = false; m_nrzi = false;
m_tablePtr = 0U; m_tablePtr = 0U;
// Add TX delay (already NRZI) // Add TX delay
for (uint16_t i = 0U; i < m_txDelay; i++, m_poLen++) { for (uint16_t i = 0U; i < m_txDelay; i++, m_poLen++) {
bool preamble = NRZI(false); bool preamble = NRZI(false);
WRITE_BIT1(m_poBuffer, m_poLen, preamble); WRITE_BIT1(m_poBuffer, m_poLen, preamble);
@ -117,7 +117,7 @@ uint8_t CAX25TX::writeData(const uint8_t* data, uint16_t length)
if (ones == AX25_MAX_ONES) { if (ones == AX25_MAX_ONES) {
// Bit stuffing // Bit stuffing
bool b = NRZI(false); bool b = NRZI(false);
WRITE_BIT1(m_poBuffer, m_poLen, false); WRITE_BIT1(m_poBuffer, m_poLen, b);
m_poLen++; m_poLen++;
ones = 0U; ones = 0U;
} }
@ -168,14 +168,9 @@ uint8_t CAX25TX::getSpace() const
bool CAX25TX::NRZI(bool b) bool CAX25TX::NRZI(bool b)
{ {
if(!b) if (!b)
m_nrzi ^= 1; m_nrzi = !m_nrzi;
return m_nrzi; return m_nrzi;
// bool result = (b == m_nrzi);
// m_nrzi = b;
// return result;
} }

View File

@ -109,7 +109,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U;
#define HW_TYPE "MMDVM" #define HW_TYPE "MMDVM"
#endif #endif
#define DESCRIPTION "20200627 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM/AX.25)" #define DESCRIPTION "20200628 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM/AX.25)"
#if defined(GITVERSION) #if defined(GITVERSION)
#define concat(h, a, b, c) h " " a " " b " GitID #" c "" #define concat(h, a, b, c) h " " a " " b " GitID #" c ""