diff --git a/charon_vna/gui.py b/charon_vna/gui.py index fc2668a..2910d7d 100644 --- a/charon_vna/gui.py +++ b/charon_vna/gui.py @@ -36,7 +36,7 @@ class MainWindow(QMainWindow): plots: List[PlotWidget] - def __init__(self, uri: str | None = None): + def __init__(self, ip: str | None = None): super().__init__() self.config_path = DEFAULT_CONFIG @@ -47,8 +47,8 @@ class MainWindow(QMainWindow): vna_kwargs = dict( frequency=self._frequency, ) - if uri is not None: - vna_kwargs["uri"] = uri + if ip is not None: + vna_kwargs["ip"] = ip self.vna = Charon(**vna_kwargs) mpl.use("QtAgg") @@ -206,12 +206,17 @@ def main() -> None: except Exception as e: if e.args[0] == "No device found": dialog = QInputDialog() - text, ok = dialog.getText(None, "Pluto IP Address", "IP Address", QLineEdit.Normal, "") + text, ok = dialog.getText( + None, + "Pluto IP Address", + "Enter Pluto IP Address", + QLineEdit.Normal, + "192.168.2.1", + ) match = re.match(r"(\d{1,3}\.){3}\d{1,3}", text) if not match: raise ValueError(f"Invalid IP address: {text}") - uri = f"ip:{text}" - window = MainWindow(uri=uri) + window = MainWindow(ip=text) else: raise e diff --git a/charon_vna/vna.py b/charon_vna/vna.py index 8cf49c8..8ecf4a9 100644 --- a/charon_vna/vna.py +++ b/charon_vna/vna.py @@ -36,9 +36,11 @@ def generate_tone(f: float, fs: float, N: int = 1024, scale: int = 2**14): class Charon: FREQUENCY_OFFSET = 1e6 + calibration: rf.calibration.Calibration | None = None + def __init__( self, - uri: str = "ip:192.168.2.1", + ip: str = "192.168.2.1", frequency: npt.ArrayLike = np.linspace(1e9, 2e9, 3), ports: Tuple[int] = (1,), ): @@ -46,7 +48,7 @@ class Charon: self.frequency = frequency # everything RF - self.sdr = adi.ad9361(uri=uri) + self.sdr = adi.ad9361(uri=f"ip:{ip}") for attr, expected in [ ("adi,2rx-2tx-mode-enable", True), # ("adi,gpo-manual-mode-enable", True),