2 INIT_SEQ
= [0xEC,0x04,0x32,ord('b'),ord('l')]
4 BIND_SEQ
= [0xEC,0x04,0x32,ord('b'),ord('d')]
6 MODEL_SEQ
= [0xEC,0x04,0x32,ord('m'),ord('m')]
8 def calc_crc8(payload
, poly
=0xD5):
14 crc
= (crc
<< 1) ^ poly
19 def get_telemetry_seq(seq
, key
=None):
24 key
= [ord(x
) for x
in key
]
26 payload
[1] += len(key
)
27 payload
+= [calc_crc8(payload
[2:])]
30 def get_init_seq(key
=None):
31 return get_telemetry_seq(INIT_SEQ
, key
)
33 def get_bind_seq(key
=None):
34 return get_telemetry_seq(BIND_SEQ
, key
)
36 def get_model_seq(model
):
37 return get_telemetry_seq(MODEL_SEQ
, model
)