Skip to content

Commit

Permalink
set end of address bit in ax.25 header
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpdx committed Jan 8, 2024
1 parent 681605b commit c7a59a5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions oresat_c3/protocols/ax25.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,24 @@ def ax25_pack(
raise Ax25Error("pid must fit into a uint8")

# callsigns must be 6 chars, add trailing spaces as padding
src_callsign += " " * (AX25_CALLSIGN_LEN - len(src_callsign))
dest_callsign += " " * (AX25_CALLSIGN_LEN - len(dest_callsign))
src_callsign += " " * (AX25_CALLSIGN_LEN - len(src_callsign))

# move ssid to bits 4-1
src_ssid <<= 1
dest_ssid <<= 1
src_ssid <<= 1

# set reserve bits
reserve_bits = 0b0110_0000
src_ssid |= reserve_bits
dest_ssid |= reserve_bits
src_ssid |= reserve_bits

# set the c-bits
src_ssid |= int(response) << 7
dest_ssid |= int(command) << 7
src_ssid |= int(response) << 7

# set end of address bit
src_ssid |= 1

# make AX25 packet header
# callsigns are bitshifted by 1
Expand Down

0 comments on commit c7a59a5

Please sign in to comment.