Beta models: full function once added, only a note in the add-device form

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-02 16:50:50 +01:00
1 parent 86ee492ec3
commit f7d5e22bb0
9 files changed
+28 -86

No files matched your search

+2 -16
View File
@@ -22,14 +22,12 @@ 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,
beta_write: bool = False):
colors: dict | None = None, maxgain: dict | None = None, linknames: dict | None = None):
self.id = dev_id
self.name = name
self.host = host
self.port = port
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"
@@ -77,8 +75,7 @@ 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,
"beta_write": self.beta_write}
"colors": self.colors, "maxgain": self.maxgain, "linknames": self.linknames}
def snapshot(self) -> dict:
cfg = self.config()
@@ -88,7 +85,6 @@ 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):
@@ -108,17 +104,10 @@ 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":
@@ -343,9 +332,6 @@ 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))
-4
View File
@@ -251,10 +251,6 @@ class Model:
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:
"""Beta models are never detected, and a FIR device must not pass as a plain DSP 408."""