From e3cadb7f32c17dc5c74ab63723672bfbc8690847 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 22 Aug 2021 13:27:18 +0100 Subject: [PATCH] Remove M17 packet mode. --- M17Defines.h | 4 +--- M17RX.cpp | 40 ---------------------------------------- M17RX.h | 4 +--- SerialPort.cpp | 23 ----------------------- SerialPort.h | 1 - version.h | 3 ++- 6 files changed, 4 insertions(+), 71 deletions(-) diff --git a/M17Defines.h b/M17Defines.h index 2f8e98e..3cc28b9 100644 --- a/M17Defines.h +++ b/M17Defines.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016,2017,2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2016,2017,2018,2020,2021 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,13 +28,11 @@ const unsigned int M17_SYNC_LENGTH_BITS = 16U; const uint8_t M17_LINK_SETUP_SYNC_BYTES[] = {0x55U, 0xF7U}; const uint8_t M17_STREAM_SYNC_BYTES[] = {0xFFU, 0x5DU}; -const uint8_t M17_PACKET_SYNC_BYTES[] = {0x75U, 0xFFU}; 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_PACKET_SYNC_BITS = 0x75FFU; #endif diff --git a/M17RX.cpp b/M17RX.cpp index 3954eb9..9cd81b2 100644 --- a/M17RX.cpp +++ b/M17RX.cpp @@ -55,7 +55,6 @@ void CM17RX::databit(bool bit) switch (m_state) { case M17RXS_LINK_SETUP: case M17RXS_STREAM: - case M17RXS_PACKET: processData(bit); break; default: @@ -95,19 +94,6 @@ void CM17RX::processNone(bool bit) io.setDecode(true); } - - // Fuzzy matching of the packet sync bit sequence - if (countBits16(m_bitBuffer ^ M17_PACKET_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { - DEBUG1("M17RX: packet sync found in None"); - for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) - m_buffer[i] = M17_PACKET_SYNC_BYTES[i]; - - m_lostCount = MAX_SYNC_FRAMES; - m_bufferPtr = M17_SYNC_LENGTH_BITS; - m_state = M17RXS_PACKET; - - io.setDecode(true); - } } void CM17RX::processData(bool bit) @@ -144,17 +130,6 @@ void CM17RX::processData(bool bit) } } - // Only search for a packet sync 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 stream sync bit sequence - if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { - DEBUG2("M17RX: found packet sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); - m_lostCount = MAX_SYNC_FRAMES; - m_bufferPtr = M17_SYNC_LENGTH_BITS; - m_state = M17RXS_PACKET; - } - } - // Send a frame to the host if the required number of bits have been received if (m_bufferPtr == M17_FRAME_LENGTH_BITS) { // We've not seen a sync for too long, signal RXLOST and change to RX_NONE @@ -177,7 +152,6 @@ void CM17RX::processData(bool bit) writeRSSIStream(m_outBuffer); break; default: - writeRSSIPacket(m_outBuffer); break; } @@ -216,17 +190,3 @@ void CM17RX::writeRSSIStream(uint8_t* data) #endif } -void CM17RX::writeRSSIPacket(uint8_t* data) -{ -#if defined(SEND_RSSI_DATA) - uint16_t rssi = io.readRSSI(); - - data[49U] = (rssi >> 8) & 0xFFU; - data[50U] = (rssi >> 0) & 0xFFU; - - serial.writeM17Packet(data, M17_FRAME_LENGTH_BYTES + 3U); -#else - serial.writeM17Packet(data, M17_FRAME_LENGTH_BYTES + 1U); -#endif -} - diff --git a/M17RX.h b/M17RX.h index 3329b81..1284a29 100644 --- a/M17RX.h +++ b/M17RX.h @@ -25,8 +25,7 @@ enum M17RX_STATE { M17RXS_NONE, M17RXS_LINK_SETUP, - M17RXS_STREAM, - M17RXS_PACKET + M17RXS_STREAM }; class CM17RX { @@ -49,7 +48,6 @@ private: void processData(bool bit); void writeRSSILinkSetup(uint8_t* data); void writeRSSIStream(uint8_t* data); - void writeRSSIPacket(uint8_t* data); }; #endif diff --git a/SerialPort.cpp b/SerialPort.cpp index d230247..bd73f02 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -1309,29 +1309,6 @@ void CSerialPort::writeM17Stream(const uint8_t* data, uint8_t length) writeInt(1U, reply, count); } -void CSerialPort::writeM17Packet(const uint8_t* data, uint8_t length) -{ - if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) - return; - - if (!m_m17Enable) - return; - - uint8_t reply[130U]; - - reply[0U] = MMDVM_FRAME_START; - reply[1U] = 0U; - reply[2U] = MMDVM_M17_PACKET; - - uint8_t count = 3U; - for (uint8_t i = 0U; i < length; i++, count++) - reply[count] = data[i]; - - reply[1U] = count; - - writeInt(1U, reply, count); -} - void CSerialPort::writeM17Lost() { if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) diff --git a/SerialPort.h b/SerialPort.h index f397c52..f38c9f0 100644 --- a/SerialPort.h +++ b/SerialPort.h @@ -54,7 +54,6 @@ public: void writeM17LinkSetup(const uint8_t* data, uint8_t length); void writeM17Stream(const uint8_t* data, uint8_t length); - void writeM17Packet(const uint8_t* data, uint8_t length); void writeM17Lost(); #if defined(SEND_RSSI_DATA) diff --git a/version.h b/version.h index 3d379e6..ccb44a5 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU + * Copyright (C) 2020,2021 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,7 +26,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20210314" +#define VERSION_DATE "20210822" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot"