chore: type of valid_datapoints (#764)

pull/765/head
Holger Müller 2025-01-21 14:03:33 +01:00 zatwierdzone przez GitHub
rodzic 30a3dc88c4
commit 504e64f33e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
10 zmienionych plików z 63 dodań i 15 usunięć

Wyświetl plik

@ -195,7 +195,9 @@ def detect_version(serial_port: serial.Serial) -> str:
if data.startswith("\r\n?\r\nch> "):
return "vh"
if data.startswith("2"):
return "lite_vna_64" if LiteVNA64.is_lite_vna_64(serial_port) else "v2"
return (
"lite_vna_64" if LiteVNA64.is_lite_vna_64(serial_port) else "v2"
)
logger.debug("Retry detection: %s", i + 1)
logger.error("No VNA detected. Hardware responded to CR with: %s", data)
return ""

Wyświetl plik

@ -31,7 +31,12 @@ class JNCRadio_VNA_3G(NanoVNA):
name = "JNCRadio_VNA_3G"
screenwidth = 800
screenheight = 480
valid_datapoints = [501, 11, 101, 1001]
valid_datapoints: tuple[int, ...] = (
501,
11,
101,
1001,
)
sweep_points_min = 11
sweep_points_max = 1001

Wyświetl plik

@ -85,7 +85,7 @@ class ScreenshotData:
class LiteVNA64(NanoVNA_V2):
name = "LiteVNA-64"
valid_datapoints = [
valid_datapoints: tuple[int, ...] = (
51,
101,
201,
@ -98,7 +98,7 @@ class LiteVNA64(NanoVNA_V2):
6401,
12801,
25601,
]
)
screenwidth = 480
screenheight = 320
sweep_points_max = 65535

Wyświetl plik

@ -31,7 +31,18 @@ class NanoVNA_F_V3(NanoVNA):
name = "NanoVNA-F_V3"
screenwidth = 800
screenheight = 480
valid_datapoints = (101, 11, 51, 201, 301, 401, 501, 601, 701, 801)
valid_datapoints: tuple[int, ...] = (
101,
11,
51,
201,
301,
401,
501,
601,
701,
801,
)
sweep_points_min = 11
sweep_points_max = 801

Wyświetl plik

@ -27,7 +27,13 @@ class NanoVNA_H4(NanoVNA_H):
name = "NanoVNA-H4"
screenwidth = 480
screenheight = 320
valid_datapoints = [101, 11, 51, 201, 401]
valid_datapoints: tuple[int, ...] = (
101,
11,
51,
201,
401,
)
def __init__(self, iface: Interface):
super().__init__(iface)
@ -42,4 +48,4 @@ class NanoVNA_H4(NanoVNA_H):
# if self.readFirmware().find("DiSlord") > 0:
# self.features.add("Customizable data points")
# logger.info("VNA has 201 datapoints capability")
# self.valid_datapoints = [201, 11, 51, 101]
# self.valid_datapoints: tuple[int, ...] = [201, 11, 51, 101]

Wyświetl plik

@ -69,7 +69,15 @@ _ADF4350_TXPOWER_DESC_REV_MAP = {
class NanoVNA_V2(VNA): # noqa: N801
name = "NanoVNA-V2"
valid_datapoints = [101, 11, 51, 201, 301, 501, 1023]
valid_datapoints: tuple[int, ...] = (
101,
11,
51,
201,
301,
501,
1023,
)
screenwidth = 320
screenheight = 240
@ -89,7 +97,15 @@ class NanoVNA_V2(VNA): # noqa: N801
raise IOError("Device is in DFU mode")
if "S21 hack" in self.features:
self.valid_datapoints = [101, 11, 51, 201, 301, 501, 1021]
self.valid_datapoints: tuple[int, ...] = [
101,
11,
51,
201,
301,
501,
1021,
]
self.sweepStartHz = 200e6
self.sweepStepHz = 1e6

Wyświetl plik

@ -31,7 +31,11 @@ class SV4401A(NanoVNA):
name = "SV4401A"
screenwidth = 1024
screenheight = 600
valid_datapoints = [501, 101, 1001]
valid_datapoints: tuple[int, ...] = (
501,
101,
1001,
)
sweep_points_min = 101
sweep_points_max = 1001

Wyświetl plik

@ -31,7 +31,11 @@ class SV6301A(NanoVNA):
name = "SV6301A"
screenwidth = 1024
screenheight = 600
valid_datapoints = [501, 101, 1001]
valid_datapoints: tuple[int, ...] = (
501,
101,
1001,
)
sweep_points_min = 101
sweep_points_max = 1001

Wyświetl plik

@ -34,7 +34,7 @@ class TinySA(VNA):
name = "tinySA"
screenwidth = 320
screenheight = 240
valid_datapoints = [290]
valid_datapoints: tuple[int, ...] = (290,)
def __init__(self, iface: Interface):
super().__init__(iface)
@ -132,7 +132,7 @@ class TinySA_Ultra(TinySA): # noqa: N801
name = "tinySA Ultra"
screenwidth = 480
screenheight = 320
valid_datapoints = [450, 51, 101, 145, 290]
valid_datapoints: tuple[int, ...] = [450, 51, 101, 145, 290]
hardware_revision = None
def __init__(self, iface: Interface):

Wyświetl plik

@ -53,12 +53,12 @@ def _max_retries(bandwidth: int, datapoints: int) -> int:
class VNA:
name = "VNA"
valid_datapoints: list[int] = [101, 51, 11]
valid_datapoints: tuple[int, ...] = (101, 51, 11)
wait = 0.05
SN = "NOT SUPPORTED"
sweep_points_max = 101
sweep_points_min = 11
# Must be initilized in child classes
sweep_max_freq_Hz = 0.0