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))
|
||||
|
||||
Reference in new issue
Block a user