diff --git a/AX25RX.cpp b/AX25RX.cpp index 7a6b166..637bde0 100644 --- a/AX25RX.cpp +++ b/AX25RX.cpp @@ -63,7 +63,8 @@ m_state(), m_demod1(3), m_demod2(6), m_demod3(9), -m_lastFCS(0U) +m_lastFCS(0U), +m_count(0U) { m_filter.numTaps = FILTER_LEN; m_filter.pState = m_state; @@ -75,28 +76,38 @@ void CAX25RX::samples(q15_t* samples, uint8_t length) q15_t output[RX_BLOCK_SIZE]; ::arm_fir_fast_q15(&m_filter, samples, output, RX_BLOCK_SIZE); - m_lastFCS = 0U; + m_count++; + CAX25Frame frame; bool ret = m_demod1.process(output, length, frame); - if (ret && frame.m_fcs != m_lastFCS) { + if (ret) { + if (frame.m_fcs != m_lastFCS || m_count > 2U) { + m_lastFCS = frame.m_fcs; + m_count = 0U; + serial.writeAX25Data(frame.m_data, frame.m_length - 2U); + } DEBUG1("Decoder 1 reported"); - m_lastFCS = frame.m_fcs; - serial.writeAX25Data(frame.m_data, frame.m_length - 2U); } ret = m_demod2.process(output, length, frame); - if (ret && frame.m_fcs != m_lastFCS) { + if (ret) { + if (frame.m_fcs != m_lastFCS || m_count > 2U) { + m_lastFCS = frame.m_fcs; + m_count = 0U; + serial.writeAX25Data(frame.m_data, frame.m_length - 2U); + } DEBUG1("Decoder 2 reported"); - m_lastFCS = frame.m_fcs; - serial.writeAX25Data(frame.m_data, frame.m_length - 2U); } ret = m_demod3.process(output, length, frame); - if (ret && frame.m_fcs != m_lastFCS) { + if (ret) { + if (frame.m_fcs != m_lastFCS || m_count > 2U) { + m_lastFCS = frame.m_fcs; + m_count = 0U; + serial.writeAX25Data(frame.m_data, frame.m_length - 2U); + } DEBUG1("Decoder 3 reported"); - m_lastFCS = frame.m_fcs; - serial.writeAX25Data(frame.m_data, frame.m_length - 2U); } } diff --git a/AX25RX.h b/AX25RX.h index 3416b81..220d61d 100644 --- a/AX25RX.h +++ b/AX25RX.h @@ -38,6 +38,7 @@ private: CAX25Demodulator m_demod2; CAX25Demodulator m_demod3; uint16_t m_lastFCS; + uint32_t m_count; }; #endif diff --git a/AX25TX.cpp b/AX25TX.cpp new file mode 100644 index 0000000..6f9ed5e --- /dev/null +++ b/AX25TX.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2020 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "Config.h" +#include "Globals.h" +#include "AX25TX.h" + + +CAX25TX::CAX25TX() +{ +} + +void CAX25TX::process() +{ +} + +uint8_t CAX25TX::writeData(const uint8_t* data, uint16_t length) +{ + return 0U; +} + +void CAX25TX::setParams(int8_t twist) +{ +} + +void CAX25TX::setTXDelay(uint8_t delay) +{ +} + +uint8_t CAX25TX::getSpace() const +{ + return 0U; +} + diff --git a/AX25TX.h b/AX25TX.h index ffe31be..d89f77c 100644 --- a/AX25TX.h +++ b/AX25TX.h @@ -21,6 +21,8 @@ #include "Config.h" +#include "SerialRB.h" + class CAX25TX { public: CAX25TX();