Browse Source

0.4.2 TX Autoswitch based on frames WIDE,ECHO,RELAY etc

master
US1GHQ 1 month ago
parent
commit
968381645a
  1. 20
      include/version.h
  2. 43
      lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp
  3. 2
      tools/buildscript_versioning.py

20
include/version.h

@ -1,10 +1,10 @@
#ifndef BUILD_NUMBER
#define BUILD_NUMBER "70"
#endif
#ifndef VERSION
#define VERSION "v0.4.1.70-927887d - 2021-09-15 13:47:05.313727"
#endif
#ifndef VERSION_SHORT
#define VERSION_SHORT "v0.4.1.70-927887d"
#endif
#ifndef BUILD_NUMBER
#define BUILD_NUMBER "163"
#endif
#ifndef VERSION
#define VERSION "v0.4.1.163- - 2021-09-15 19:52:36.196438"
#endif
#ifndef VERSION_SHORT
#define VERSION_SHORT "v0.4.1.163-"
#endif

43
lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp

@ -4,6 +4,7 @@ bool validateTNC2Frame(const String &tnc2FormattedFrame);
String encode_address_ax25(String tnc2Address);
String decode_address_ax25(const String &ax25Address, bool &isLast, bool isRelay);
String decode_path_ax25(const String &ax25Address, bool &isLast, bool isRelay);
bool validateKISSFrame(const String &kissFormattedFrame);
@ -136,15 +137,20 @@ String decapsulateKISS(const String &frame) {
String decode_kiss(const String &inputKISSTNCFrame, bool &dataFrame, bool &pktFrame) {
String TNC2Frame = "";
if (validateKISSFrame(inputKISSTNCFrame)) {
String ax25Frame = decapsulateKISS(inputKISSTNCFrame);
bool isLast = false;
String dest = decode_address_ax25(ax25Frame.substring(14, 21), isLast, false);
// Serial.print(src_addr);
for (int p = 0; p <= dest.indexOf('W'); p++) {
char dest_1 = dest.charAt(p);
Serial.print(dest_1);
}
if (validateKISSFrame(inputKISSTNCFrame))
{
String ax25Frame = decapsulateKISS(inputKISSTNCFrame);
bool isLast = false;
String dest_1 = decode_path_ax25(ax25Frame.substring(14, 56), isLast, false);
for (int p = 0; p <= dest_1.indexOf("WIDE"); p++) { pktFrame = true; }
String dest_2 = decode_path_ax25(ax25Frame.substring(14, 56), isLast, false);
for (int p = 0; p <= dest_2.indexOf("ECHO"); p++) { pktFrame = true; }
String dest_3 = decode_path_ax25(ax25Frame.substring(14, 56), isLast, false);
for (int p = 0; p <= dest_3.indexOf("TRACE"); p++) { pktFrame = true; }
String dest_4 = decode_path_ax25(ax25Frame.substring(14, 56), isLast, false);
for (int p = 0; p <= dest_4.indexOf("RELAY"); p++) { pktFrame = true; }
String dest_5 = decode_path_ax25(ax25Frame.substring(14, 56), isLast, false);
for (int p = 0; p <= dest_5.indexOf("TCPIP"); p++) { pktFrame = true; }
}
if (validateKISSFrame(inputKISSTNCFrame)) {
dataFrame = inputKISSTNCFrame.charAt(1) == CMD_DATA;
@ -239,6 +245,25 @@ String decode_address_ax25(const String &ax25Address, bool &isLast, bool isRelay
return TNCAddress;
}
String decode_path_ax25(const String &ax25Address, bool &isLast, bool isRelay) {
String TNCAddress = "";
for (int i = 0; i < 42; ++i) {
uint8_t currentCharacter = ax25Address.charAt(i);
currentCharacter >>= 1;
if (currentCharacter != ' ') {
TNCAddress += (char) currentCharacter;
}
}
auto ssid_char = (uint8_t) ax25Address.charAt(6);
int ssid = 0b1111 & ssid_char;
if (ssid)
{
TNCAddress += '-';
TNCAddress += ssid;
}
return TNCAddress;
}
bool validateTNC2Frame(const String &tnc2FormattedFrame) {
return (tnc2FormattedFrame.indexOf(':') != -1) && (tnc2FormattedFrame.indexOf('>') != -1);
}

2
tools/buildscript_versioning.py

@ -1,6 +1,6 @@
FILENAME_BUILDNO = '.pio/versioning'
FILENAME_VERSION_H = 'include/version.h'
version = 'v0.4.1.'
version = 'v0.4.2.'
import datetime
from subprocess import *

Loading…
Cancel
Save