diff --git a/TNC/KissHardware.cpp b/TNC/KissHardware.cpp index d5165b3..3776ff1 100644 --- a/TNC/KissHardware.cpp +++ b/TNC/KissHardware.cpp @@ -43,10 +43,10 @@ int powerOffViaUSB(void) namespace mobilinkd { namespace tnc { namespace kiss { #ifdef NUCLEOTNC -const char FIRMWARE_VERSION[] = "2.2.2"; +const char FIRMWARE_VERSION[] = "2.3.0"; const char HARDWARE_VERSION[] = "Mobilinkd NucleoTNC"; #else -const char FIRMWARE_VERSION[] = "2.2.2"; +const char FIRMWARE_VERSION[] = "2.3.0"; const char HARDWARE_VERSION[] = "Mobilinkd TNC3 2.1.1"; #endif diff --git a/TNC/M17Encoder.cpp b/TNC/M17Encoder.cpp index 220fc68..a8b45f8 100644 --- a/TNC/M17Encoder.cpp +++ b/TNC/M17Encoder.cpp @@ -220,7 +220,7 @@ void M17Encoder::process_stream(tnc::hdlc::IoFrame* frame, FrameType type) } break; case State::ACTIVE: - if (frame->size() == 26) + if (frame->size() == 24) { send_stream(frame, type); // Consumes frame. } @@ -356,7 +356,7 @@ void M17Encoder::send_stream(tnc::hdlc::IoFrame* frame, FrameType) auto fit = std::copy(lich.begin(), lich.end(), m17_frame.begin()); // Encode & puncture - std::array data; + std::array data; std::copy(it, frame->end(), data.begin()); if (data[0] & 0x80) state = State::IDLE; // EOS diff --git a/TNC/M17FrameDecoder.h b/TNC/M17FrameDecoder.h index fd41d21..c7fc578 100644 --- a/TNC/M17FrameDecoder.h +++ b/TNC/M17FrameDecoder.h @@ -165,7 +165,7 @@ struct M17FrameDecoder using lsf_buffer_t = std::array; using audio_conv_buffer_t = std::array; - using audio_buffer_t = std::array; + using audio_buffer_t = std::array; using link_setup_callback_t = std::function; using audio_callback_t = std::function; @@ -177,7 +177,7 @@ struct M17FrameDecoder std::array lich; std::array lsf; std::array packet; - std::array stream; + std::array stream; } output; union { @@ -388,7 +388,7 @@ struct M17FrameDecoder [[gnu::noinline]] DecodeResult decode_stream(buffer_t& buffer, tnc::hdlc::IoFrame*& stream, int& ber) { - std::array stream_segment; + std::array stream_segment; DecodeResult result = DecodeResult::OK; unpack_lich(buffer); @@ -397,17 +397,12 @@ struct M17FrameDecoder for (auto c : tmp.lich) stream->push_back(c); std::copy(buffer.begin() + 96, buffer.end(), tmp.stream.begin()); - auto dp = depunctured<328>(P2, tmp.stream); + auto dp = depunctured<296>(P2, tmp.stream); ber = viterbi_.decode(dp, output.stream); - ber = ber > 28 ? ber - 28 : 0; detail::to_frame(stream, output.stream); detail::to_bytes(output.packet, stream_segment); - crc_.reset(); - for (auto c : stream_segment) crc_(c); - auto checksum = crc_.get(); - INFO("crc = %04x", checksum); // Otherwise ignored. - if ((checksum == 0) && (stream_segment[0] & 0x80)) + if ((ber < 70) && (stream_segment[0] & 0x80)) { INFO("EOS"); state_ = State::LSF; diff --git a/TNC/Trellis.h b/TNC/Trellis.h index 37102f5..4554805 100644 --- a/TNC/Trellis.h +++ b/TNC/Trellis.h @@ -24,10 +24,8 @@ inline constexpr auto P1 = std::experimental::make_array( /// Puncture matrix for audio frames. inline constexpr auto P2 = std::experimental::make_array( - 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, - 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1); + 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0); /// Puncture matrix for packet frames (7/8). inline constexpr auto P3 = std::experimental::make_array( diff --git a/TNC/Util.h b/TNC/Util.h index 614f360..50379cd 100644 --- a/TNC/Util.h +++ b/TNC/Util.h @@ -145,7 +145,6 @@ auto llr(FloatType sample) template auto depunctured(std::array puncture_matrix, std::array in) { - static_assert(M % N == 0); std::array result; size_t index = 0; size_t pindex = 0;