KISS_TNC
US1GHQ 2021-09-07 15:19:24 +03:00
parent 5990975d34
commit cdbff4df9f
2 changed files with 7 additions and 9 deletions

View File

@ -1,10 +1,10 @@
#ifndef BUILD_NUMBER #ifndef BUILD_NUMBER
#define BUILD_NUMBER "86" #define BUILD_NUMBER "104"
#endif #endif
#ifndef VERSION #ifndef VERSION
#define VERSION "v0.3.2.86-b0bdfaa - 2021-09-07 13:41:47.140024" #define VERSION "v0.3.2.104-5990975 - 2021-09-07 15:06:42.831481"
#endif #endif
#ifndef VERSION_SHORT #ifndef VERSION_SHORT
#define VERSION_SHORT "v0.3.2.86-b0bdfaa" #define VERSION_SHORT "v0.3.2.104-5990975"
#endif #endif

View File

@ -42,7 +42,7 @@ String encapsulateKISS(const String &ax25Frame, uint8_t TNCCmd)
String kissFrame = ""; String kissFrame = "";
kissFrame += (char) FEND; // start of frame kissFrame += (char) FEND; // start of frame
kissFrame += (char) (0x0f & TNCCmd); // TNC0, cmd kissFrame += (char) (0x0f & TNCCmd); // TNC0, cmd
for (int i = 0; i < ax25Frame.length(); ++i) for (int i = 0; i < ax25Frame.length() ; ++i)
{ {
char currentChar = ax25Frame.charAt(i); char currentChar = ax25Frame.charAt(i);
if (currentChar == (char) FEND) if (currentChar == (char) FEND)
@ -68,8 +68,6 @@ String encapsulateKISS(const String &ax25Frame, uint8_t TNCCmd)
String decapsulateKISS(const String &frame, uint8_t TNCCmd) String decapsulateKISS(const String &frame, uint8_t TNCCmd)
{ {
String ax25Frame = ""; String ax25Frame = "";
ax25Frame += (char) FEND; // start of frame
ax25Frame += (char) (TNCCmd); // TNC0, cmd
for (int i = 2; i < frame.length() - 1; ++i) for (int i = 2; i < frame.length() - 1; ++i)
{ {
char currentChar = frame.charAt(i); char currentChar = frame.charAt(i);
@ -88,19 +86,19 @@ String decapsulateKISS(const String &frame, uint8_t TNCCmd)
ax25Frame += currentChar; ax25Frame += currentChar;
} }
} }
ax25Frame += (char) FEND; // end of frame
Serial.print(ax25Frame);
return ax25Frame; return ax25Frame;
} }
//HACK for PACKEt MODE //HACK for PACKEt MODE
String decode_kiss_pkt(const String &inputKISSTNCFrame, bool &dataFrame) { String decode_kiss_pkt(const String &inputKISSTNCFrame, bool &dataFrame) {
String TNC2Frame = ""; String TNC2Frame = "";
dataFrame = inputKISSTNCFrame.charAt(1) == CMD_DATA; if (validateKISSFrame(inputKISSTNCFrame)) {
dataFrame = inputKISSTNCFrame.charAt(1) == CMD_DATA;
if (dataFrame){ if (dataFrame){
String ax25Frame = decapsulateKISS(inputKISSTNCFrame, CMD_DATA); String ax25Frame = decapsulateKISS(inputKISSTNCFrame, CMD_DATA);
delay(250); delay(250);
TNC2Frame += ax25Frame; TNC2Frame += ax25Frame;
}
} }
return TNC2Frame; return TNC2Frame;
} }