added remote k209 setup
This commit is contained in:
@@ -3,10 +3,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from python_app.hardware_full.librevna_service import LibreVnaService
|
||||
from python_app.hardware_full.single_radar_service import create_single_radar_service
|
||||
|
||||
|
||||
class AppWindowRadarLimitsMixin:
|
||||
"""Handle LibreVNA capability probing and dependent UI clamping."""
|
||||
"""Handle radar capability probing and dependent UI clamping."""
|
||||
|
||||
def _on_radar_sweep_limits_changed(self) -> None:
|
||||
"""Clamp processing frequency bounds after sweep start/stop edits."""
|
||||
@@ -15,27 +16,19 @@ class AppWindowRadarLimitsMixin:
|
||||
self._on_processing_live_settings_changed()
|
||||
|
||||
def _refresh_radar_limits_from_device(self) -> bool:
|
||||
"""Query native LibreVNA limits and apply them to GUI fields."""
|
||||
serial = self._defaults_config.radar.serial
|
||||
radar_service = LibreVnaService(serial=serial or None)
|
||||
if not radar_service.driver_available:
|
||||
self._fallback_to_mock_mode("LibreVNA Python driver is not available for device limits query")
|
||||
return False
|
||||
"""Query native radar limits and apply them to GUI fields."""
|
||||
config = self._defaults_config
|
||||
if config.is_multi_device:
|
||||
radar_service = LibreVnaService(serial=config.radar.serial or None)
|
||||
else:
|
||||
radar_service = create_single_radar_service(config)
|
||||
|
||||
try:
|
||||
limits = radar_service.read_device_limits()
|
||||
except Exception as exc: # noqa: BLE001
|
||||
self._log_exception("Failed to query LibreVNA limits; using UI fallback", exc, level="WARN")
|
||||
self._apply_radar_limits_to_ui(None)
|
||||
return False
|
||||
if isinstance(radar_service, LibreVnaService) and not radar_service.driver_available:
|
||||
raise RuntimeError("LibreVNA Python driver is not available for device limits query")
|
||||
|
||||
limits = radar_service.read_device_limits()
|
||||
return self._apply_radar_limits_to_ui(limits)
|
||||
|
||||
def _fallback_to_mock_mode(self, reason: str) -> None:
|
||||
"""Handle unavailable native limits without mutating JSON-backed mode."""
|
||||
self._log_warning(reason)
|
||||
self._apply_radar_limits_to_ui(None)
|
||||
|
||||
def _apply_radar_limits_to_ui(self, limits: dict[str, float | int] | None) -> bool:
|
||||
"""Apply optional radar limits and clamp dependent GUI fields."""
|
||||
previous_limits = dict(self._radar_limits) if self._radar_limits is not None else None
|
||||
|
||||
@@ -6,7 +6,7 @@ import time
|
||||
|
||||
from python_app.gui.runtime.constraints import validate_processing_mode_constraints
|
||||
from python_app.gui.runtime.history import build_run_history_signature, record_result_history
|
||||
from python_app.hardware_full.librevna_service import LibreVnaService
|
||||
from python_app.hardware_full.single_radar_service import create_single_radar_service
|
||||
from python_app.models.dataset_model import ComboKey, ResultCollection, SweepCollection
|
||||
from python_app.models.run_config_model import RunConfigModel
|
||||
from python_app.orchestration.gpr_locator import collection_has_gpr_payloads
|
||||
@@ -181,7 +181,9 @@ class AppWindowPipelineMixin:
|
||||
self._start_run()
|
||||
|
||||
def _prepare_radar_for_native_acquisition(self, config: RunConfigModel) -> None:
|
||||
"""Preconfigure native LibreVNA using current sweep settings."""
|
||||
"""Preconfigure native single-radar hardware using current sweep settings."""
|
||||
if config.radar.model == RunConfigModel.COMPACT_M_K209_MODEL and config.radar.driver_mode != "native":
|
||||
raise RuntimeError("Compact-M K209 requires radar.driver_mode='native'")
|
||||
if config.radar.driver_mode != "native":
|
||||
self._log("Radar pre-configuration skipped (mock mode)")
|
||||
return
|
||||
@@ -189,8 +191,8 @@ class AppWindowPipelineMixin:
|
||||
self._log("Multi-device raw producer will configure all LibreVNA devices")
|
||||
return
|
||||
|
||||
radar_service = LibreVnaService(serial=config.radar.serial or None)
|
||||
if not radar_service.driver_available:
|
||||
radar_service = create_single_radar_service(config)
|
||||
if not getattr(radar_service, "driver_available", True):
|
||||
raise RuntimeError("LibreVNA Python driver is not available for native pre-configuration")
|
||||
|
||||
try:
|
||||
@@ -199,7 +201,7 @@ class AppWindowPipelineMixin:
|
||||
finally:
|
||||
radar_service.close()
|
||||
|
||||
self._log("Radar pre-configured via Python driver")
|
||||
self._log(f"Radar pre-configured via Python driver: model={config.radar.model}")
|
||||
|
||||
def _stop_run(self) -> None:
|
||||
"""Stop acquisition-side processes and close readers as needed."""
|
||||
|
||||
Reference in New Issue
Block a user