diff --git a/TNC/KissHardware.cpp b/TNC/KissHardware.cpp index 8e70c6c..a0cc572 100644 --- a/TNC/KissHardware.cpp +++ b/TNC/KissHardware.cpp @@ -43,13 +43,13 @@ int powerOffViaUSB(void) namespace mobilinkd { namespace tnc { namespace kiss { #if defined(NUCLEOTNC) -const char FIRMWARE_VERSION[] = "2.3.3"; +const char FIRMWARE_VERSION[] = "2.4.0"; const char HARDWARE_VERSION[] = "Mobilinkd NucleoTNC"; #elif defined(STM32L433xx) -const char FIRMWARE_VERSION[] = "2.3.3"; +const char FIRMWARE_VERSION[] = "2.4.0"; const char HARDWARE_VERSION[] = "Mobilinkd TNC3 2.1.1"; #elif defined(STM32L4P5xx) -const char FIRMWARE_VERSION[] = "2.3.3"; +const char FIRMWARE_VERSION[] = "2.4.0"; const char HARDWARE_VERSION[] = "Mobilinkd TNC3+ Rev A"; #endif Hardware& settings() diff --git a/TNC/M17.h b/TNC/M17.h index a903a29..df3ef9b 100644 --- a/TNC/M17.h +++ b/TNC/M17.h @@ -28,6 +28,7 @@ constexpr std::array LSF_SYNC = { 0x55, 0xF7 }; constexpr std::array STREAM_SYNC = { 0xFF, 0x5D }; constexpr std::array PACKET_SYNC = { 0x75, 0xFF }; constexpr std::array BERT_SYNC = { 0xDF, 0x55 }; +constexpr std::array EOT_SYNC = { 0x55, 0x5D }; inline constexpr uint16_t sync_word(std::array sw) { diff --git a/TNC/M17Encoder.cpp b/TNC/M17Encoder.cpp index e77700e..90a643d 100644 --- a/TNC/M17Encoder.cpp +++ b/TNC/M17Encoder.cpp @@ -378,6 +378,10 @@ void M17Encoder::send_stream(tnc::hdlc::IoFrame* frame, FrameType) frame->clear(); // Re-use existing frame. for (auto c : m17::STREAM_SYNC) frame->push_back(c); for (auto c : m17_frame) frame->push_back(c); + if (state == State::IDLE) + { + for (auto c : m17::EOT_SYNC) frame->push_back(c); + } auto status = osMessagePut( m17EncoderInputQueueHandle, @@ -570,7 +574,11 @@ void M17Encoder::encoderTask(void const*) HAL_IWDG_Refresh(&hiwdg); auto frame = static_cast(evt.value.p); - if (frame->size() != 48) + if (frame->size() == 50) + { + INFO("EOT"); + } + else if (frame->size() != 48) { WARN("Bad frame size %u", frame->size()); } diff --git a/TNC/M17FrameDecoder.h b/TNC/M17FrameDecoder.h index d3f8e63..0792ba3 100644 --- a/TNC/M17FrameDecoder.h +++ b/TNC/M17FrameDecoder.h @@ -425,14 +425,23 @@ struct M17FrameDecoder detail::to_frame(stream, output.stream); detail::to_bytes(output.packet, stream_segment); + stream->push_back(0); // Reserved + + // RF signal quality/strength. + if (ber < 128) stream->push_back(255 - ber * 2); + else stream->push_back(0); + if ((ber < 60) && (stream_segment[0] & 0x80)) { INFO("EOS"); state_ = State::LSF; result = DecodeResult::EOS; } + + // Bogus CRC bytes to be dropped. stream->push_back(0); stream->push_back(0); + stream->source(tnc::hdlc::IoFrame::STREAM); return result; } diff --git a/TNC/Trellis.h b/TNC/Trellis.h index 84b84f3..eec5808 100644 --- a/TNC/Trellis.h +++ b/TNC/Trellis.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020-2021 Mobilinkd LLC. #pragma once