Added support for encoding (receiving) digipeated frames
This commit is contained in:
@@ -25,6 +25,11 @@
|
|||||||
# https://thomask.sdf.org/blog/2018/12/15/sending-raw-ax25-python.html
|
# https://thomask.sdf.org/blog/2018/12/15/sending-raw-ax25-python.html
|
||||||
#
|
#
|
||||||
# TODO: remove escapes on decoding
|
# TODO: remove escapes on decoding
|
||||||
|
#
|
||||||
|
# Changes by PE1RXF
|
||||||
|
#
|
||||||
|
# 2022-01-23: - in encode_address() added correct handling of has_been_repeated flag '*'
|
||||||
|
#
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
@@ -44,7 +49,16 @@ def encode_address(s, final):
|
|||||||
if len(call) < 6:
|
if len(call) < 6:
|
||||||
call = call + b" "*(6 - len(call)) # pad with spaces
|
call = call + b" "*(6 - len(call)) # pad with spaces
|
||||||
encoded_call = [x << 1 for x in call[0:6]]
|
encoded_call = [x << 1 for x in call[0:6]]
|
||||||
encoded_ssid = (int(ssid) << 1) | 0b01100000 | (0b00000001 if final else 0)
|
|
||||||
|
encoded_ssid = 0b00000000
|
||||||
|
# If ssid ends with *, the message has been repeated, so we have to set the 'has_been_repeated' flag and remove the * from the ssid
|
||||||
|
if ssid[-1] == 42:
|
||||||
|
# print("Message has been repeated")
|
||||||
|
ssid = ssid[:-1]
|
||||||
|
encoded_ssid |= 0b10000000
|
||||||
|
|
||||||
|
encoded_ssid |= (int(ssid) << 1) | 0b01100000 | (0b00000001 if final else 0)
|
||||||
|
|
||||||
return encoded_call + [encoded_ssid]
|
return encoded_call + [encoded_ssid]
|
||||||
|
|
||||||
|
|
||||||
|
@@ -60,7 +60,7 @@ class KissServer(Thread):
|
|||||||
encoded_data = KissHelper.encode_kiss(data)
|
encoded_data = KissHelper.encode_kiss(data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("KISS encoding went wrong (exception while parsing)")
|
print("KISS encoding went wrong (exception while parsing)")
|
||||||
traceback.print_tb(e.__traceback__)
|
# traceback.print_tb(e.__traceback__)
|
||||||
encoded_data = None
|
encoded_data = None
|
||||||
|
|
||||||
if encoded_data != None:
|
if encoded_data != None:
|
||||||
|
@@ -20,5 +20,5 @@ AXUDP_LOCAL_PORT = 20000
|
|||||||
# USE_AXUDP Switch from KISS to AXUDP if True
|
# USE_AXUDP Switch from KISS to AXUDP if True
|
||||||
# APPEND_SIGNAL_REPORT adds signal report to text of APRS-Message for debug purpose
|
# APPEND_SIGNAL_REPORT adds signal report to text of APRS-Message for debug purpose
|
||||||
# this will change the original message and could cause loops
|
# this will change the original message and could cause loops
|
||||||
USE_AXUDP = True
|
USE_AXUDP = False
|
||||||
APPEND_SIGNAL_REPORT = True
|
APPEND_SIGNAL_REPORT = False
|
||||||
|
@@ -33,7 +33,7 @@ class BOARD:
|
|||||||
This is the Raspberry Pi board with one LED and a modtronix inAir9B.
|
This is the Raspberry Pi board with one LED and a modtronix inAir9B.
|
||||||
"""
|
"""
|
||||||
# Note that the BCOM numbering for the GPIOs is used.
|
# Note that the BCOM numbering for the GPIOs is used.
|
||||||
DIO0 = 22 # RaspPi GPIO 22
|
DIO0 = 5 # RaspPi GPIO 5
|
||||||
DIO1 = 23 # RaspPi GPIO 23
|
DIO1 = 23 # RaspPi GPIO 23
|
||||||
DIO2 = 24 # RaspPi GPIO 24
|
DIO2 = 24 # RaspPi GPIO 24
|
||||||
DIO3 = 25 # RaspPi GPIO 25
|
DIO3 = 25 # RaspPi GPIO 25
|
||||||
|
Reference in New Issue
Block a user