mirror of https://github.com/g4klx/MMDVM.git
correct preamble and NRZI
This commit is contained in:
parent
a29cb23a75
commit
ea0c1953cc
18
AX25TX.cpp
18
AX25TX.cpp
|
@ -93,8 +93,10 @@ uint8_t CAX25TX::writeData(const uint8_t* data, uint16_t length)
|
||||||
m_tablePtr = 0U;
|
m_tablePtr = 0U;
|
||||||
|
|
||||||
// Add TX delay (already NRZI)
|
// Add TX delay (already NRZI)
|
||||||
for (uint16_t i = 0U; i < m_txDelay; i++, m_poLen++)
|
for (uint16_t i = 0U; i < m_txDelay; i++, m_poLen++) {
|
||||||
WRITE_BIT1(m_poBuffer, m_poLen, false);
|
bool preamble = NRZI(false);
|
||||||
|
WRITE_BIT1(m_poBuffer, m_poLen, preamble);
|
||||||
|
}
|
||||||
|
|
||||||
// Add the Start Flag
|
// Add the Start Flag
|
||||||
for (uint16_t i = 0U; i < 8U; i++, m_poLen++) {
|
for (uint16_t i = 0U; i < 8U; i++, m_poLen++) {
|
||||||
|
@ -115,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, b);
|
WRITE_BIT1(m_poBuffer, m_poLen, false);
|
||||||
m_poLen++;
|
m_poLen++;
|
||||||
ones = 0U;
|
ones = 0U;
|
||||||
}
|
}
|
||||||
|
@ -166,10 +168,14 @@ uint8_t CAX25TX::getSpace() const
|
||||||
|
|
||||||
bool CAX25TX::NRZI(bool b)
|
bool CAX25TX::NRZI(bool b)
|
||||||
{
|
{
|
||||||
bool result = (b == m_nrzi);
|
if(!b)
|
||||||
|
m_nrzi ^= 1;
|
||||||
|
|
||||||
m_nrzi = b;
|
return m_nrzi;
|
||||||
|
// bool result = (b == m_nrzi);
|
||||||
|
|
||||||
return result;
|
// m_nrzi = b;
|
||||||
|
|
||||||
|
// return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue