Skip to content

Commit

Permalink
Add new EOT indicator. Send RSSI/cost info for stream data. Update ve…
Browse files Browse the repository at this point in the history
…rsion to 2.4.0.
  • Loading branch information
mobilinkd committed Sep 6, 2021
1 parent fb29668 commit 6cdc8f8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
6 changes: 3 additions & 3 deletions TNC/KissHardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions TNC/M17.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ constexpr std::array<uint8_t, 2> LSF_SYNC = { 0x55, 0xF7 };
constexpr std::array<uint8_t, 2> STREAM_SYNC = { 0xFF, 0x5D };
constexpr std::array<uint8_t, 2> PACKET_SYNC = { 0x75, 0xFF };
constexpr std::array<uint8_t, 2> BERT_SYNC = { 0xDF, 0x55 };
constexpr std::array<uint8_t, 2> EOT_SYNC = { 0x55, 0x5D };

inline constexpr uint16_t sync_word(std::array<uint8_t, 2> sw)
{
Expand Down
10 changes: 9 additions & 1 deletion TNC/M17Encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -570,7 +574,11 @@ void M17Encoder::encoderTask(void const*)
HAL_IWDG_Refresh(&hiwdg);

auto frame = static_cast<IoFrame*>(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());
}
Expand Down
9 changes: 9 additions & 0 deletions TNC/M17FrameDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion TNC/Trellis.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Mobilinkd LLC.
// Copyright 2020-2021 Mobilinkd LLC.

#pragma once

Expand Down

0 comments on commit 6cdc8f8

Please sign in to comment.