fix too close status

This commit is contained in:
2023-02-23 19:00:27 +01:00
parent f303ea7950
commit 5c361ba524
2 changed files with 9 additions and 6 deletions

View File

@ -9,13 +9,16 @@ Temperature, 2
Status, 1
import base64
import struct
payload = 'DQYCjAAAAAE='
frame = base64.b64decode(payload)
battery = struct.unpack('<H', frame[0:2])[0]
distance = struct.unpack('<H', frame[2:4])[0]
interrupt: frame[4:5]
temperature: frame[5:7]
status: struct.unpack('<H', frame[7:8])[0]
battery = struct.unpack('>H', frame[0:2])[0]
distance = struct.unpack('>H', frame[2:4])[0]
status = struct.unpack('?', frame[7:8])[0]
print(f"{battery=}, {distance=}, {status=}")
payload = 'DRgAAAAAAAE='