new logging
This commit is contained in:
@ -38,6 +38,7 @@ from rfg_adc_plotter.state import RingBuffer, RuntimeState
|
||||
from rfg_adc_plotter.types import SweepAuxCurves, SweepInfo, SweepPacket
|
||||
|
||||
RAW_PLOT_MAX_POINTS = 4096
|
||||
DEBUG_FRAME_LOG_EVERY = 10
|
||||
|
||||
|
||||
def _visible_levels_pyqtgraph(data: np.ndarray, plot_item) -> Optional[Tuple[float, float]]:
|
||||
@ -1240,6 +1241,8 @@ def run_pyqtgraph(args) -> None:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
processed_frames = 0
|
||||
|
||||
def refresh_current_fft_cache(sweep_for_fft: np.ndarray, bins: int) -> None:
|
||||
runtime.current_fft_complex = compute_fft_complex_row(
|
||||
sweep_for_fft,
|
||||
@ -1251,6 +1254,7 @@ def run_pyqtgraph(args) -> None:
|
||||
runtime.current_fft_db = fft_mag_to_db(runtime.current_fft_mag)
|
||||
|
||||
def drain_queue() -> int:
|
||||
nonlocal processed_frames
|
||||
drained = 0
|
||||
while True:
|
||||
try:
|
||||
@ -1301,6 +1305,22 @@ def run_pyqtgraph(args) -> None:
|
||||
runtime.full_current_aux_curves = None
|
||||
runtime.current_info = info
|
||||
refresh_current_window(push_to_ring=True)
|
||||
processed_frames += 1
|
||||
if processed_frames % DEBUG_FRAME_LOG_EVERY == 0:
|
||||
try:
|
||||
queue_size = queue.qsize()
|
||||
except Exception:
|
||||
queue_size = -1
|
||||
sys.stderr.write(
|
||||
"[debug] ui frames:%d last_sweep:%s ch:%s width:%d queue:%d\n"
|
||||
% (
|
||||
processed_frames,
|
||||
str(info.get("sweep") if isinstance(info, dict) else None),
|
||||
str(info.get("ch") if isinstance(info, dict) else None),
|
||||
int(getattr(sweep, "size", 0)),
|
||||
int(queue_size),
|
||||
)
|
||||
)
|
||||
if drained > 0:
|
||||
update_physical_axes()
|
||||
return drained
|
||||
|
||||
Reference in New Issue
Block a user