mirror of
https://github.com/juribeparada/MMDVM_HS.git
synced 2025-12-06 07:12:08 +01:00
Roll back some of recent changes.
This commit is contained in:
parent
d9621c5c8b
commit
6fc189793d
|
|
@ -29,13 +29,13 @@ const unsigned int M17_SYNC_LENGTH_BYTES = M17_SYNC_LENGTH_BITS / 8U;
|
|||
|
||||
const uint8_t M17_LINK_SETUP_SYNC_BYTES[] = {0x55U, 0xF7U};
|
||||
const uint8_t M17_STREAM_SYNC_BYTES[] = {0xFFU, 0x5DU};
|
||||
const uint8_t M17_EOF_SYNC_BYTES[] = {0x55U, 0x5DU};
|
||||
const uint8_t M17_EOT_SYNC_BYTES[] = {0x55U, 0x5DU};
|
||||
|
||||
const uint8_t M17_SYNC_BYTES_LENGTH = 2U;
|
||||
|
||||
const uint16_t M17_LINK_SETUP_SYNC_BITS = 0x55F7U;
|
||||
const uint16_t M17_STREAM_SYNC_BITS = 0xFF5DU;
|
||||
const uint16_t M17_EOF_SYNC_BITS = 0x555DU;
|
||||
const uint16_t M17_EOT_SYNC_BITS = 0x555DU;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
18
M17RX.cpp
18
M17RX.cpp
|
|
@ -110,6 +110,14 @@ void CM17RX::processData(bool bit)
|
|||
|
||||
// Only search for the syncs in the right place +-2 symbols
|
||||
if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) {
|
||||
// Fuzzy matching of the link setup sync bit sequence
|
||||
if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) {
|
||||
DEBUG2("M17RX: found link setup sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS);
|
||||
m_lostCount = MAX_SYNC_FRAMES;
|
||||
m_bufferPtr = M17_SYNC_LENGTH_BITS;
|
||||
m_state = M17RXS_LINK_SETUP;
|
||||
}
|
||||
|
||||
// Fuzzy matching of the stream sync bit sequence
|
||||
if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) {
|
||||
DEBUG2("M17RX: found stream sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS);
|
||||
|
|
@ -118,12 +126,13 @@ void CM17RX::processData(bool bit)
|
|||
m_state = M17RXS_STREAM;
|
||||
}
|
||||
|
||||
// Fuzzy matching of the eof sync bit sequence
|
||||
if (countBits16(m_bitBuffer ^ M17_EOF_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) {
|
||||
DEBUG2("M17RX: found eof sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS);
|
||||
// Fuzzy matching of the EOT sync bit sequence
|
||||
if (countBits16(m_bitBuffer ^ M17_EOT_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) {
|
||||
DEBUG2("M17RX: found eot sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS);
|
||||
io.setDecode(false);
|
||||
serial.writeM17EOT();
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,8 +147,7 @@ void CM17RX::processData(bool bit)
|
|||
reset();
|
||||
} else {
|
||||
// Write data to host
|
||||
m_outBuffer[0U] = 0x00U; // Stream data
|
||||
m_outBuffer[0U] |= m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U;
|
||||
m_outBuffer[0U] = m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U;
|
||||
|
||||
switch (m_state) {
|
||||
case M17RXS_LINK_SETUP:
|
||||
|
|
|
|||
|
|
@ -116,11 +116,11 @@ uint8_t CM17TX::writeEOT()
|
|||
{
|
||||
/*
|
||||
uint16_t space = m_buffer.getSpace();
|
||||
if (space < M17_SYNC_LENGTH_BYTES)
|
||||
if (space < M17_FRAME_LENGTH_BYTES)
|
||||
return 5U;
|
||||
|
||||
for (uint8_t i = 0U; i < M17_SYNC_LENGTH_BYTES; i++)
|
||||
m_buffer.put(M17_EOF_SYNC_BYTES[i]);
|
||||
m_buffer.put(M17_EOT_SYNC_BYTES[i]);
|
||||
*/
|
||||
return 0U;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue