Skip to content

Commit 47850a8

Browse files
committed
Fixed incorrect rssi calculation
Similar to pr riverloopsec#278 but these values work better
1 parent 5d4cf31 commit 47850a8

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

killerbee/dev_cc253x.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ def pnext(self, timeout=100):
241241
# in last two bytes of framedata. Note that we remove these before return of the frame.
242242

243243
# RSSI is signed value, offset by 73 (see CC2530 data sheet for offset)
244+
# Possible fix for incorrect rssi calculation
245+
rssi = struct.unpack('b', framedata[-2:-1])[0] - 73
246+
if rssi > 127 or rssi < -128:
247+
print(f"Rssi = {rssi}, out of range, setting to 127")
248+
rssi = 127
249+
244250
rssi = framedata[-2] - 73
245251
# Dirty hack to compensate for possible RSSI overflow
246252
if rssi > 255:

0 commit comments

Comments
 (0)