Browse Source

Another fix for RX Autoswitch

master
US1GHQ 1 month ago
parent
commit
927887d42c
  1. 20
      include/version.h
  2. 2
      lib/KISS_TO_TNC2/KISS.h
  3. 33
      lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp

20
include/version.h

@ -1,10 +1,10 @@
#ifndef BUILD_NUMBER
#define BUILD_NUMBER "106"
#endif
#ifndef VERSION
#define VERSION "v0.4.1.106- - 2021-09-14 22:43:25.586224"
#endif
#ifndef VERSION_SHORT
#define VERSION_SHORT "v0.4.1.106-"
#endif
#ifndef BUILD_NUMBER
#define BUILD_NUMBER "51"
#endif
#ifndef VERSION
#define VERSION "v0.4.1.51-094e825 - 2021-09-15 11:45:40.987088"
#endif
#ifndef VERSION_SHORT
#define VERSION_SHORT "v0.4.1.51-094e825"
#endif

2
lib/KISS_TO_TNC2/KISS.h

@ -26,5 +26,5 @@
#define ERROR_QUEUE_FULL 0x04
//Data control frames, ported from Direwolf
#define T_PKT 0x03
#define T_PKT 0x82
#define R_PKT 0x03

33
lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp

@ -37,14 +37,18 @@ String encode_kiss(const String &tnc2FormattedFrame, bool &pktFrame) {
String TNC2Frame = "";
String ax25Frame = "";
for (int i = 0; i <= tnc2FormattedFrame.indexOf(','); i++)
{
char currentChar = tnc2FormattedFrame.charAt(i);
if (currentChar == ',')
{
pktFrame = true;
if (validateTNC2Frame(tnc2FormattedFrame)) {
for (int p = 0; p <= tnc2FormattedFrame.indexOf(':'); p++)
{
char currentChar = tnc2FormattedFrame.charAt(p);
if (currentChar == ':' || currentChar == '>' || currentChar == ',') {
if (!pktFrame && (currentChar == ',' || currentChar == ':'))
{
pktFrame = true;
}
}
}
}
if (pktFrame) {
if (validateTNC2Frame(tnc2FormattedFrame)) {
String address = "";
@ -133,15 +137,14 @@ String decode_kiss(const String &inputKISSTNCFrame, bool &dataFrame, bool &pktFr
String TNC2Frame = "";
if (validateKISSFrame(inputKISSTNCFrame)) {
dataFrame = inputKISSTNCFrame.charAt(1) == CMD_DATA;
for (int i = 15; i < inputKISSTNCFrame.length(); ++i)
String ax25Frame = decapsulateKISS(inputKISSTNCFrame);
if (ax25Frame.charAt(0) == T_PKT)
{
char currentChar = inputKISSTNCFrame.charAt(i);
if (currentChar == (char) T_PKT)
{
pktFrame = true;
}
}
pktFrame = true;
}
}
if (validateKISSFrame(inputKISSTNCFrame)) {
dataFrame = inputKISSTNCFrame.charAt(1) == CMD_DATA;
if (dataFrame && !pktFrame) {
String ax25Frame = decapsulateKISS(inputKISSTNCFrame);
delay(250);
@ -240,4 +243,4 @@ bool validateTNC2Frame(const String &tnc2FormattedFrame) {
bool validateKISSFrame(const String &kissFormattedFrame) {
return kissFormattedFrame.charAt(0) == (char) FEND &&
kissFormattedFrame.charAt(kissFormattedFrame.length() - 1) == (char) FEND;
}
}

Loading…
Cancel
Save