Beta models DSP 206 and FIR DSP 408 (without the FIR filters), read-only until allowed
Never tested on real hardware, so they are only selectable by hand and send no changes until the user has compared the shown values with the DSP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0a1f282c63
commit
86ee492ec3
11 files changed
+121
-21
No files matched your search
+17
-3
@@ -22,12 +22,14 @@ class Device:
|
||||
def __init__(self, dev_id: str, name: str, host: str, port: int = P.PORT, model: str = "auto",
|
||||
addr: int = 1, autoconnect: bool = True, on_event=None, transport: str = "tcp", usb: str = "",
|
||||
lock_code: str = "", auto_unlock: bool = False, test_saved: list | None = None,
|
||||
colors: dict | None = None, maxgain: dict | None = None, linknames: dict | None = None):
|
||||
colors: dict | None = None, maxgain: dict | None = None, linknames: dict | None = None,
|
||||
beta_write: bool = False):
|
||||
self.id = dev_id
|
||||
self.name = name
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.model_key = model # "auto", "204" or "408"
|
||||
self.model_key = model # "auto" or a key of P.MODELS
|
||||
self.beta_write = beta_write # beta models: the user has checked the shown values and allowed changes
|
||||
self.addr = addr
|
||||
self.autoconnect = autoconnect
|
||||
self.transport = "usb" if transport == "usb" else "tcp"
|
||||
@@ -75,7 +77,8 @@ class Device:
|
||||
"model": self.model_key, "addr": self.addr, "autoconnect": self.autoconnect,
|
||||
"transport": self.transport, "usb": self.usb,
|
||||
"lock_code": self.lock_code, "auto_unlock": self.auto_unlock, "test_saved": self.test_saved,
|
||||
"colors": self.colors, "maxgain": self.maxgain, "linknames": self.linknames}
|
||||
"colors": self.colors, "maxgain": self.maxgain, "linknames": self.linknames,
|
||||
"beta_write": self.beta_write}
|
||||
|
||||
def snapshot(self) -> dict:
|
||||
cfg = self.config()
|
||||
@@ -85,6 +88,7 @@ class Device:
|
||||
"detected_model": self.model_name or None,
|
||||
"n_in": self.model.n_in if self.model else 0,
|
||||
"n_out": self.model.n_out if self.model else 0,
|
||||
"beta": bool(self.model and self.model.beta), "read_only": self.read_only,
|
||||
"presets": self.presets, "state": self.state}
|
||||
|
||||
def start(self):
|
||||
@@ -104,10 +108,17 @@ class Device:
|
||||
await self._close()
|
||||
self._set_status("disconnected")
|
||||
|
||||
@property
|
||||
def read_only(self) -> bool:
|
||||
"""A beta model only reads until the user has compared the shown values with the DSP."""
|
||||
return bool(self.model and self.model.beta and not self.beta_write)
|
||||
|
||||
def set_param(self, kind: str, idx: int, param: str, value):
|
||||
"""Update local state and queue the command (coalesced per parameter)."""
|
||||
if not self.state or not self.model:
|
||||
raise RuntimeError("device not loaded")
|
||||
if self.read_only:
|
||||
raise RuntimeError("Beta model: changes are off")
|
||||
chans = self.state["inputs" if kind == "in" else "outputs"]
|
||||
ch = chans[idx]
|
||||
if param == "name":
|
||||
@@ -332,6 +343,9 @@ class Device:
|
||||
"""Send one command and wait for its answer (the DSP is strictly request/response)."""
|
||||
if not self._writer:
|
||||
raise ConnectionError("not connected")
|
||||
if self.read_only and cmd not in P.READ_COMMANDS:
|
||||
log.warning("%s: read-only, command 0x%02x not sent", self.name, cmd)
|
||||
return None
|
||||
async with self._lock:
|
||||
deadline = time.monotonic() + timeout
|
||||
self._writer.write(P.build_frame(cmd, payload, self.addr))
|
||||
|
||||
+13
-3
@@ -209,6 +209,7 @@ class Model:
|
||||
name: str
|
||||
n_in: int
|
||||
n_out: int
|
||||
beta: bool = False # layout assumed from the other models, never seen on a real device; only selectable by hand
|
||||
|
||||
@property
|
||||
def in_size(self) -> int:
|
||||
@@ -247,12 +248,21 @@ class Model:
|
||||
return idx if kind == "in" else 4 + idx
|
||||
|
||||
|
||||
MODELS = {"204": Model("DSP 204", 2, 4), "408": Model("DSP 408", 4, 8)}
|
||||
MODELS = {"204": Model("DSP 204", 2, 4), "408": Model("DSP 408", 4, 8),
|
||||
"206": Model("DSP 206", 2, 6, beta=True), "408fir": Model("FIR DSP 408", 4, 8, beta=True)}
|
||||
|
||||
# what a DSP may be sent while its model is read-only (see Device.read_only): connecting and looking
|
||||
READ_COMMANDS = frozenset((CMD_HANDSHAKE, CMD_LOGOUT, CMD_STATUS, CMD_DEVICE_INFO, CMD_INIT_14, CMD_INIT_22,
|
||||
CMD_CONFIG_REQUEST, CMD_PRESET_NAME, CMD_PRESET_COUNT, CMD_UNLOCK, CMD_METER))
|
||||
|
||||
|
||||
def detect_model(info: str) -> str | None:
|
||||
for key in MODELS:
|
||||
if f"DSP{key}" in info.replace(" ", ""):
|
||||
"""Beta models are never detected, and a FIR device must not pass as a plain DSP 408."""
|
||||
info = info.replace(" ", "").upper()
|
||||
if "FIR" in info:
|
||||
return None
|
||||
for key, model in MODELS.items():
|
||||
if not model.beta and f"DSP{key}" in info:
|
||||
return key
|
||||
return None
|
||||
|
||||
|
||||
Reference in new issue
Block a user