Merge from KISS_TNC branch to master
commit
4f69b0ae6c
|
@ -0,0 +1,10 @@
|
|||
|
||||
#ifndef BUILD_NUMBER
|
||||
#define BUILD_NUMBER "40"
|
||||
#endif
|
||||
#ifndef VERSION
|
||||
#define VERSION "v0.3.2.40-cf9ad1d - 2021-09-14 11:14:16.765429"
|
||||
#endif
|
||||
#ifndef VERSION_SHORT
|
||||
#define VERSION_SHORT "v0.3.2.40-cf9ad1d"
|
||||
#endif
|
|
@ -24,3 +24,7 @@
|
|||
#define ERROR_INITRADIO 0x01
|
||||
#define ERROR_TXFAILED 0x02
|
||||
#define ERROR_QUEUE_FULL 0x04
|
||||
|
||||
//Data control frames, ported from Direwolf
|
||||
#define T_PKT 0xaa
|
||||
#define R_PKT 0xa6
|
||||
|
|
|
@ -33,9 +33,18 @@ String decapsulateKISS(const String &frame);
|
|||
|
||||
*/
|
||||
|
||||
<<<<<<< HEAD
|
||||
String encode_kiss(const String &tnc2FormattedFrame) {
|
||||
String ax25Frame = "";
|
||||
|
||||
=======
|
||||
String encode_kiss(const String &tnc2FormattedFrame, bool &pktFrame) {
|
||||
pktFrame = tnc2FormattedFrame.charAt(1) == R_PKT;
|
||||
String TNC2Frame = "";
|
||||
String ax25Frame = "";
|
||||
|
||||
if (!pktFrame) {
|
||||
>>>>>>> remotes/origin/KISS_TNC
|
||||
if (validateTNC2Frame(tnc2FormattedFrame)) {
|
||||
String address = "";
|
||||
bool dst_addres_written = false;
|
||||
|
@ -61,10 +70,23 @@ String encode_kiss(const String &tnc2FormattedFrame) {
|
|||
ax25Frame += (char) APRS_INFORMATION_FIELD;
|
||||
ax25Frame += tnc2FormattedFrame.substring(tnc2FormattedFrame.indexOf(':') + 1);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
String kissFrame = encapsulateKISS(ax25Frame, CMD_DATA);
|
||||
return kissFrame;
|
||||
}
|
||||
=======
|
||||
String kissFrame = encapsulateKISS(ax25Frame, CMD_DATA);
|
||||
return kissFrame;
|
||||
}
|
||||
else
|
||||
{
|
||||
String ax25Frame = encapsulateKISS(tnc2FormattedFrame, CMD_DATA);
|
||||
TNC2Frame += ax25Frame;
|
||||
return TNC2Frame;
|
||||
}
|
||||
}
|
||||
>>>>>>> remotes/origin/KISS_TNC
|
||||
|
||||
String encapsulateKISS(const String &ax25Frame, uint8_t TNCCmd) {
|
||||
String kissFrame = "";
|
||||
|
@ -113,11 +135,16 @@ String decapsulateKISS(const String &frame) {
|
|||
* @param dataFrame
|
||||
* @return Decapsulated TNC2KISS APRS data frame, or raw command data frame
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
String decode_kiss(const String &inputKISSTNCFrame, bool &dataFrame) {
|
||||
=======
|
||||
String decode_kiss(const String &inputKISSTNCFrame, bool &dataFrame, bool &pktFrame) {
|
||||
>>>>>>> remotes/origin/KISS_TNC
|
||||
String TNC2Frame = "";
|
||||
|
||||
if (validateKISSFrame(inputKISSTNCFrame)) {
|
||||
dataFrame = inputKISSTNCFrame.charAt(1) == CMD_DATA;
|
||||
<<<<<<< HEAD
|
||||
if (dataFrame){
|
||||
String ax25Frame = decapsulateKISS(inputKISSTNCFrame);
|
||||
bool isLast = false;
|
||||
|
@ -136,6 +163,32 @@ String decode_kiss(const String &inputKISSTNCFrame, bool &dataFrame) {
|
|||
// command frame, currently ignored
|
||||
TNC2Frame += inputKISSTNCFrame;
|
||||
}
|
||||
=======
|
||||
pktFrame = inputKISSTNCFrame.charAt(2) == T_PKT;
|
||||
if (dataFrame && pktFrame) {
|
||||
String ax25Frame = decapsulateKISS(inputKISSTNCFrame);
|
||||
delay(250);
|
||||
TNC2Frame += ax25Frame;
|
||||
}
|
||||
else if (dataFrame){
|
||||
String ax25Frame = decapsulateKISS(inputKISSTNCFrame);
|
||||
bool isLast = false;
|
||||
String dst_addr = decode_address_ax25(ax25Frame.substring(0, 7), isLast, false);
|
||||
String src_addr = decode_address_ax25(ax25Frame.substring(7, 14), isLast, false);
|
||||
TNC2Frame = src_addr + ">" + dst_addr;
|
||||
int digi_info_index = 14;
|
||||
while (!isLast && digi_info_index + 7 < ax25Frame.length()) {
|
||||
String digi_addr = decode_address_ax25(ax25Frame.substring(digi_info_index, digi_info_index + 7), isLast, true);
|
||||
TNC2Frame += ',' + digi_addr;
|
||||
digi_info_index += 7;
|
||||
}
|
||||
TNC2Frame += ':';
|
||||
TNC2Frame += ax25Frame.substring(digi_info_index + 2);
|
||||
} else {
|
||||
// command frame, currently ignored
|
||||
TNC2Frame += inputKISSTNCFrame;
|
||||
}
|
||||
>>>>>>> remotes/origin/KISS_TNC
|
||||
}
|
||||
return TNC2Frame;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,12 @@
|
|||
#define HAS_BEEN_DIGIPITED_MASK 0b10000000
|
||||
#define IS_LAST_ADDRESS_POSITION_MASK 0b1
|
||||
|
||||
<<<<<<< HEAD
|
||||
String encode_kiss(const String& tnc2FormattedFrame);
|
||||
String decode_kiss(const String &inputKISSTNCFrame, bool &dataFrame);
|
||||
=======
|
||||
String encode_kiss(const String& tnc2FormattedFrame, bool &pktFrame);
|
||||
String decode_kiss(const String &inputKISSTNCFrame, bool &dataFrame, bool &pktFrame);
|
||||
>>>>>>> remotes/origin/KISS_TNC
|
||||
|
||||
String encapsulateKISS(const String &ax25Frame, uint8_t TNCCmd);
|
|
@ -33,6 +33,7 @@ void handleKISSData(char character, int bufferIndex) {
|
|||
return;
|
||||
}
|
||||
inTNCData->concat(character);
|
||||
<<<<<<< HEAD
|
||||
if (character == (char) FEND && inTNCData->length() > 3)
|
||||
{
|
||||
bool isDataFrame = false;
|
||||
|
@ -52,12 +53,22 @@ void handleKISSData(char character, int bufferIndex) {
|
|||
{
|
||||
bool isDataFrame = false;
|
||||
const String &TNC2DataFrame = decode_kiss(*inTNCData, isDataFrame);
|
||||
=======
|
||||
if (character == (char) FEND && inTNCData->length() > 3) {
|
||||
bool isDataFrame = false;
|
||||
bool isPacketFrame = false;
|
||||
const String &TNC2DataFrame = decode_kiss(*inTNCData, isDataFrame, isPacketFrame);
|
||||
>>>>>>> remotes/origin/KISS_TNC
|
||||
|
||||
if (isDataFrame) {
|
||||
auto *buffer = new String();
|
||||
buffer->concat(TNC2DataFrame);
|
||||
<<<<<<< HEAD
|
||||
if (xQueueSend(tncToSendQueue, &buffer, (1000 / portTICK_PERIOD_MS)) != pdPASS)
|
||||
{
|
||||
=======
|
||||
if (xQueueSend(tncToSendQueue, &buffer, (1000 / portTICK_PERIOD_MS)) != pdPASS) {
|
||||
>>>>>>> remotes/origin/KISS_TNC
|
||||
delete buffer;
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +113,7 @@ void handleKISSData(char character, int bufferIndex) {
|
|||
|
||||
if (xQueueReceive(tncReceivedQueue, &loraReceivedFrameString, (1 / portTICK_PERIOD_MS)) == pdPASS) {
|
||||
bool isPacketFrame = false;
|
||||
<<<<<<< HEAD
|
||||
const String &kissEncoded_pkt = encode_kiss_pkt(*loraReceivedFrameString, isPacketFrame);
|
||||
const String &kissEncoded = encode_kiss(*loraReceivedFrameString);
|
||||
if (isPacketFrame) {
|
||||
|
@ -122,6 +134,9 @@ void handleKISSData(char character, int bufferIndex) {
|
|||
}
|
||||
else
|
||||
{
|
||||
=======
|
||||
const String &kissEncoded = encode_kiss(*loraReceivedFrameString, isPacketFrame);
|
||||
>>>>>>> remotes/origin/KISS_TNC
|
||||
Serial.print(kissEncoded);
|
||||
#ifdef ENABLE_BLUETOOTH
|
||||
if (SerialBT.hasClient()){
|
||||
|
@ -136,7 +151,10 @@ void handleKISSData(char character, int bufferIndex) {
|
|||
}
|
||||
}, &kissEncoded, clients, MAX_WIFI_CLIENTS);
|
||||
#endif
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
>>>>>>> remotes/origin/KISS_TNC
|
||||
delete loraReceivedFrameString;
|
||||
}
|
||||
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
FILENAME_BUILDNO = '.pio/versioning'
|
||||
FILENAME_VERSION_H = 'include/version.h'
|
||||
<<<<<<< HEAD
|
||||
version = 'v0.4.0.'
|
||||
=======
|
||||
version = 'v0.3.2.'
|
||||
>>>>>>> remotes/origin/KISS_TNC
|
||||
|
||||
import datetime
|
||||
from subprocess import *
|
||||
|
|
Loading…
Reference in New Issue