Channel 11 defaults, ESP-NOW driver config and rig/desktop updates

Moves the controller, bridge and led-driver default ESP-NOW channel to 11 and
updates the led-driver and led-tool submodule pointers. Includes the rest of the
working tree: web UI, desktop and sim-controller changes, API and bridge code,
graphify output, and the .gitea and fixture-driver folders.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Haiku 5.5 committed 2026-11-21 01:19:02 +13:00
1 parent 35207a868a
commit edf35e9c71
280 files changed
+24043 -1756

No files matched your search

+28
View File
@@ -39,3 +39,31 @@
.gallery { grid-template-columns: 1fr; padding: 12px 16px; }
.card form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Views: the tile grid (list) or one preset's editor */
body.list #gallery { display: none; }
body:not(.list) #list-view { display: none; }
body.list .editor-only { display: none; }
body:not(.list) .list-only { display: none; }
#g-search { width: 220px; }
#list-view { padding: 12px 16px 24px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tile {
display: flex;
flex-direction: column;
gap: 6px;
text-align: left;
font: inherit;
color: inherit;
background: var(--panel);
border: 1px solid var(--line);
border-radius: 10px;
padding: 10px 12px;
cursor: pointer;
min-width: 0;
}
.tile:hover, .tile:focus-visible { border-color: #5aa9ff; outline: none; }
.tile[hidden] { display: none; }
.tile .t-name { font-weight: 600; font-family: ui-monospace, Menlo, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .t-pattern { color: var(--muted); font-size: 12px; }
.tile canvas { width: 100%; height: 24px; display: block; background: #0b0c0f; border-radius: 4px; }
+5 -22
View File
@@ -4,38 +4,21 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#0e0f12">
<title>Pattern Gallery</title>
<title>Preset editor</title>
<link rel="icon" href="data:,">
<link rel="stylesheet" href="/sim/styles.css">
<link rel="stylesheet" href="/sim/gallery.css">
</head>
<body>
<body class="list">
<header class="topbar">
<div class="brand">
<span class="brand-mark" aria-hidden="true"></span>
<span class="brand-name">Pattern gallery</span>
</div>
<div class="chips"><span class="chip" id="g-count">loading…</span></div>
<div class="actions">
<input type="search" id="g-search" class="list-only" placeholder="Search presets" aria-label="Search presets">
<label class="field-inline">LEDs <input id="g-leds" type="number" min="1" max="512" step="1" value="119"></label>
<label class="field-inline">Speed
<select id="g-speed">
<option value="0.25">¼×</option><option value="0.5">½×</option><option value="1" selected>1×</option>
<option value="2">2×</option><option value="4">4×</option>
</select>
</label>
<div class="pager">
<button type="button" id="g-prev" class="secondary" title="Previous pattern (←)">‹</button>
<select id="g-pick" title="Choose a pattern"></select>
<button type="button" id="g-next" class="secondary" title="Next pattern (→)">›</button>
</div>
<button type="button" id="g-add" class="secondary" title="Add a preset copied from the one shown">Add preset</button>
<button type="button" id="g-pause" class="secondary">Pause</button>
<button type="button" id="g-restart" class="secondary">Restart all</button>
<a class="button secondary" href="/sim/">Rig</a>
<button type="button" id="g-add" class="secondary editor-only" title="Add a preset copied from the one shown">Add preset</button>
</div>
</header>
<div id="banner" class="banner" hidden></div>
<section id="list-view"><div class="tiles" id="tiles"></div></section>
<main class="gallery" id="gallery"></main>
<script type="module" src="/sim/gallery.js"></script>
</body>
+56 -36
View File
@@ -11,7 +11,7 @@ const MAX_STEPS = 25; // per animation frame, after the tab was in the backgroun
const LED_CAP = 512;
const $ = (id) => document.getElementById(id);
const state = { leds: 119, speed: 1, paused: false, cards: [], current: 0, wasm: null, defs: {} };
const state = { leds: 119, speed: 1, paused: false, cards: [], current: 0, wasm: null, defs: {}, view: 'list' };
function banner(text) {
const el = $('banner');
@@ -154,6 +154,7 @@ function nameField(card) {
i.oninput = () => {
card.name = i.value.trim() || card.name;
card.el.querySelector('.card-name').textContent = card.name;
if (card.tile) card.tile.querySelector('.t-name').textContent = card.name;
};
l.append(i);
return l;
@@ -262,13 +263,6 @@ function payloadFor(card) {
const JSON_HEADERS = { 'Content-Type': 'application/json', Accept: 'application/json' };
// Rebuild the dropdown from the cards (keeps the shown one selected)
function refreshPick() {
const sel = $('g-pick');
sel.replaceChildren(...state.cards.map((c, i) => new Option(`${i + 1}. ${c.name} (${c.pattern})`, String(i))));
sel.value = String(state.current);
}
async function save(card) {
const status = card.el.querySelector('.save-status');
status.textContent = 'Saving…';
@@ -280,9 +274,9 @@ async function save(card) {
});
if (!r.ok) throw new Error(`HTTP ${r.status}`);
card.el.querySelector('.card-name').textContent = card.name;
card.tile.querySelector('.t-name').textContent = card.name;
card.applied = JSON.parse(JSON.stringify(card.preset));
apply(card, false);
refreshPick();
status.textContent = 'Saved';
} catch (err) {
status.textContent = `Save failed: ${err.message}`;
@@ -306,8 +300,7 @@ async function addPreset() {
const card = buildCard(mod, src.index, { ...out[id], id });
state.cards.push(card);
$('gallery').append(card.el);
$('g-count').textContent = `${state.cards.length} presets`;
refreshPick();
makeTile(card);
show(state.cards.length - 1);
} catch (err) {
banner(`Could not add the preset: ${err.message}`);
@@ -327,7 +320,8 @@ function buildCard(mod, index, saved) {
el.innerHTML =
'<div class="card-head"><span class="card-name"></span><span class="btns">' +
'<button type="button" class="secondary" data-a="restart" title="Restart the pattern">↺</button>' +
'<button type="button" data-a="save" title="Save this preset to the controller">Save</button></span></div>' +
'<button type="button" data-a="save" title="Save this preset to the controller">Save</button>' +
'<button type="button" class="secondary" data-a="close" title="Close the preset editor">Close</button></span></div>' +
'<span class="save-status" aria-live="polite"></span>' +
'<canvas></canvas>';
el.querySelector('.card-name').textContent = name;
@@ -367,17 +361,17 @@ function buildCard(mod, index, saved) {
);
el.append(form);
el.querySelector('[data-a=save]').onclick = () => save(card);
el.querySelector('[data-a=close]').onclick = () => closeEditor();
el.querySelector('[data-a=restart]').onclick = () => apply(card, true);
applySpec(card);
apply(card, true);
return card;
}
function draw(card) {
function draw(card, c = card.canvas) {
const mod = card.mod;
const n = mod._sim_frame(card.framePtr, LED_CAP * 3);
const px = mod.HEAPU8.subarray(card.framePtr, card.framePtr + n * 3);
const c = card.canvas;
const dpr = window.devicePixelRatio || 1;
const w = Math.max(1, Math.round(c.clientWidth * dpr));
const h = Math.max(1, Math.round(c.clientHeight * dpr));
@@ -404,13 +398,45 @@ function draw(card) {
function show(index) {
const n = state.cards.length;
if (!n) return;
state.view = 'editor';
document.body.classList.remove('list');
state.current = (index + n) % n;
state.cards.forEach((c, i) => {
c.el.hidden = i !== state.current;
});
$('g-pick').value = String(state.current);
$('g-prev').disabled = n < 2;
$('g-next').disabled = n < 2;
}
// Close the editor: in the controller's split pane that closes the pane; in its own window or tab, the window
function closeEditor() {
const split = window.parent && window.parent !== window ? window.parent.simSplit : null;
if (split && split.close) {
split.close();
return;
}
window.close();
// A tab that the page did not open stays open: go back to the controller instead
setTimeout(() => {
location.href = '/';
}, 150);
}
// The tile grid: every preset as a live tile; clicking one opens its editor
function showList() {
state.view = 'list';
document.body.classList.add('list');
}
function makeTile(card) {
const t = document.createElement('button');
t.type = 'button';
t.className = 'tile';
t.innerHTML = '<span class="t-name"></span><span class="t-pattern"></span><canvas></canvas>';
t.querySelector('.t-name').textContent = card.name;
t.querySelector('.t-pattern').textContent = card.pattern;
t.onclick = () => show(state.cards.indexOf(card));
card.tile = t;
card.thumb = t.querySelector('canvas');
$('tiles').append(t);
}
let lastT = 0;
@@ -435,7 +461,11 @@ function tick(t) {
const dirty = JSON.stringify(shown.preset) !== JSON.stringify(shown.applied);
if (dirty) status.textContent = 'Unsaved changes (press Save to keep them)';
else if (status.textContent.startsWith('Unsaved')) status.textContent = '';
draw(shown); // only the shown pattern is drawn
if (state.view === 'list') {
for (const c of state.cards) if (!c.tile.hidden) draw(c, c.thumb);
} else {
draw(shown);
}
}
requestAnimationFrame(tick);
}
@@ -474,7 +504,6 @@ async function main() {
.filter((x) => x.index >= 0);
const skipped = saved.length - list.length;
if (skipped) banner(`${skipped} preset(s) use a pattern this build does not have and are not shown.`);
$('g-count').textContent = `${list.length} presets`;
const grid = $('gallery');
for (let i = 0; i < list.length; i += 1) {
@@ -482,9 +511,14 @@ async function main() {
const card = buildCard(mod, list[i].index, list[i].p);
state.cards.push(card);
grid.append(card.el);
makeTile(card);
}
refreshPick();
$('g-pick').onchange = () => show(Number($('g-pick').value));
$('g-search').oninput = () => {
const q = $('g-search').value.trim().toLowerCase();
for (const c of state.cards) {
c.tile.hidden = Boolean(q) && !(c.name.toLowerCase().includes(q) || c.pattern.toLowerCase().includes(q));
}
};
$('g-leds').onchange = () => {
const n = Math.max(1, Math.min(LED_CAP, Math.round(Number($('g-leds').value)) || 119));
$('g-leds').value = n;
@@ -494,23 +528,9 @@ async function main() {
apply(card, true);
}
};
$('g-speed').onchange = () => {
state.speed = Number($('g-speed').value) || 1;
};
$('g-pause').onclick = () => {
state.paused = !state.paused;
$('g-pause').textContent = state.paused ? 'Play' : 'Pause';
};
$('g-restart').onclick = () => state.cards.forEach((c) => apply(c, true));
$('g-add').onclick = () => addPreset();
$('g-prev').onclick = () => show(state.current - 1);
$('g-next').onclick = () => show(state.current + 1);
document.addEventListener('keydown', (ev) => {
if (ev.target.closest('input, select, textarea')) return;
if (ev.key === 'ArrowLeft') show(state.current - 1);
if (ev.key === 'ArrowRight') show(state.current + 1);
});
show(0);
showList();
requestAnimationFrame(tick);
}