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
+13
-25
@@ -139,6 +139,7 @@ const chTitle = (d, kind, i) => { const n = chans(d, kind)[i].name; return n ? `
|
||||
// group holds all members' bits, the others 0. The DSP mirrors changes within a group itself.
|
||||
const MODEL_LABEL = { "204": "DSP 204", "408": "DSP 408", "206": "DSP 206", "408fir": "FIR DSP 408" };
|
||||
const MODEL_CH = { "204": [2, 4], "408": [4, 8], "206": [2, 6], "408fir": [4, 8] }; // inputs, outputs (before a DSP has connected)
|
||||
const BETA_MODELS = ["206", "408fir"];
|
||||
const LINK_COLORS = ["#f59e0b", "#22d3ee", "#a3e635", "#f472b6"];
|
||||
function linkGroups(list) {
|
||||
const seen = new Set(), groups = [];
|
||||
@@ -595,7 +596,7 @@ function renderTabs() {
|
||||
const badge = d => {
|
||||
const model = d.detected_model || (d.model !== "auto" ? d.model : "");
|
||||
return testOn(d) ? h("small", { class: "test-badge" }, "TEST") : d.demo ? h("small", { class: "demo-badge" }, "DEMO")
|
||||
: model ? h("small", {}, (MODEL_LABEL[model] || model).replace("DSP ", "") + (d.beta ? " β" : "")) : null;
|
||||
: model ? h("small", {}, (MODEL_LABEL[model] || model).replace("DSP ", "")) : null;
|
||||
};
|
||||
const cur = S.devices[S.cur];
|
||||
if (!cur) {
|
||||
@@ -799,8 +800,8 @@ async function presetFileDialog(d) {
|
||||
"active state – stored presets (U01 …) stay unchanged.", { name: q(d.state.preset_name || "—") })),
|
||||
last ? h("p", { class: "dlg-text" }, t("A backup is made automatically before every import. Last backup: {last}.", { last })) : null),
|
||||
actions: [{ label: t("Close") },
|
||||
...(last && !viewOnly() ? [{ label: t("Undo import"), value: () => "undo" }] : []),
|
||||
...(viewOnly() ? [] : [{ label: t("Import…"), value: () => "import" }]),
|
||||
...(last && !S.locked ? [{ label: t("Undo import"), value: () => "undo" }] : []),
|
||||
...(S.locked ? [] : [{ label: t("Import…"), value: () => "import" }]),
|
||||
{ label: t("Export"), primary: true, value: () => "export" }],
|
||||
});
|
||||
try {
|
||||
@@ -1955,6 +1956,10 @@ function deviceForm(d) {
|
||||
addr: h("input", { type: "number", min: 1, max: 250, value: d.addr || 1, class: "short" }),
|
||||
usb: h("select", { "aria-label": t("USB device") }),
|
||||
};
|
||||
const betaNote = h("p", { class: "info betanote full", hidden: true },
|
||||
t("Beta: this model has not been tested on a real device yet. Keep the amplifiers off for the first test."));
|
||||
const showBeta = () => { betaNote.hidden = !isNew || !f.model.value || !BETA_MODELS.includes(f.model.value); };
|
||||
f.model.addEventListener("change", showBeta);
|
||||
let transport = d.transport || "tcp";
|
||||
// USB device list (both DSP models share one USB ID, so several are told apart by port/path)
|
||||
const fillUsb = list => {
|
||||
@@ -2017,6 +2022,7 @@ function deviceForm(d) {
|
||||
...netRows, usbRow,
|
||||
h("label", {}, t("Model"), f.model),
|
||||
h("label", { class: "chk" }, f.autoconnect, t("Connect automatically")),
|
||||
betaNote,
|
||||
h("details", { class: "more full" }, h("summary", {}, t("Advanced")),
|
||||
h("label", { class: "inline idrow" }, t("Device ID"), f.addr),
|
||||
h("p", { class: "info" }, t("Only needed if the ID was changed on the DSP (e.g. several DSPs on one RS-485 cable). Default 1."))),
|
||||
@@ -2236,21 +2242,6 @@ function viewSettings() {
|
||||
// ------------------------------------------------------------------ render
|
||||
|
||||
const H_SCROLL = ".mixer, .bands, .geq, .routing";
|
||||
// beta models (never seen on a real device): read-only until the shown values were compared with the DSP
|
||||
function betaBanner(d) {
|
||||
const model = MODEL_LABEL[d.detected_model] || d.detected_model;
|
||||
const set = async enabled => {
|
||||
if (enabled && !await askConfirm(t("Allow changes"), t("Only continue if the values shown here match the DSP (names, gains, filters, routing). If they don't, a change can send wrong values – keep the amplifiers off while testing."), t("Allow changes"), true)) return;
|
||||
try { await api("POST", `/api/devices/${d.id}/betawrite`, { enabled }); }
|
||||
catch (e) { toast(t("Error: ") + trMsg(e.message)); }
|
||||
};
|
||||
return h("div", { class: "betabar" + (d.read_only ? " ro" : "") },
|
||||
h("div", { class: "grow" }, h("b", {}, t("{model} – Beta", { model })), " ",
|
||||
d.read_only ? t("Not tested on a real device yet, so changes are off. Compare the shown values with the DSP. If they don't match, send the file from File… → Export to the developer.")
|
||||
: t("Not tested on a real device yet. Changes are on – keep the amplifiers off while testing.")),
|
||||
h("button", { class: "small" + (d.read_only ? " on" : ""), "data-view-ok": "", onclick: () => set(d.read_only) }, d.read_only ? t("Allow changes") : t("Turn changes off")));
|
||||
}
|
||||
|
||||
function render() {
|
||||
if (S.busy) { S.dirty = true; return; }
|
||||
if ($("#app").hidden) return;
|
||||
@@ -2271,7 +2262,6 @@ function render() {
|
||||
const d = dev();
|
||||
const field = !S.settings && S.view === "soundfield"; // the room plan works without a connected DSP
|
||||
document.body.dataset.view = field ? "soundfield" : S.settings || !d ? "settings" : S.view;
|
||||
document.body.classList.toggle("locked", viewOnly());
|
||||
if (field) content = viewSoundField();
|
||||
else if (S.settings || !d) content = viewSettings();
|
||||
else if (d.status !== "online" || !d.state)
|
||||
@@ -2282,7 +2272,7 @@ function render() {
|
||||
h("button", { class: "on", onclick: () => unlockDialog(d) }, t("Enter code")))
|
||||
: S.demo.enabled && !d.demo ? t("Disconnected while demo mode is on") : t("Not connected."));
|
||||
else content = ({ mixer: viewMixer, channel: viewChannel, routing: viewRouting, link: viewLink, limiter: viewLimiter, test: viewTest }[S.view] || viewMixer)(d);
|
||||
main.replaceChildren(...[!field && !S.settings && d && d.beta ? betaBanner(d) : null, content].flat().filter(Boolean));
|
||||
main.replaceChildren(...[content].flat().filter(Boolean));
|
||||
main.querySelectorAll(H_SCROLL).forEach((e, i) => { if (xs[i]) e.scrollLeft = xs[i]; });
|
||||
window.scrollTo(0, y);
|
||||
collectMeters();
|
||||
@@ -2322,12 +2312,10 @@ new ResizeObserver(() => document.documentElement.style.setProperty("--sb", $("#
|
||||
|
||||
// ------------------------------------------------------------------ lock (desktop app window: look, don't touch)
|
||||
|
||||
const viewOnly = () => !!S.locked || (!S.settings && S.view !== "soundfield" && !!(dev() && dev().read_only));
|
||||
|
||||
function showLock() {
|
||||
const b = $("#btn-lock");
|
||||
b.hidden = !S.isApp;
|
||||
document.body.classList.toggle("locked", viewOnly());
|
||||
document.body.classList.toggle("locked", !!S.locked);
|
||||
b.classList.toggle("on", !!S.locked);
|
||||
b.title = S.locked ? t("Locked – click to unlock") : t("Lock (view only)");
|
||||
b.setAttribute("aria-label", b.title);
|
||||
@@ -2359,14 +2347,14 @@ $("#btn-lock").addEventListener("click", async () => {
|
||||
const VIEW_OK = ".chsel, .nav, .strip-head, .xout, .band, #btn-muteall, [data-view-ok]";
|
||||
for (const type of ["pointerdown", "mousedown", "click", "dblclick", "keydown", "wheel"]) {
|
||||
document.addEventListener(type, e => {
|
||||
if (!viewOnly() || !(e.target instanceof Element)) return;
|
||||
if (!S.locked || !(e.target instanceof Element)) return;
|
||||
const tgt = e.target;
|
||||
if (!tgt.closest("#main, #statusbar") || tgt.closest(VIEW_OK)) return;
|
||||
if (type === "wheel" && !tgt.closest(".fader, input, select")) return; // page scrolling stays
|
||||
if (type === "keydown" && !tgt.closest("button, input, select, textarea, .fader, [tabindex]")) return;
|
||||
if (type === "pointerdown" && !tgt.closest("button, input, select, textarea, .fader, canvas, a")) return;
|
||||
e.preventDefault(); e.stopPropagation();
|
||||
if (type === "click" && Date.now() - (S.lockToast || 0) > 1500) { S.lockToast = Date.now(); toast(S.locked ? t("Locked – unlock at the top right to make changes") : t("Beta model: changes are off")); }
|
||||
if (type === "click" && Date.now() - (S.lockToast || 0) > 1500) { S.lockToast = Date.now(); toast(t("Locked – unlock at the top right to make changes")); }
|
||||
}, { capture: true, passive: false });
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user