Be more guarded in the radio validity checks (and get outta here, you random repeaters I never favorited!)

This commit is contained in:
Jack Kingsman
2026-04-06 20:34:16 -07:00
parent 2f43420235
commit 08eaf090b2
3 changed files with 26 additions and 6 deletions

View File

@@ -299,8 +299,11 @@ def parse_advertisement(
timestamp = int.from_bytes(payload[32:36], byteorder="little")
flags = payload[100]
# Parse flags
# Parse flags — clamp device_role to valid range (0-4); corrupted
# advertisements can have junk in the lower nibble.
device_role = flags & 0x0F
if device_role > 4:
device_role = 0
has_location = bool(flags & 0x10)
has_feature1 = bool(flags & 0x20)
has_feature2 = bool(flags & 0x40)