fix(protocol): enhance extra chunk fetching logic to ensure footer detection
This commit is contained in:
+6
-6
@@ -885,17 +885,17 @@ def device_event_blastware_file(
|
||||
def _do():
|
||||
with _build_client(port, baud, host, tcp_port, timeout=120.0) as client:
|
||||
info = client.connect()
|
||||
# Calculate extra ADC chunks to download after finding "Project:".
|
||||
# BW downloads ~2 extra chunks per second of record time.
|
||||
# Without enough extra chunks the termination response contains no
|
||||
# footer bytes and Blastware rejects the file.
|
||||
# Download extra chunks after "Project:" until the footer marker
|
||||
# 0x0e 0x08 is detected in a chunk tail. The cap prevents
|
||||
# accidentally downloading into post-event silence.
|
||||
# Cap = rectime * 4 + 4 covers up to ~10 sec events safely.
|
||||
rectime = 1.0
|
||||
try:
|
||||
rectime = float(info.compliance_config.record_time or 1.0)
|
||||
except (AttributeError, TypeError, ValueError):
|
||||
pass
|
||||
extra_chunks = max(1, int(rectime))
|
||||
log.info("blastware_file: rectime=%.1fs → extra_chunks=%d", rectime, extra_chunks)
|
||||
extra_chunks = max(4, int(rectime * 4) + 4)
|
||||
log.info("blastware_file: rectime=%.1fs → extra_chunks_cap=%d", rectime, extra_chunks)
|
||||
events = client.get_events(
|
||||
full_waveform=False,
|
||||
stop_after_index=index,
|
||||
|
||||
Reference in New Issue
Block a user