Skip to content

Commit

Permalink
Fixed incorrect rssi calculation
Browse files Browse the repository at this point in the history
Similar to pr riverloopsec#278 but these values work better
  • Loading branch information
Mageh533 committed Jul 27, 2023
1 parent 5d4cf31 commit 47850a8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions killerbee/dev_cc253x.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,12 @@ def pnext(self, timeout=100):
# in last two bytes of framedata. Note that we remove these before return of the frame.

# RSSI is signed value, offset by 73 (see CC2530 data sheet for offset)
# Possible fix for incorrect rssi calculation
rssi = struct.unpack('b', framedata[-2:-1])[0] - 73
if rssi > 127 or rssi < -128:
print(f"Rssi = {rssi}, out of range, setting to 127")
rssi = 127

rssi = framedata[-2] - 73
# Dirty hack to compensate for possible RSSI overflow
if rssi > 255:
Expand Down

0 comments on commit 47850a8

Please sign in to comment.