From aa1b84ce1cc8b20c3385ccc10b840b1cce68f456 Mon Sep 17 00:00:00 2001 From: jgromes Date: Tue, 28 Sep 2021 21:33:02 +0200 Subject: [PATCH] [AX25] Fixed extension bits and repeater callsigns --- src/protocols/AX25/AX25.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/protocols/AX25/AX25.cpp b/src/protocols/AX25/AX25.cpp index d5b5520c..bf6782de 100644 --- a/src/protocols/AX25/AX25.cpp +++ b/src/protocols/AX25/AX25.cpp @@ -126,7 +126,7 @@ int16_t AX25Frame::setRepeaters(char** repeaterCallsigns, uint8_t* repeaterSSIDs #ifndef RADIOLIB_STATIC_ONLY this->repeaterCallsigns = new char*[numRepeaters]; for(uint8_t i = 0; i < numRepeaters; i++) { - this->repeaterCallsigns[i] = new char[strlen(repeaterCallsigns[i])]; + this->repeaterCallsigns[i] = new char[strlen(repeaterCallsigns[i]) + 1]; } this->repeaterSSIDs = new uint8_t[numRepeaters]; #endif @@ -135,6 +135,7 @@ int16_t AX25Frame::setRepeaters(char** repeaterCallsigns, uint8_t* repeaterSSIDs this->numRepeaters = numRepeaters; for(uint8_t i = 0; i < numRepeaters; i++) { memcpy(this->repeaterCallsigns[i], repeaterCallsigns[i], strlen(repeaterCallsigns[i])); + this->repeaterCallsigns[i][strlen(repeaterCallsigns[i])] = '\0'; } memcpy(this->repeaterSSIDs, repeaterSSIDs, numRepeaters); @@ -249,7 +250,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) { frameBuffPtr += AX25_MAX_CALLSIGN_LEN; // set source SSID - *(frameBuffPtr++) = AX25_SSID_COMMAND_SOURCE | AX25_SSID_RESERVED_BITS | (frame->srcSSID & 0x0F) << 1 | AX25_SSID_HDLC_EXTENSION_END; + *(frameBuffPtr++) = AX25_SSID_COMMAND_SOURCE | AX25_SSID_RESERVED_BITS | (frame->srcSSID & 0x0F) << 1 | AX25_SSID_HDLC_EXTENSION_CONTINUE; // set repeater callsigns for(uint16_t i = 0; i < frame->numRepeaters; i++) { @@ -262,7 +263,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) { } // set HDLC extension end bit - *frameBuffPtr |= AX25_SSID_HDLC_EXTENSION_END; + *(frameBuffPtr - 1) |= AX25_SSID_HDLC_EXTENSION_END; // set sequence numbers of the frames that have it uint8_t controlField = frame->control;