From 776c9cc49147734380cc7b65fb2d54af03d67f4c Mon Sep 17 00:00:00 2001 From: Brendan Haines Date: Sun, 13 Apr 2025 01:05:26 -0600 Subject: [PATCH] typing and defaults --- charon_vna/vna.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/charon_vna/vna.py b/charon_vna/vna.py index 97d6415..d7c453f 100644 --- a/charon_vna/vna.py +++ b/charon_vna/vna.py @@ -82,12 +82,13 @@ class AD9361DacStepFactor(IntEnum): class Charon: FREQUENCY_OFFSET = 1e6 + DEFAULT_IP = "192.168.2.1" calibration: rf.calibration.Calibration | None = None def __init__( self, - ip: str = "192.168.2.1", + ip: str = DEFAULT_IP, frequency: npt.ArrayLike = np.linspace(1e9, 2e9, 3), ports: Tuple[int] = (1,), ): @@ -202,7 +203,7 @@ class Charon: (value & 0x3) | (vref.value << 2) | (step_factor << 4), ) - def _get_dac_code(self, channel: int) -> Tuple[float, AD9361DacVref, AD9361DacStepFactor]: + def _get_dac_code(self, channel: Literal[1, 2]) -> Tuple[float, AD9361DacVref, AD9361DacStepFactor]: word = self.ctrl.reg_read(AD9361Register.__getitem__(f"AUXDAC{channel}_WORD")) config = self.ctrl.reg_read(AD9361Register.__getitem__(f"AUXDAC{channel}_CONFIG"))