fix: fix token position in params and enhance event iteration logic for MiniMateClient

This commit is contained in:
Brian Harrison
2026-04-03 17:30:47 -04:00
parent 3effa1aab5
commit 4fb1bbfe35
3 changed files with 52 additions and 16 deletions

View File

@@ -201,9 +201,20 @@ class MiniMateClient:
log.info("count_events: 1E returned null sentinel — device is empty")
return 0
# Iterate via 0A → 1F. Each 0A call establishes waveform context so that
# 1F (EVENT_ADVANCE) returns the actual next-event key. Without the 0A
# call, 1F immediately returns the null sentinel regardless of how many
# events are stored. Confirmed from 4-3-26 two-event BW/S3 capture:
# browse-mode sequence is 0A(keyN) → 1F → 0A(keyN+1) → 1F → … → null.
count = 0
while data8[4:8] != b"\x00\x00\x00\x00":
count += 1
try:
# 0A establishes device context for this key before 1F advances.
proto.read_waveform_header(key4)
except ProtocolError as exc:
log.warning("count_events: 0A failed for key=%s: %s", key4.hex(), exc)
break
try:
key4, data8 = proto.advance_event()
log.warning(