fix graph and white background added

This commit is contained in:
Ayzen
2026-10-15 14:46:06 +03:00
parent 5102ed751c
commit 9a9b8ce5c7
35 changed files with 730 additions and 463 deletions
@@ -68,11 +68,11 @@ class _DeviceCollectionState:
"""Mutable per-device flag marking that this device's capture has finished.
A device finishes when its final requested sweep cycle closes — either every
point of that cycle was delivered, or the free-running hardware sweep wrapped
back to point 0, proving the still-missing points are dropped frames that will
never arrive. The collector thread polls this flag so a gap ends the cycle at
the wrap instead of stalling until the no-progress timeout fires; the missing
points are zero-filled when the S-parameters are computed.
point of that cycle was delivered, or the point index stopped rising because the
free-running hardware sweep started over, proving the still-missing points are
dropped frames that will never arrive. The collector thread polls this flag so a
gap ends the cycle there instead of stalling until the no-progress timeout fires;
the missing points are zero-filled when the S-parameters are computed.
"""
__slots__ = ("last_cycle_closed", "capture_start_ns", "capture_end_ns")
@@ -449,8 +449,8 @@ def collect_complete_running_sweep_cycle(
"""Wrap a cycle-aware handler with cross-device cycle tracking.
Returns a per-datapoint handler that anchors cycle 0 on the first
``point_index == 0`` seen, closes on the next point-index wrap, and reports whether each
datapoint was consumed.
``point_index == 0`` seen, closes once the point index stops rising (the next
sweep began), and reports whether each datapoint was consumed.
"""
# In steady state the controller leaves the hardware sweep FREE-RUNNING
# between collections (the unchanged-config fast path only drains the host
@@ -468,6 +468,8 @@ def collect_complete_running_sweep_cycle(
# stale point 0 could still have been in flight; a large count means the
# remainder of the in-progress sweep was safely skipped.
"pre_anchor_skipped": 0,
# Newest point index of the anchored cycle; indices only rise within a sweep.
"last_point_index": 0,
}
def handle_datapoint(parsed_datapoint: ParsedVnaDatapoint) -> bool:
@@ -504,10 +506,12 @@ def collect_complete_running_sweep_cycle(
cycle_aware_handler(parsed_datapoint)
return True
if current_point_index == 0:
# A second point 0 closes this cycle; absent points are now losses.
if current_point_index <= cycle_tracking_state["last_point_index"]:
# The next sweep began: this closes the cycle even when its point 0 was
# lost, so its points never overwrite this one. Absent points are losses.
device_state.last_cycle_closed = True
return False
cycle_tracking_state["last_point_index"] = current_point_index
cycle_aware_handler(parsed_datapoint)
device_state.capture_end_ns = received_ns
return True