Update firmware to use new stream frame format. Update version to 2.3.0.

master
Rob Riggs 2021-06-30 20:27:24 -05:00
rodzic d05679630b
commit 5398bc0be1
5 zmienionych plików z 11 dodań i 19 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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<uint8_t, 20> data;
std::array<uint8_t, 18> data;
std::copy(it, frame->end(), data.begin());
if (data[0] & 0x80) state = State::IDLE; // EOS

Wyświetl plik

@ -165,7 +165,7 @@ struct M17FrameDecoder
using lsf_buffer_t = std::array<uint8_t, 30>;
using audio_conv_buffer_t = std::array<uint8_t, 34>;
using audio_buffer_t = std::array<uint8_t, 20>;
using audio_buffer_t = std::array<uint8_t, 18>;
using link_setup_callback_t = std::function<void(audio_buffer_t)>;
using audio_callback_t = std::function<void(audio_buffer_t)>;
@ -177,7 +177,7 @@ struct M17FrameDecoder
std::array<uint8_t, 30> lich;
std::array<uint8_t, 240> lsf;
std::array<uint8_t, 206> packet;
std::array<uint8_t, 160> stream;
std::array<uint8_t, 144> 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<uint8_t, 20> stream_segment;
std::array<uint8_t, 18> 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;

Wyświetl plik

@ -24,10 +24,8 @@ inline constexpr auto P1 = std::experimental::make_array<int8_t>(
/// Puncture matrix for audio frames.
inline constexpr auto P2 = std::experimental::make_array<int8_t>(
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<int8_t>(

Wyświetl plik

@ -145,7 +145,6 @@ auto llr(FloatType sample)
template <size_t M, typename T, size_t N, typename U, size_t IN>
auto depunctured(std::array<T, N> puncture_matrix, std::array<U, IN> in)
{
static_assert(M % N == 0);
std::array<U, M> result;
size_t index = 0;
size_t pindex = 0;