ch1 ch2 new

This commit is contained in:
awe
2026-05-29 17:15:32 +03:00
parent 5591e80c53
commit 08dc6b3a1f
5 changed files with 328 additions and 27 deletions

View File

@ -74,6 +74,7 @@ TTY_RANGE_MIN_V = 1e-6
TTY_RANGE_MAX_V = 1_000_000.0
LOGDET_EXP_INPUT_LIMIT = 80.0
DO1_TAGGED_INFO_KEY = "_do1_tagged_payload"
SECONDARY_INFO_KEY = "_secondary_payload"
DISPLAY_DISTANCE_ZERO_M = 9.0
@ -944,6 +945,8 @@ def run_pyqtgraph(args) -> None:
curve = p_line.plot(pen=pg.mkPen((80, 120, 255), width=1))
curve_raw_low = p_line.plot(pen=pg.mkPen((255, 90, 90), width=1))
curve_raw_high = p_line.plot(pen=pg.mkPen((90, 220, 255), width=1))
curve_secondary_ch1 = p_line.plot(pen=pg.mkPen((0, 200, 100), width=1))
curve_secondary_ch2 = p_line.plot(pen=pg.mkPen((200, 100, 200), width=1))
p_line_aux_vb = None
if bin_iq_power_mode:
p_line_aux_vb = pg.ViewBox()
@ -1889,6 +1892,8 @@ def run_pyqtgraph(args) -> None:
runtime.current_do1_tagged_raw_high = None
runtime.current_do1_tagged_aux_low = None
runtime.current_do1_tagged_aux_high = None
runtime.current_secondary_ch1 = None
runtime.current_secondary_ch2 = None
runtime.current_sweep_norm = None
runtime.current_fft_mag = None
runtime.current_fft_db = None
@ -1952,6 +1957,27 @@ def run_pyqtgraph(args) -> None:
runtime.current_do1_tagged_aux_low = None
runtime.current_do1_tagged_aux_high = None
if runtime.full_secondary_ch1 is not None:
runtime.current_secondary_ch1 = apply_working_range_to_signal(
runtime.full_current_freqs,
runtime.full_current_sweep_raw,
runtime.full_secondary_ch1,
runtime.range_min_ghz,
runtime.range_max_ghz,
)
else:
runtime.current_secondary_ch1 = None
if runtime.full_secondary_ch2 is not None:
runtime.current_secondary_ch2 = apply_working_range_to_signal(
runtime.full_current_freqs,
runtime.full_current_sweep_raw,
runtime.full_secondary_ch2,
runtime.range_min_ghz,
runtime.range_max_ghz,
)
else:
runtime.current_secondary_ch2 = None
if runtime.current_sweep_raw.size == 0:
if push_to_ring:
reset_ring_buffers()
@ -1965,6 +1991,8 @@ def run_pyqtgraph(args) -> None:
runtime.current_do1_tagged_raw_high = None
runtime.current_do1_tagged_aux_low = None
runtime.current_do1_tagged_aux_high = None
runtime.current_secondary_ch1 = None
runtime.current_secondary_ch2 = None
runtime.current_sweep_norm = None
runtime.current_fft_mag = None
runtime.current_fft_db = None
@ -2722,6 +2750,8 @@ def run_pyqtgraph(args) -> None:
runtime.full_do1_tagged_aux_high = None
runtime.full_do1_tagged_aux_low_codes = None
runtime.full_do1_tagged_aux_high_codes = None
runtime.full_secondary_ch1 = None
runtime.full_secondary_ch2 = None
signal_kind = get_signal_kind(info)
if signal_kind == "bin_iq_do1_tagged":
calibrated = calibrate_freqs(
@ -2845,6 +2875,20 @@ def run_pyqtgraph(args) -> None:
runtime.full_current_aux_curves = None
runtime.full_current_aux_curves_codes = None
runtime.full_current_sweep_codes = None
secondary_payload = info.get(SECONDARY_INFO_KEY) if isinstance(info, dict) else None
if isinstance(secondary_payload, dict):
sec_ch1 = secondary_payload.get("ch1")
sec_ch2 = secondary_payload.get("ch2")
if sec_ch1 is not None:
runtime.full_secondary_ch1 = np.asarray(
calibrate_freqs({"F": base_freqs, "I": sec_ch1})["I"],
dtype=np.float32,
)
if sec_ch2 is not None:
runtime.full_secondary_ch2 = np.asarray(
calibrate_freqs({"F": base_freqs, "I": sec_ch2})["I"],
dtype=np.float32,
)
refresh_current_window(push_to_ring=True)
processed_frames += 1
last_packet_processed_at = time.time()
@ -2999,6 +3043,21 @@ def run_pyqtgraph(args) -> None:
clear_curve_if_needed("raw_low", curve_raw_low)
clear_curve_if_needed("raw_high", curve_raw_high)
if runtime.current_secondary_ch1 is not None:
sec_width = min(xs.size, runtime.current_secondary_ch1.size)
sec_x1, sec_y1 = decimate_curve_for_display(xs[:sec_width], runtime.current_secondary_ch1[:sec_width])
sec_x1, sec_y1 = sanitize_curve_data_for_display(sec_x1, sec_y1)
set_curve_data("secondary_ch1", curve_secondary_ch1, sec_x1, sec_y1, autoDownsample=False)
else:
clear_curve_if_needed("secondary_ch1", curve_secondary_ch1)
if runtime.current_secondary_ch2 is not None:
sec_width2 = min(xs.size, runtime.current_secondary_ch2.size)
sec_x2, sec_y2 = decimate_curve_for_display(xs[:sec_width2], runtime.current_secondary_ch2[:sec_width2])
sec_x2, sec_y2 = sanitize_curve_data_for_display(sec_x2, sec_y2)
set_curve_data("secondary_ch2", curve_secondary_ch2, sec_x2, sec_y2, autoDownsample=False)
else:
clear_curve_if_needed("secondary_ch2", curve_secondary_ch2)
if active_do1_tagged:
if displayed_tagged_aux_low is not None:
aux_low_1, aux_low_2 = displayed_tagged_aux_low