Skip to content

Commit

Permalink
Roll back some of recent changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Sep 12, 2021
1 parent d9621c5 commit 6fc1897
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions M17Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 13 additions & 5 deletions M17RX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
}

Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions M17TX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define VER_MAJOR "1"
#define VER_MINOR "5"
#define VER_REV "2"
#define VERSION_DATE "20210908"
#define VERSION_DATE "20210912"

#if defined(ZUMSPOT_ADF7021)
#define BOARD_INFO "ZUMspot"
Expand Down

0 comments on commit 6fc1897

Please sign in to comment.