microReticulumTbeam/exercises/17_Flash/read_partition_bin.py

11 lines
400 B
Python

import struct
with open('AMY_test_partitions_read.bin', 'rb') as f:
data = f.read()
seq0 = struct.unpack('<I', data[0:4])[0]
seq1 = struct.unpack('<I', data[32:36])[0]
print(f"OTA seq0: {seq0:08x}")
print(f"OTA seq1: {seq1:08x}")
if seq0 > seq1:
print("→ app0 is active, new uploads go to app1")
else:
print("→ app1 is active, new uploads go to app0")