48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
# Battery F1 (pre-conditioning (b) / fast-reconnect residue) — chain of 20
|
|
# connections, each 0.6s after the previous close (the Trap-22 fast window).
|
|
# Even idx = plain connection (64x10 + 2048 fill, the residue-leaver);
|
|
# odd idx = canary connection (64x10 + 2048 F1 + 0.4s hold + 2048 F2 canary
|
|
# + 64x10 tail). Pair i = (conn 2i, conn 2i+1): the canary connection is
|
|
# pre-conditioned by the immediately preceding fast plain connection.
|
|
# Pair 0's plain connection follows a fresh boot (internal control).
|
|
# Verdict offline: probe_classify.py F
|
|
from probe_bench_lib import *
|
|
|
|
N_CONN = 20
|
|
GAP_S = 0.6
|
|
|
|
def run_conn(s, idx, with_canary):
|
|
if not send_rounds64(s, 10, 0, "R"):
|
|
pass # keep collecting; offline classification is authoritative
|
|
f = pattern(640, 2048)
|
|
s.sendall(f)
|
|
rx, _ = wait_step(s, 2048, "F1", 3.0)
|
|
hexdump(rx, "HEXc%02dF1" % idx)
|
|
if with_canary:
|
|
time.sleep(0.40) # hold: in-window status reads on the device side
|
|
f2 = pattern(2688, 2048)
|
|
s.sendall(f2)
|
|
time.sleep(0.30)
|
|
for i in range(10):
|
|
s.sendall(pattern(4736 + i * 64, 64))
|
|
rx, _ = wait_step(s, 2688, "F2+TAIL", 4.0)
|
|
hexdump(rx, "HEXc%02dG" % idx)
|
|
|
|
def main():
|
|
for idx in range(N_CONN):
|
|
print("CONN %d canary=%d" % (idx, 1 if idx % 2 == 1 else 0))
|
|
try:
|
|
s = connect()
|
|
except OSError as e:
|
|
print("CONN %d REFUSED: %s" % (idx, e))
|
|
time.sleep(1.0)
|
|
continue
|
|
run_conn(s, idx, with_canary=(idx % 2 == 1))
|
|
try:
|
|
s.close()
|
|
except OSError:
|
|
pass
|
|
time.sleep(GAP_S)
|
|
|
|
main()
|