From 9b4c19c101acdcdc8e8beff7c7b868d9f2f417ae Mon Sep 17 00:00:00 2001 From: Randy Pratt Date: Wed, 3 Jan 2024 04:11:26 -0600 Subject: [PATCH] APRS address and routing fix. (#77) * Update config.h Added note to APRS_RELAYS line. * Update ax25.h source_ssid and destination_ssid did not match. Uint8_t was used in function definition within ax25.c file. Now all should match. * Update ax25.c source_ssid and destination_ssid are both defined the same in config.h and in ax25.h. Both are inserted to memory by adjusting a pointer. Therefore both should require moving the pointer back 7 bytes to place in correctly addressed position. I am puzzled that the header definition and the cast in this code line are both needed. --- src/codecs/ax25/ax25.c | 2 +- src/codecs/ax25/ax25.h | 2 +- src/config.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/codecs/ax25/ax25.c b/src/codecs/ax25/ax25.c index d9ba168..b43e864 100644 --- a/src/codecs/ax25/ax25.c +++ b/src/codecs/ax25/ax25.c @@ -89,7 +89,7 @@ uint16_t ax25_encode_packet_aprs(char *source, uint8_t source_ssid, char *destin call_length = strlen(destination); memset(header->destination, ' ', sizeof(header->destination)); memcpy(header->destination, destination, call_length < 6 ? call_length : 6); - header->destination_ssid = destination_ssid; + header->destination_ssid = (uint8_t) destination_ssid >= 'A' ? destination_ssid - 7 : destination_ssid);; char *digipeater_addresses_start = ((char *) header) + 1 + 14; uint16_t digipeater_addresses_length = ax25_encode_digipeater_path(digipeater_addresses, digipeater_addresses_start); diff --git a/src/codecs/ax25/ax25.h b/src/codecs/ax25/ax25.h index a9999f6..cff0bfa 100644 --- a/src/codecs/ax25/ax25.h +++ b/src/codecs/ax25/ax25.h @@ -13,7 +13,7 @@ typedef struct _ax25_packet_header { char destination[6]; uint8_t destination_ssid; char source[6]; - char source_ssid; + uint8_t source_ssid; } ax25_packet_header; typedef struct _ax25_packet_header_end { diff --git a/src/config.h b/src/config.h index 7f999cf..716872c 100644 --- a/src/config.h +++ b/src/config.h @@ -275,7 +275,7 @@ #define APRS_SYMBOL_TABLE '/' // '/' denotes primary and '\\' denotes alternate APRS symbol table #define APRS_SYMBOL 'O' #define APRS_COMMENT "RS41ng radiosonde firmware test" -#define APRS_RELAYS "WIDE1-1,WIDE2-1" +#define APRS_RELAYS "WIDE1-1,WIDE2-1" //Do not include any spaces in the APRS_RELAYS #define APRS_DESTINATION "APZ41N" #define APRS_DESTINATION_SSID '0' // Generate an APRS weather report instead of a position report. This will override the APRS symbol with the weather station symbol.