feat: sequences v2, bridges, and sim-controller
Rework sequences (engine, seqplay, envelope, API, web UI), add bridge support, add the host sim-controller and rig simulation tests, and update docs, presets and project tooling config. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d664026ee5
commit
2543673bd8
68 files changed
+5761
-460
No files matched your search
@@ -81,6 +81,51 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}, 5000);
|
||||
};
|
||||
|
||||
const rebootButton = document.getElementById('reboot-btn');
|
||||
if (rebootButton) {
|
||||
rebootButton.addEventListener('click', async () => {
|
||||
if (!confirm('Reboot the controller now? The page will be unavailable for a few seconds.')) return;
|
||||
rebootButton.disabled = true;
|
||||
try {
|
||||
await fetch('/reboot', { method: 'POST' });
|
||||
rebootButton.textContent = 'Rebooting…';
|
||||
setTimeout(() => location.reload(), 8000);
|
||||
} catch (error) {
|
||||
rebootButton.disabled = false;
|
||||
console.error('Reboot failed:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function loadNetworkStatus() {
|
||||
const box = document.getElementById('network-status');
|
||||
if (!box) return;
|
||||
const row = (label, value) => {
|
||||
const r = document.createElement('div');
|
||||
const b = document.createElement('strong');
|
||||
b.textContent = label + ': ';
|
||||
r.append(b, value);
|
||||
return r;
|
||||
};
|
||||
try {
|
||||
const st = await fetch('/status', { cache: 'no-store' }).then((r) => r.json());
|
||||
box.textContent = '';
|
||||
const eth = st.eth || { ip: st.ip };
|
||||
const up = eth.ip && eth.ip !== '0.0.0.0';
|
||||
box.append(row('Ethernet', up ? eth.ip + (eth.mask ? ' / ' + eth.mask : '') + (eth.gw && eth.gw !== '0.0.0.0' ? ', gateway ' + eth.gw : '') : 'no address'));
|
||||
if (st.ap) {
|
||||
box.append(row('Access point', st.ap_ip || '192.168.5.1'));
|
||||
const clients = Array.isArray(st.ap_clients) ? st.ap_clients : [];
|
||||
box.append(row('Wi-Fi clients', clients.length ? clients.map((c) => c.ip + ' (' + c.mac + ')').join(', ') : 'none'));
|
||||
} else {
|
||||
box.append(row('Access point', 'off'));
|
||||
}
|
||||
if (st.mac) box.append(row('MAC', st.mac));
|
||||
} catch (error) {
|
||||
box.textContent = 'Could not read network status.';
|
||||
}
|
||||
}
|
||||
|
||||
async function loadDeviceSettings() {
|
||||
try {
|
||||
const response = await fetch('/settings');
|
||||
@@ -101,6 +146,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
setApToggle(data.ap_enabled !== false);
|
||||
const apPw = document.getElementById('ap-password-input');
|
||||
if (apPw) apPw.value = data.ap_password || '';
|
||||
const bridge = document.getElementById('bridge-input');
|
||||
if (bridge) bridge.value = data.bridge || '';
|
||||
staticIpsList.innerHTML = '';
|
||||
(Array.isArray(data.static_ips) ? data.static_ips : []).forEach(addStaticIpRow);
|
||||
}
|
||||
@@ -196,6 +243,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
panel.classList.toggle('active', on);
|
||||
panel.hidden = !on;
|
||||
}
|
||||
if (tabId === 'network') loadNetworkStatus();
|
||||
settingsModal.classList.toggle('settings-modal--led-tool', tabId === 'led-tool');
|
||||
if (ledToolIframe) {
|
||||
// Loaded on demand, so the Controller tab costs no requests
|
||||
@@ -292,6 +340,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
hostname,
|
||||
static_ips: staticIps,
|
||||
ap_password: apPassword,
|
||||
bridge: (document.getElementById('bridge-input') || { value: '' }).value.trim(),
|
||||
ap_enabled: !apToggle || apToggle.getAttribute('aria-pressed') === 'true',
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -282,6 +282,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const presetNewColorInput = document.getElementById('preset-new-color');
|
||||
const presetBrightnessInput = document.getElementById('preset-brightness-input');
|
||||
const presetDelayInput = document.getElementById('preset-delay-input');
|
||||
const presetFadeInput = document.getElementById('preset-fade-input');
|
||||
const presetBeatTimeInput = document.getElementById('preset-beat-time-input');
|
||||
const presetDelayField = presetDelayInput ? presetDelayInput.closest('.preset-editor-field') : null;
|
||||
const presetBackgroundInput = document.getElementById('preset-background-input');
|
||||
const presetBackgroundButton = document.getElementById('preset-background-btn');
|
||||
@@ -747,6 +749,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
renderPresetColors(colors, paletteRefs);
|
||||
presetBrightnessInput.value = preset.brightness || 0;
|
||||
presetDelayInput.value = preset.delay || 0;
|
||||
if (presetFadeInput) presetFadeInput.value = preset.fade || preset.f || 0;
|
||||
if (presetBeatTimeInput) presetBeatTimeInput.checked = !!(preset.beat_time || preset.tb);
|
||||
if (presetBackgroundInput) {
|
||||
const rawBgRef = preset.background_palette_ref ?? preset.backgroundPaletteRef;
|
||||
let bgRef = null;
|
||||
@@ -983,6 +987,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
// Use canonical field names expected by the device / API
|
||||
brightness: presetBrightnessInput ? parseInt(presetBrightnessInput.value, 10) || 0 : 0,
|
||||
delay: presetDelayInput ? parseInt(presetDelayInput.value, 10) || 0 : 0,
|
||||
fade: presetFadeInput ? Math.max(0, Math.min(10000, parseInt(presetFadeInput.value, 10) || 0)) : 0,
|
||||
beat_time: !!(presetBeatTimeInput && presetBeatTimeInput.checked),
|
||||
background: presetBackgroundInput ? presetBackgroundInput.value : '#000000',
|
||||
background_palette_ref: currentBackgroundPaletteRef != null ? currentBackgroundPaletteRef : null,
|
||||
auto: presetManualModeInput ? !presetManualModeInput.checked : true,
|
||||
|
||||
+869
-81
File diff suppressed because it is too large.
Load diff
@@ -2583,3 +2583,240 @@ html.simulated-bpm-mode .seq-switch-toggle-wrap {
|
||||
.list-search-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Sequence editor: targets, lane options, grid (sequences.js) */
|
||||
.seq-targets-panel {
|
||||
margin: 0 0 0.75rem 0;
|
||||
padding: 0.5rem;
|
||||
border: 1px solid #4a4a4a;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.seq-targets-panel > summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.seq-target-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.seq-target-row input[type="text"] {
|
||||
width: 10rem;
|
||||
}
|
||||
|
||||
.seq-target-row details {
|
||||
flex: 1 1 12rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.seq-target-row summary {
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.seq-target-num {
|
||||
min-width: 1.5rem;
|
||||
opacity: 0.7;
|
||||
padding-top: 0.35rem;
|
||||
}
|
||||
|
||||
.seq-target-pick,
|
||||
.seq-target-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem 0.75rem;
|
||||
align-items: center;
|
||||
margin: 0.25rem 0;
|
||||
}
|
||||
|
||||
.seq-target-pick .muted-text {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
.seq-target-btns {
|
||||
display: flex;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.seq-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.seq-lane-opts {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem 0.75rem;
|
||||
align-items: center;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.seq-lane-opts > .muted-text,
|
||||
.seq-lane-opts > .seq-target-chips,
|
||||
.seq-lane-chase {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
.seq-lane-opt {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.seq-lane-chase,
|
||||
.seq-lane-chase-opts {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.seq-step-more > summary {
|
||||
cursor: pointer;
|
||||
font-size: 0.9em;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.seq-grid {
|
||||
margin: 0 0 0.75rem 0;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.seq-grid-row {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 0.35rem;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.seq-grid-lane {
|
||||
flex: 0 0 2rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: bold;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.seq-grid-track {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
min-width: 18rem;
|
||||
}
|
||||
|
||||
.seq-grid-cell {
|
||||
--cell-color: #6a5acd;
|
||||
box-sizing: border-box;
|
||||
min-width: 1.25rem;
|
||||
height: 2.25rem;
|
||||
padding: 0 0.25rem;
|
||||
border: 1px solid #222;
|
||||
border-left: 4px solid var(--cell-color);
|
||||
background: #3a3a3a;
|
||||
color: white;
|
||||
font-size: 0.8em;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.seq-grid-cell:hover {
|
||||
background: #474747;
|
||||
}
|
||||
|
||||
.seq-grid-gap {
|
||||
background: repeating-linear-gradient(45deg, transparent 0 4px, rgba(255, 255, 255, 0.06) 4px 8px);
|
||||
border-left: 1px solid #222;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.seq-grid-rest {
|
||||
background: #262626;
|
||||
color: #aaa;
|
||||
border-left-color: #555;
|
||||
}
|
||||
|
||||
.seq-grid-anim {
|
||||
border-left-color: #f5c542;
|
||||
}
|
||||
|
||||
.seq-grid-cell.playing {
|
||||
outline: 2px solid #f5f5f5;
|
||||
outline-offset: -2px;
|
||||
background: #55507a;
|
||||
}
|
||||
|
||||
.seq-grid-pick {
|
||||
height: 2.25rem;
|
||||
min-width: 6rem;
|
||||
}
|
||||
|
||||
.seq-grid-axis {
|
||||
margin-top: 0.25rem;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
/* Animation tiles: one shot, with progress while playing */
|
||||
.animation-tile-row .sequence-tile-main {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-style: dashed;
|
||||
}
|
||||
|
||||
.animation-tile-progress {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
height: 3px;
|
||||
width: calc(var(--anim-progress, 0) * 100%);
|
||||
background: #f5c542;
|
||||
transition: width 0.2s linear;
|
||||
}
|
||||
|
||||
.animation-tile-row.firing .sequence-tile-main {
|
||||
border-color: #f5c542;
|
||||
}
|
||||
|
||||
/* The modal's block labels and full-width inputs don't suit the sequence editor's compact rows */
|
||||
#sequence-editor-modal .seq-chip,
|
||||
#sequence-editor-modal .seq-lane-opt,
|
||||
#sequence-editor-modal .seq-lane-chase label,
|
||||
#sequence-editor-modal .seq-step-more label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
margin: 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#sequence-editor-modal .seq-chip input[type="checkbox"],
|
||||
#sequence-editor-modal .seq-lane-chase input[type="checkbox"],
|
||||
#sequence-editor-modal .seq-step-more input[type="checkbox"] {
|
||||
width: auto;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#sequence-editor-modal .seq-lane-opt input,
|
||||
#sequence-editor-modal .seq-lane-chase-opts input {
|
||||
width: 4.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#sequence-editor-modal .seq-target-row input[type="text"] {
|
||||
width: 10rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#sequence-editor-modal .seq-lane-opts > .muted-text {
|
||||
text-align: left;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
@@ -349,13 +349,14 @@
|
||||
<div id="sequences-modal" class="modal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-head">
|
||||
<h2>Sequences</h2>
|
||||
<h2>Sequences & animations</h2>
|
||||
<div class="modal-top-actions">
|
||||
<button type="button" class="btn btn-secondary" id="sequences-close-btn">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-actions">
|
||||
<button type="button" class="btn btn-primary" id="sequence-add-btn">Add</button>
|
||||
<button type="button" class="btn btn-primary" id="sequence-add-btn">Add sequence</button>
|
||||
<button type="button" class="btn btn-primary" id="animation-add-btn">Add animation</button>
|
||||
<button type="button" class="btn btn-secondary" id="sequences-open-presets-btn">Presets</button>
|
||||
</div>
|
||||
<div id="sequences-list" class="profiles-list"></div>
|
||||
@@ -368,6 +369,7 @@
|
||||
<div class="modal-head">
|
||||
<h2>Sequence</h2>
|
||||
<div class="modal-top-actions">
|
||||
<button type="button" class="btn btn-secondary" id="sequence-editor-try-btn" title="Save, then play it in the current zone">Save & play</button>
|
||||
<button type="button" class="btn btn-primary" id="sequence-editor-save-btn">Save</button>
|
||||
<button type="button" class="btn btn-secondary" id="sequence-editor-close-btn">Close</button>
|
||||
</div>
|
||||
@@ -377,7 +379,15 @@
|
||||
<input type="text" id="sequence-editor-name" placeholder="Sequence name" style="width:100%;max-width:24rem;">
|
||||
</div>
|
||||
<div class="preset-editor-field">
|
||||
<label for="sequence-editor-mode">Steps last</label>
|
||||
<label for="sequence-editor-kind">Kind</label>
|
||||
<select id="sequence-editor-kind" class="zone-device-add-select">
|
||||
<option value="sequence">Sequence</option>
|
||||
<option value="animation">Animation (one shot)</option>
|
||||
</select>
|
||||
<div id="sequence-editor-kind-hint" class="muted-text"></div>
|
||||
</div>
|
||||
<div class="preset-editor-field">
|
||||
<label for="sequence-editor-mode">Steps last (lanes can override)</label>
|
||||
<select id="sequence-editor-mode" class="zone-device-add-select">
|
||||
<option value="beats">Beats</option>
|
||||
<option value="time">Time (seconds)</option>
|
||||
@@ -389,6 +399,18 @@
|
||||
Loop
|
||||
</label>
|
||||
</div>
|
||||
<details class="seq-targets-panel" open>
|
||||
<summary><strong>Targets</strong> <span class="muted-text">— the drivers this sequence plays to, in order. Lanes, steps and chases pick from them.</span></summary>
|
||||
<div id="sequence-editor-targets" class="profiles-list"></div>
|
||||
<div class="modal-actions">
|
||||
<button type="button" class="btn btn-secondary btn-small" id="sequence-editor-add-target-btn">Add target</button>
|
||||
<button type="button" class="btn btn-secondary btn-small" id="sequence-editor-per-driver-btn" title="One target for each driver in this zone's groups">One per driver</button>
|
||||
</div>
|
||||
</details>
|
||||
<div class="modal-actions">
|
||||
<button type="button" class="btn btn-secondary btn-small" id="sequence-editor-view-btn">Show grid</button>
|
||||
</div>
|
||||
<div id="sequence-editor-grid" class="seq-grid" hidden></div>
|
||||
<div id="sequence-editor-lanes"></div>
|
||||
<div class="modal-actions preset-editor-modal-actions">
|
||||
<button type="button" class="btn btn-secondary btn-small" id="sequence-editor-add-lane-btn">Add lane</button>
|
||||
@@ -426,7 +448,16 @@
|
||||
</div>
|
||||
<div class="preset-editor-field">
|
||||
<label for="preset-delay-input">Delay (ms)</label>
|
||||
<input type="number" id="preset-delay-input" placeholder="Delay" min="0" max="10000" value="0">
|
||||
<input type="number" id="preset-delay-input" placeholder="Delay" min="0" max="60000" value="0">
|
||||
</div>
|
||||
<div class="preset-editor-field">
|
||||
<label for="preset-fade-input">Fade in (ms)</label>
|
||||
<input type="number" id="preset-fade-input" placeholder="0" min="0" max="10000" step="50" value="0" title="Crossfade from what the strip showed when this preset is selected (needs updated drivers)">
|
||||
</div>
|
||||
<div class="preset-editor-field">
|
||||
<label for="preset-beat-time-input" title="Delay and timing parameters count quarter beats instead of ms, so the preset follows the tempo">
|
||||
<input type="checkbox" id="preset-beat-time-input"> Times in ¼ beats
|
||||
</label>
|
||||
</div>
|
||||
<div class="preset-editor-field">
|
||||
<label for="preset-background-input">Background</label>
|
||||
@@ -954,6 +985,10 @@
|
||||
<ul>
|
||||
<li><strong>Sequences</strong> (Edit mode): build multi-step shows with one or more <strong>lanes</strong> (each lane targets a device group).</li>
|
||||
<li>Add presets as steps per lane; open from the zone editor to attach a sequence to a zone.</li>
|
||||
<li><strong>Targets</strong>: list the drivers the sequence plays to (groups or single drivers; <em>One per driver</em> fills it from the zone). Each lane picks its targets, and a step can light just some of them.</li>
|
||||
<li><strong>Lane options</strong>: timing in beats or seconds (beat and time lanes run side by side), <em>Start after</em> to offset a lane, <em>Speed</em> ¼×–4×, and <em>Chase</em> to move each step to the next target (forward, reverse, bounce, random).</li>
|
||||
<li><strong>Animations</strong>: a one-shot clip. Its zone tile (⚡) plays it once over whatever runs, then the drivers go back; the sequence underneath keeps time. A step can fire an animation too.</li>
|
||||
<li><strong>Show grid</strong>: all lanes on one time line, with the playing steps lit; click a cell to change it.</li>
|
||||
<li><strong>Beat</strong> / <strong>Downbeat</strong> toggle (header): when starting a sequence, wait for beat or downbeat before step 1.</li>
|
||||
<li>Tap <kbd>S</kbd> or the BPM button during playback to sync step timing to music (with Audio running).</li>
|
||||
</ul>
|
||||
@@ -1153,11 +1188,12 @@
|
||||
<h2>Device Settings</h2>
|
||||
<div class="settings-tabs" role="tablist" aria-label="Settings sections">
|
||||
<button type="button" class="settings-tab-btn active" role="tab" id="settings-tab-controller" data-settings-tab="controller" aria-selected="true" aria-controls="settings-panel-controller">Controller</button>
|
||||
<button type="button" class="settings-tab-btn" role="tab" id="settings-tab-network" data-settings-tab="network" aria-selected="false" aria-controls="settings-panel-network">Network</button>
|
||||
<button type="button" class="settings-tab-btn" role="tab" id="settings-tab-led-tool" data-settings-tab="led-tool" aria-selected="false" aria-controls="settings-panel-led-tool">Driver</button>
|
||||
</div>
|
||||
|
||||
<div id="settings-panel-controller" class="settings-tab-panel active" data-settings-panel="controller" role="tabpanel" aria-labelledby="settings-tab-controller">
|
||||
<p class="muted-text">Controller name, ESP-NOW channel and network.</p>
|
||||
<p class="muted-text">Controller name and ESP-NOW channel.</p>
|
||||
|
||||
<div id="settings-message" class="message"></div>
|
||||
|
||||
@@ -1181,6 +1217,14 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="settings-panel-network" class="settings-tab-panel" data-settings-panel="network" role="tabpanel" aria-labelledby="settings-tab-network" hidden>
|
||||
<div class="settings-section">
|
||||
<h3>Connected</h3>
|
||||
<div id="network-status" class="muted-text">Loading…</div>
|
||||
</div>
|
||||
|
||||
<!-- Network -->
|
||||
<div class="settings-section">
|
||||
<h3>Network</h3>
|
||||
@@ -1204,6 +1248,11 @@
|
||||
<input type="text" id="ap-password-input" placeholder="open (no password)" minlength="8" maxlength="63" autocomplete="off">
|
||||
<small>8 to 63 characters (WPA2). Leave empty for an open network.</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="bridge-input">Simulator bridge</label>
|
||||
<input type="text" id="bridge-input" placeholder="off (drivers over the radio)" maxlength="63" autocomplete="off">
|
||||
<small><code>host:port</code> of led-simulator (UDP, port 8766). While set, the controller talks to the simulated drivers instead of the radio. Leave empty for the real rig.</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Static IPs</label>
|
||||
<small>Tried in order each time the Ethernet link comes up; the first whose gateway answers is used. If none does, or the list is empty, DHCP is used. With no DHCP server, as on a cable straight to a PC, the controller is at <code>192.168.4.1</code>; give the PC a static IP such as <code>192.168.4.2</code>.</small>
|
||||
@@ -1214,6 +1263,9 @@
|
||||
<button type="submit" class="btn btn-primary btn-full">Save network settings</button>
|
||||
</div>
|
||||
<small>Network changes apply after the controller restarts.</small>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-secondary btn-full" id="reboot-btn">Reboot controller</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user