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:
1 parent
86ee492ec3
commit
f7d5e22bb0
9 files changed
+28
-86
No files matched your search
@@ -154,11 +154,6 @@ def clean_colors(v) -> dict:
|
||||
return out
|
||||
|
||||
|
||||
# what a beta model allows before changes are switched on: nothing here writes to the DSP
|
||||
BETA_READ_ACTIONS = ("connect", "disconnect", "refresh", "export", "backups", "unlock", "colors", "maxgain",
|
||||
"linknames", "betawrite")
|
||||
|
||||
|
||||
def clean_linknames(v) -> dict:
|
||||
"""Names of link groups, keyed by kind and members: {"out:0,1": "Tops"}. A changed group loses its name."""
|
||||
out = {}
|
||||
@@ -342,8 +337,7 @@ class App:
|
||||
transport="usb" if usb else "tcp", usb=str(d.get("usb") or ""),
|
||||
lock_code=str(d.get("lock_code") or ""), auto_unlock=bool(d.get("auto_unlock")),
|
||||
test_saved=clean_gains(d.get("test_saved")), colors=clean_colors(d.get("colors")),
|
||||
maxgain=clean_maxgain(d.get("maxgain")), linknames=clean_linknames(d.get("linknames")),
|
||||
beta_write=bool(d.get("beta_write")))
|
||||
maxgain=clean_maxgain(d.get("maxgain")), linknames=clean_linknames(d.get("linknames")))
|
||||
dev.on_online = self.device_online
|
||||
self.devices[dev_id] = dev
|
||||
if dev.autoconnect:
|
||||
@@ -391,8 +385,6 @@ class App:
|
||||
return {"ok": True}
|
||||
|
||||
async def device_online(self, dev: Device):
|
||||
if dev.read_only:
|
||||
return
|
||||
await self.check_audio_test(dev)
|
||||
if not self.mute_all["active"] and self.mute_all["restore"].get(dev.id):
|
||||
self.unmute_device(dev) # released while this DSP was offline
|
||||
@@ -411,7 +403,7 @@ class App:
|
||||
|
||||
def set_mute_all(self, mute: bool) -> dict:
|
||||
"""Mute every channel of every connected DSP; releasing unmutes only what was open before."""
|
||||
online = [d for d in self.devices.values() if d.status == "online" and d.state and not d.read_only]
|
||||
online = [d for d in self.devices.values() if d.status == "online" and d.state]
|
||||
if mute and not self.mute_all["active"]:
|
||||
self.mute_all["restore"] = {}
|
||||
for dev in online:
|
||||
@@ -443,7 +435,7 @@ class App:
|
||||
changed = 0
|
||||
for t in body.get("targets") or []:
|
||||
dev = self.devices.get(str(t.get("device")))
|
||||
if not dev or dev.status != "online" or not dev.state or dev.read_only:
|
||||
if not dev or dev.status != "online" or not dev.state:
|
||||
continue
|
||||
if dev.test_active:
|
||||
raise RuntimeError("Audio test is on – switch it off first")
|
||||
@@ -802,8 +794,6 @@ class App:
|
||||
if dev.test_active and (action in ("preset/recall", "preset/store", "export", "import", "undo", "link")
|
||||
or action == "set" and body.get("param") != "mute"):
|
||||
raise RuntimeError("Audio test is on – switch it off first")
|
||||
if dev.read_only and method == "POST" and action not in BETA_READ_ACTIONS:
|
||||
raise RuntimeError("Beta model: changes are off")
|
||||
if self.demo["enabled"] and not dev.demo and action == "connect":
|
||||
raise RuntimeError("Demo mode is on – switch it off to connect the real DSPs")
|
||||
if method == "DELETE" and not action:
|
||||
@@ -815,8 +805,6 @@ class App:
|
||||
if method == "PUT" and not action:
|
||||
was_running = dev._want_connected
|
||||
await dev.stop()
|
||||
if body.get("model", dev.model_key) != dev.model_key:
|
||||
dev.beta_write = False # another model: check the values again
|
||||
for k in ("name", "host", "model", "usb"):
|
||||
if k in body:
|
||||
setattr(dev, "model_key" if k == "model" else k, str(body[k]))
|
||||
@@ -884,11 +872,6 @@ class App:
|
||||
self.save()
|
||||
self.broadcast({"type": "device", "device": dev.id, "data": dev.snapshot()})
|
||||
return {"ok": True, "colors": dev.colors}
|
||||
if action == "betawrite": # beta model: the user compared the shown values with the DSP
|
||||
dev.beta_write = bool(body.get("enabled"))
|
||||
self.save()
|
||||
self.broadcast({"type": "device", "device": dev.id, "data": dev.snapshot()})
|
||||
return {"ok": True, "read_only": dev.read_only}
|
||||
if action == "linknames": # display only, like the colours
|
||||
dev.linknames = clean_linknames(body.get("linknames"))
|
||||
self.save()
|
||||
|
||||
Reference in new issue
Block a user