From f33b9ec26ac20f99c7217fa63ca12e7c286c53e2 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 11:47:40 -0300 Subject: [PATCH] Editor protocol 3: INFO tag 0x56 and the old-firmware notice INFO carries tag 0x56 (version 1) with the editor protocol number (3), between NTRK and CHAIN_ROWS, so the offsets counted from the end of the reply are unchanged. The web editor refuses a device that answers with a lower number and shows a notice with the link to the current installer. Not yet pushed: the editor would refuse every 1.13 device until 1.14.0 is on the installer. Co-Authored-By: Claude Haiku 5.5 Claude-Session: https://claude.ai/code/session_01QUF6pQ1NkTwmBC8SR8AK94 --- firmware/src/editor.c | 2 ++ web/editor_fmini.html | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/firmware/src/editor.c b/firmware/src/editor.c index 8eb0222..2848720 100644 --- a/firmware/src/editor.c +++ b/firmware/src/editor.c @@ -11,6 +11,7 @@ #define ED_HDR0 0x7D #define ED_HDR1 0x46 #define ED_HDR2 0x4C +#define ED_PROTO 3u /* editor protocol version: 3 = FMini-1 1.14.0 (presets: 100 overwritable, no U bank) */ enum { ED_INFO = 1, ED_GET, ED_SET, ED_DUMP, ED_DESC, ED_STEP_GET, ED_STEP_SET, ED_PRESET, ED_PROJECT, ED_NAMES, ED_SMP_BEGIN, ED_SMP_WRITE, ED_SMP_END, ED_SMP_ERASE, ED_SMP_INFO, /* 10..14: the sample slots (1.13: gone; SMP_INFO * still answers: 0 slots, so the editor shows none) */ @@ -431,6 +432,7 @@ static void ed_handle(const uint8_t *f, uint32_t n) /* f: the bytes between F0 for (i = 0; i < NENGINES; i++) ed_str(ENGINES[i]->name, 8); ed_b(NTRK); /* v3 */ + ed_b(0x56); ed_b(1); ed_b(ED_PROTO); /* protocol v3 (FMini-1 1.14.0): the web editor needs >= 3 */ ed_b(CHAIN_ROWS); /* v6 */ ed_b(0x55); ed_b(1); ed_b(ed_ui_caps()); /* tagged preferences v1: commands 34..38 */ ed_b(0x4d); ed_b(1); ed_b(64); ed_b(1); /* motion + chance v1 (64: what it said before 1.2; 41 01 has the real count) */ diff --git a/web/editor_fmini.html b/web/editor_fmini.html index db77256..61a04f1 100644 --- a/web/editor_fmini.html +++ b/web/editor_fmini.html @@ -160,6 +160,8 @@ const TX = { none: "Nenhum FM-1 encontrado. Conecte o cabo USB, feche outros programas que usam a porta MIDI e toque em Conectar.", pick: "Escolha a porta MIDI do FM-1 na lista ao lado e toque em Conectar.", noedit: "Este firmware não parece ser o FMini-1. O editor é só para o FMini-1.", + oldfw: "Este FMini-1 tem um firmware antigo. Atualize pelo instalador atual e conecte de novo.", + getlink: "Abrir o instalador atual", noext: "Atualização disponível: instale o FMini-1 v1.6.1 ou mais novo para editar a oitava e guardar tempo, oitava e efeitos na biblioteca.", noenv: "Atualização necessária: este firmware não tem o editor de osciladores e chaves. Instale a versão mais nova pelo site para editar tudo.", nonames: "Atualização disponível: este firmware envia só os nomes dos %n primeiros presets. Instale o FMini-1 v1.7.2 ou mais novo para ver todos.", @@ -179,6 +181,8 @@ const TX = { none: "No FM-1 found. Plug in the USB cable, close other programs using the MIDI port and press Connect.", pick: "Pick the FM-1's MIDI port in the list and press Connect.", noedit: "This firmware does not look like the FMini-1. The editor is for the FMini-1 only.", + oldfw: "This FMini-1 runs an old firmware. Update it with the current installer and connect again.", + getlink: "Open the current installer", noext: "Update available: install FMini-1 v1.6.1 or newer to edit the octave and keep tempo, octave and effects in the library.", noenv: "Update needed: this firmware has no oscillator / switch editing. Install the newest version from the site to edit everything.", nonames: "Update available: this firmware sends only the names of the first %n presets. Install FMini-1 v1.7.2 or newer to see them all.", @@ -483,7 +487,13 @@ async function connect() { setStatus(true, T("conn")); $("connect").textContent = T("disconnect"); $("connect").disabled = false; startPoll(); } catch (e) { - if (e instanceof Error) { closePorts(); msg(T(e.code || (e.message === "timeout" ? "timeout" : "none")), true); } + if (e instanceof Error) { + closePorts(); msg(T(e.code || (e.message === "timeout" ? "timeout" : "none")), true); + if (e.code === "oldfw") { /* the installer link (the current firmware's page) */ + const a = document.createElement("a"); a.href = "https://ruppert.github.io/fmini-1/"; a.textContent = " " + T("getlink"); + $("msg").firstChild.append(a); + } + } setStatus(false, T("disc")); $("connect").textContent = T("connect"); $("connect").disabled = false; } } @@ -495,6 +505,9 @@ async function handshake() { if (!/^FELUCCA/.test(ver)) throw bad("noedit"); const nEng = a[i++]; const pCount = a[i++]; const gCount = a[i++]; i++; /* NSTEP */ S.pe0 = a[i++]; const eng = []; for (let k = 0; k < nEng; k++) { let s; [s, i] = cstr(a, i); eng.push(s); } + /* protocol: after the engine names, NTRK, then tag 0x56 (version 1) and the protocol number, then CHAIN_ROWS */ + const proto = a[i + 1] === 0x56 && a[i + 2] === 1 ? a[i + 3] : 0; + if (proto < 3) throw bad("oldfw"); S.fmini = eng.indexOf("FMINI"); if (S.fmini < 0) S.fmini = eng.indexOf("FMUG"); /* firmware up to 1.7.0 named the engine FMUG */ if (S.fmini < 0) throw bad("noedit");