Skip to content

Commit

Permalink
Uplink demodulation: Error handling if frame type not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeija committed Dec 23, 2018
1 parent bbbe4e5 commit 1dce6aa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions uplink/demodulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ def hammingDistance(str1, str2):
min_hammdist_ftype = ftype

best_ftype = int(min_hammdist_ftype, 2)

if not best_ftype in PACKETLEN_BY_FTYPE:
print("[Frame " + str(count) + "]: Frame type 0x{:03x} not found, ignoring".format(int(ftype, 2)))
print("[Frame " + str(count) + "]: Raw bitstring is " + bitstring)
continue

packetlen = PACKETLEN_BY_FTYPE[best_ftype]
print("[Frame " + str(count) + "]: Frame Type is 0x{:03x}".format(best_ftype) + ", Packet Length " + str(packetlen) + " bytes")

Expand Down

0 comments on commit 1dce6aa

Please sign in to comment.