Add experimental SMK-37 USB installer to Studio Other Devices

This commit is contained in:
JUAN JIANT committed 2026-11-26 18:45:12 -03:00
1 parent a88eed5623
commit 966fa06217
7 files changed
+109 -11

No files matched your search

+3
View File
@@ -255,6 +255,9 @@ jobs:
# page (web/studio; it shows JIANT BYTE's tools from /JIANT-BYTE/, the same origin)
mkdir -p build/pages/studio
cp web/studio/index.html web/studio/studio.js web/studio/studio-lib.js web/studio/daw.js web/studio/recorder-worklet.js web/studio/learn.js web/studio/wavetable.js web/studio/radio-vis.js web/studio/analysis.js web/studio/convert.js web/studio/learn-fm.json web/studio/learn-byte.json web/studio/live-fm.json web/studio/live-byte.json web/fm1backup.js build/pages/studio/
cp -r web/studio/smk37 build/pages/studio/smk37
cp web/fm1pkg.js web/fm1ota.js build/pages/studio/smk37/
cp -r LICENSE LICENSES LICENSING.md build/pages/studio/smk37/
cp -r web/studio/img build/pages/studio/img
# (studio) FM-1 Rescue's builder and base firmware for Studio's Rescue tab; its own page at rescue/
mkdir -p build/pages/studio/rescue/base build/pages/rescue
+8 -8
View File
@@ -26,7 +26,7 @@ export const UPDATE_TIMES = {
};
/* the ports worth asking for an identity: the FM-1 (official: its own name or the USB composite's), JIANT, Felucca and
* its forks, the update loaders. Other gear is not probed, except a port that appears while we wait for the loader */
export const PORT_RE = /fm-?1|felucca|jiant|skiff|ota|composite|sinco|usb-midi|m-?vave|cuvave/i;
export const PORT_RE = /smk[ -]?37|fm-?1|felucca|jiant|skiff|ota|composite|sinco|usb-midi|m-?vave|cuvave/i;
/* Windows names one device's ports "FM-1", "2- FM-1", "MIDIIN2 (FM-1)" / "MIDIOUT2 (FM-1)", "FM-1 1": the device's name */
export const portBase = (name) => String(name || "").trim().replace(/^\d+\s*-\s*/, "")
.replace(/^MIDI(?:IN|OUT)\d*\s*\((.*)\)$/i, "$1").replace(/\s+\d+$/, "").trim().toLowerCase();
@@ -235,7 +235,7 @@ export class Updater {
last = Date.now();
if (r.addr === 0xE0000000 || r.addr === 0xF0000000) {
link.send(response(r.addr, [...new TextEncoder().encode("success"), 0]));
if (r.addr === finishAddr) return { served, finished: true };
if (r.addr === finishAddr) return { served, finished: served > 0 };
continue;
}
if (r.len > MAXDATA || r.addr + r.len > image.length) throw fail("badreq", `bad request ${r.addr.toString(16)}+${r.len}`);
@@ -249,9 +249,9 @@ export class Updater {
}
// full install: running firmware -> loader -> new firmware
async install(image, product, onStep) {
async install(image, product, onStep, requiredIdentity = null) {
const step = onStep || (() => {});
const dev = await this.find((id) => !IS_OTA(id), { tries: this.t.findTries });
const dev = await this.find((id) => requiredIdentity ? id.text === requiredIdentity : !IS_OTA(id), { tries: this.t.findTries });
if (!dev) throw this.notFound();
const [model] = product.split("_");
if (dev.id.model !== model) { dev.link.close(); throw fail("model", `the device is ${dev.id.text}, the package is for ${product}`, dev.id.text); }
@@ -272,13 +272,13 @@ export class Updater {
if (!s1.finished) throw fail(s1.lost ? "lost" : "stopped", `the device ${s1.lost ? "was disconnected" : "stopped"} after ${s1.served} requests: nothing was written`);
step("loader");
await sleep(this.t.loaderSettle);
const ota = await this.waitFor((id) => id.model === "ota-" + model, this.t.loader);
const ota = await this.waitFor((id) => requiredIdentity ? id.text === "ota-" + product : id.model === "ota-" + model, this.t.loader);
if (!ota) throw fail("noloader", "the update loader did not appear. Replug the USB cable and press Install again: the device stays in update mode until it is finished.");
const s2 = await this.write(ota, image, step);
if (!s2.finished) throw fail(s2.lost ? "lost" : "stopped", `the loader ${s2.lost ? "was disconnected" : "stopped"} after ${s2.served} requests. Replug and press Install again to resume.`);
step("reboot");
await sleep(this.t.loaderSettle);
const back = await this.waitFor((id) => !IS_OTA(id), this.t.back);
const back = await this.waitFor((id) => requiredIdentity ? id.model === model : !IS_OTA(id), this.t.back);
if (!back) throw fail("noreturn", "the device did not come back: power-cycle it");
back.link.close();
if (back.id.text !== product) throw fail("mismatch", `installed, but the device reports ${back.id.text}`, back.id.text);
@@ -298,9 +298,9 @@ export class Updater {
}
// resume: the device is already in update mode (loader) -> true when the write finished
async resume(image, onStep, product = null) {
async resume(image, onStep, product = null, loaderIdentity = null) {
const model = product && product.split("_")[0];
const ota = await this.find((id) => model ? id.model === "ota-" + model : IS_OTA(id), { tries: 2 });
const ota = await this.find((id) => loaderIdentity ? id.text === loaderIdentity : model ? id.model === "ota-" + model : IS_OTA(id), { tries: 2 });
if (!ota) return false;
const step = onStep || (() => {});
const result = await this.write(ota, image, step);
+2
View File
@@ -45,6 +45,8 @@ def local(path):
if rest.startswith("webapp/editor/"):
f = repo / "web" / rest[len("webapp/editor/"):]
return f.read_bytes() if f.is_file() else None
if site == "/JIANT/" and rest in ("studio/smk37/fm1pkg.js", "studio/smk37/fm1ota.js"):
return (FM / "web" / Path(rest).name).read_bytes()
if site == "/JIANT/" and rest == "studio/fm1backup.js": # (the installer's and the editor's, beside Studio)
return (FM / "web" / "fm1backup.js").read_bytes()
if site == "/JIANT/" and rest.startswith("studio/rescue/"): # (FM-1 Rescue's builder and base firmware)
Binary file not shown.
Binary file not shown.
+93
View File
@@ -0,0 +1,93 @@
<!doctype html><html lang="es"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>JIANT · Instalador SMK-37</title>
<style>
:root{color-scheme:dark;font:17px/1.55 system-ui;background:#131215;color:#f6f2ec}
body{max-width:700px;margin:5vh auto;padding:24px}h1{line-height:1.1;font-size:clamp(2rem,7vw,3.5rem);margin:.15em 0 .4em}
a{color:#ffc084}small{color:#ffc084}section{border-top:1px solid #686168;margin-top:24px;padding-top:18px}
button{font:inherit;font-weight:650;padding:10px 18px;margin:8px 8px 8px 0;border:0;border-radius:5px;background:#ffc084;color:#171012}
button:disabled{background:#38343a;color:#aaa}label{display:block;margin:15px 0}pre{white-space:pre-wrap;overflow-wrap:anywhere;font:14px/1.5 monospace}
</style><body><small>JIANT FM · Prueba de hardware</small><h1>Instalador SMK-37</h1>
<p>Para M-VAVE SMK-37 Pro y Elite con firmware de fábrica v016. Conectá únicamente el teclado a probar por USB de datos y cerrá el editor, el DAW y el actualizador de M-VAVE.</p>
<p>Esta primera prueba reemplaza el firmware. Tené a mano el firmware oficial de tu modelo y una copia de tus datos. El arranque y la recuperación en un teclado real siguen pendientes de validación. Los proyectos y ajustes de esta versión de JIANT se pierden al apagar.</p>
<section><button id="detect">Detectar teclado</button><output id="device" aria-live="polite"></output>
<label><input type="checkbox" id="accept" disabled> Quiero escribir JIANT experimental en el teclado detectado.</label>
<button id="install" disabled>Instalar JIANT</button><p id="status" role="status">La detección solo consulta la identidad MIDI.</p>
<p id="stock" hidden><a href="https://www.m-vave.com/download" target="_blank" rel="noopener">Descargas oficiales de M-VAVE</a> · Elegí M-UPGRADE y el firmware SMK-37 PRO V016.</p>
<details><summary>Registro de la sesión</summary><pre id="log"></pre></details></section><small><a href="https://github.com/juanjiant-bit/JIANT/tree/6df3c9a6701fc9327472d5fb22bfc3d1a4359656">Código y licencias del firmware</a></small>
<script type="module">
import {Updater} from './fm1ota.js';
import {productOf, logicalImage, sha256hex} from './fm1pkg.js';
const images = {
"SMK-37 Pro": {file:"felucca-smk37-pro.fwsc", sha:"c940476c2b33a5ffb35a6edab2813f8c0c2a6be9b4bbeb5f5a346e91299514b0"},
"SMK-37 Elite": {file:"felucca-smk37-elite.fwsc", sha:"579c5664c6273f15d69aa64243817f0261ecaf5078923fefdb54db8a554076f3"}
};
const get = id => document.getElementById(id);
const detect = get('detect'), accept = get('accept'), install = get('install');
let selection, busy = false;
const log = s => { get('log').textContent += s + '\n'; };
const status = s => { get('status').textContent = s; log(s); };
const midi = () => navigator.requestMIDIAccess({sysex:true});
function classify(text) {
const match = /^(ota-)?(SMK-37 (?:Elite|Pro))_(\d+)$/.exec(text);
if (!match) return null;
const [, loader, model, version] = match;
if (loader ? version !== '900' : version !== '016') return null;
return {model, loader: Boolean(loader), id:text};
}
async function imageFor(model) {
const p = images[model];
const response = await fetch(p.file);
if (!response.ok) throw Error('No se pudo descargar el firmware de ' + model);
const bytes = new Uint8Array(await response.arrayBuffer());
if (await sha256hex(bytes) !== p.sha || productOf(bytes) !== model + '_900')
throw Error('El paquete integrado no pasó la verificación.');
return logicalImage(bytes);
}
async function run(task) {
if (busy) return;
busy = true; detect.disabled = accept.disabled = install.disabled = true;
try { await task(); } catch (e) { selection = null; status('Se detuvo el proceso. ' + e.message); }
finally { busy = false; detect.disabled = false; accept.disabled = !selection; install.disabled = !selection || !accept.checked; }
}
function updater(access) { return new Updater(access, log, {refresh:midi}); }
detect.onclick = () => run(async () => {
selection = null; accept.checked = false; get('device').textContent = ''; get('stock').hidden = true;
if (!navigator.requestMIDIAccess) throw Error('Abrí el HTML en Chrome o Edge de escritorio con Web MIDI.');
status('Consultando el teclado…');
const up = updater(await midi());
const dev = await up.find(null, {tries:2});
if (!dev) throw Error('Sin respuesta de identidad. Revisá el cable USB, el permiso MIDI y las otras aplicaciones.');
dev.link.close();
get('device').textContent = dev.id.text;
if (dev.id.text === 'SMK-37 Pro_015') {
get('stock').hidden = false;
status('Tu Pro tiene V015. Actualizá primero a V016 con M-UPGRADE y volvé a detectar el teclado.');
return;
}
const target = classify(dev.id.text);
if (!target) throw Error('Identidad fuera de esta prueba: ' + dev.id.text);
await imageFor(target.model);
selection = target;
install.textContent = target.loader ? 'Reanudar escritura' : 'Instalar JIANT';
status('Paquete verificado para ' + target.model + '.');
});
accept.onchange = () => { install.disabled = busy || !selection || !accept.checked; };
install.onclick = () => run(async () => {
const target = selection;
if (!target || !accept.checked) return;
const image = await imageFor(target.model), product = target.model + '_900';
const up = updater(await midi());
const step = (s, value) => {
if (s === 'write' || s === 'verify') {
get('status').textContent = (s === 'write' ? 'Escribiendo' : 'Comprobando') + ' · petición ' + value;
} else status(({start:'Iniciando actualización',loader:'Esperando el cargador de ' + target.model,
reboot:'Esperando el reinicio',done:'Identidad confirmada tras el reinicio'})[s] + (value ? ' · ' + value : ''));
};
selection = null; accept.checked = false;
if (target.loader) {
if (!await up.resume(image, step, product, target.id)) throw Error('El cargador no completó la transferencia.');
} else await up.install(image, product, step, target.id);
status('Instalación verificada por USB. Probá pantalla, audio, teclas y pads.');
});
window.addEventListener('beforeunload', e => { if (busy) { e.preventDefault(); e.returnValue = ''; } });
</script></body></html>
+3 -3
View File
@@ -204,7 +204,7 @@ const TEXT = {
shotDaw: "el editor del plugin: pantalla en vivo y pistas", shotDawSound: "el editor del plugin: el sonido",
shotDawSamples: "el editor del plugin: el explorador de samples", portsManuals: "Manuales",
portsHow: "Cómo funcionan", portTry: "Probar en el navegador", portDownload: "Descargar", portManual: "Manual", portInstall: "Cómo instalar",
portSource: "Código", portBuild: "Compilar", portSoon: "Instalador: próximamente",
portSource: "Código", portBuild: "Compilar", smkInstaller: "Instalador experimental (USB)",
stOk: "funciona", stSoon: "próximamente", portSoonBuy: "Próximamente a la venta", stPreview: "preview: buscamos testers", stDev: "en desarrollo", stCi: "compilado en CI",
pSmkTitle: "M-VAVE SMK-37 Pro / Elite", pSmkText: "JIANT directo en el chip del SMK-37 (el mismo AC791N que la FM-1): 37 teclas, 16 pads RGB, 8 encoders y 4 faders como panel. Usa el mismo editor web.",
pSmk1: "Pads con color por pista", pSmk2: "El mismo editor y los mismos sonidos que la FM-1",
@@ -397,7 +397,7 @@ const TEXT = {
shotDaw: "the plugin's editor: the live screen and tracks", shotDawSound: "the plugin's editor: the sound",
shotDawSamples: "the plugin's editor: the sample browser", portsManuals: "Manuals",
portsHow: "How they work", portTry: "Try it in the browser", portDownload: "Download", portManual: "Manual", portInstall: "How to install",
portSource: "Source", portBuild: "Build", portSoon: "Installer: coming",
portSource: "Source", portBuild: "Build", smkInstaller: "Experimental USB installer",
stOk: "works", stSoon: "coming soon", portSoonBuy: "Coming soon, for sale", stPreview: "preview: testers wanted", stDev: "in development", stCi: "built by CI",
pSmkTitle: "M-VAVE SMK-37 Pro / Elite", pSmkText: "JIANT bare metal on the SMK-37's chip (the FM-1's AC791N): 37 keys, 16 RGB pads, 8 encoders and 4 faders as its panel. The same web editor.",
pSmk1: "Pads lit in each track's colour", pSmk2: "The FM-1's editor and sounds",
@@ -1128,7 +1128,7 @@ const PORTS = [
// shots: the port running (its emulator's panel in the browser, the plugin's editor), the first one on the card
{ id: "smk37", name: "pSmkTitle", text: "pSmkText", points: ["pSmk1", "pSmk2"], state: ["stDev", "soon"], pic: OUTLINE.smk,
shots: [["img/smk37.webp", "shotSmk"]],
links: [["portTry", "#try:smk37"], ["portManual", MAN + "smk37.html"], ["portBuild", GH + "docs/SMK37.md"], ["portSoon", null]] },
links: [["portTry", "#try:smk37"], ["portManual", MAN + "smk37.html"], ["portBuild", GH + "docs/SMK37.md"], ["smkInstaller", "smk37/index.html"]] },
{ id: "mpc", name: "pMpcTitle", text: "pMpcText", points: ["pMpc1", "pMpc2"], state: ["stPreview", "soon"], pic: OUTLINE.mpc,
shots: [["img/mpc.webp", "shotMpc"]], whole: true, // (the unit stands upright: all of it shown)
links: [["portTry", "#try:mpc"], ["portManual", MAN + "mpc-sample.html"], ["portDownload", RELEASES], ["portInstall", MAN + "mpc-sample.html#release"]] },