feat: web UI with AP, Wi-Fi client, mDNS, presets, OTA and DDP
- Wi-Fi access point led-XXXXXX plus a client network, configurable mDNS name and static client address - Preset tiles with an editor, drag to reorder, default presets, global brightness, Run and Edit modes, collapsible menu on phones - 35 patterns ported from led-driver, up to 512 LEDs, colour order, max brightness and data pin settings - Over-the-air updates (POST /ota) with rollback, and a CLI in tools/ota.py - DDP receiver on UDP 4048 with tools/ddp_test.py - LED refresh every 10 ms; lwIP sockets raised to 16 so mDNS, HTTP and DDP can run together Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
89f996096c
commit
9a04d28ecf
32 files changed
+6210
-398
No files matched your search
+149
-20
@@ -9,35 +9,73 @@
|
||||
<body>
|
||||
<header>
|
||||
<h1>LED strip</h1>
|
||||
<nav>
|
||||
<button class="tab active" data-tab="patterns">Patterns</button>
|
||||
<button id="menuToggle" type="button" class="menu-toggle" aria-controls="menu" aria-expanded="false" aria-label="Menu">
|
||||
<span class="menu-bars" aria-hidden="true"></span>
|
||||
</button>
|
||||
<nav id="menu">
|
||||
<button class="tab active" data-tab="presets">Presets</button>
|
||||
<button class="tab" data-tab="settings">Settings</button>
|
||||
<button id="modeToggle" type="button" class="mode-toggle" aria-pressed="false">Edit mode</button>
|
||||
<button id="newPreset" type="button" class="tab-action" hidden>+ New preset</button>
|
||||
<label class="header-bright">Brightness
|
||||
<input type="range" id="globalBright" min="0" max="255" step="1">
|
||||
<output id="globalOut"></output>
|
||||
</label>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<section id="patterns">
|
||||
<label>Pattern
|
||||
<select id="mode"></select>
|
||||
</label>
|
||||
<div class="row">
|
||||
<label>Colour
|
||||
<input type="color" id="c1" value="#ff0000">
|
||||
</label>
|
||||
<label>Colour 2
|
||||
<input type="color" id="c2" value="#000000">
|
||||
</label>
|
||||
</div>
|
||||
<label>Speed <output id="speedOut"></output>
|
||||
<input type="range" id="speed" min="10" max="3000" step="10">
|
||||
</label>
|
||||
<label>Brightness <output id="brightOut"></output>
|
||||
<input type="range" id="bright" min="0" max="255" step="1">
|
||||
</label>
|
||||
<!-- Front: the preset buttons, each with an Edit button -->
|
||||
<section id="presets">
|
||||
<div id="presetList" class="preset-grid"></div>
|
||||
<p id="status" class="muted" role="status"></p>
|
||||
</section>
|
||||
|
||||
<section id="settings" hidden>
|
||||
<h2>Presets</h2>
|
||||
<p class="muted">Adds the default presets (Rainbow, Chase, Aurora, Candle, Twinkle, Flame, Sweep, Off) that are not in the list yet. Your own presets are kept.</p>
|
||||
<button id="addDefaults" type="button">Add default presets</button>
|
||||
<p id="defaultsMsg" class="muted" role="status"></p>
|
||||
|
||||
<h2>LED strip</h2>
|
||||
<form id="hwForm">
|
||||
<label>Number of LEDs
|
||||
<input type="number" id="hwLeds" min="1" max="512" step="1" required>
|
||||
</label>
|
||||
<label>Data pin (GPIO)
|
||||
<input type="number" id="hwPin" min="0" max="21" step="1" required>
|
||||
</label>
|
||||
<p class="muted">0-10 or 20-21. Pins 11-19 are used by the flash and USB.</p>
|
||||
<label>Colour order
|
||||
<select id="hwOrder">
|
||||
<option value="rgb">RGB</option>
|
||||
<option value="rbg">RBG</option>
|
||||
<option value="grb">GRB (WS2812 default)</option>
|
||||
<option value="gbr">GBR</option>
|
||||
<option value="brg">BRG</option>
|
||||
<option value="bgr">BGR</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Max brightness <output id="hwMaxOut"></output>
|
||||
<input type="range" id="hwMax" min="0" max="255" step="1">
|
||||
</label>
|
||||
<button type="submit">Save strip settings</button>
|
||||
</form>
|
||||
<p id="hwMsg" class="muted" role="status"></p>
|
||||
|
||||
<h2>Firmware</h2>
|
||||
<p>Running <span id="fwInfo">…</span></p>
|
||||
<form id="fwForm">
|
||||
<label>Firmware file (.bin)
|
||||
<input type="file" id="fwFile" accept=".bin,application/octet-stream">
|
||||
</label>
|
||||
<button type="submit" id="fwUpload">Update firmware</button>
|
||||
</form>
|
||||
<div class="row">
|
||||
<button id="fwReboot" type="button" class="btn-secondary">Reboot</button>
|
||||
</div>
|
||||
<p id="fwMsg" class="muted" role="status"></p>
|
||||
|
||||
<h2>Access point</h2>
|
||||
<p>Network <strong id="apName">…</strong> (open). Address <strong>192.168.4.1</strong>.</p>
|
||||
|
||||
@@ -56,9 +94,100 @@
|
||||
<button type="submit">Save and connect</button>
|
||||
</form>
|
||||
<p id="wifiMsg" class="muted" role="status"></p>
|
||||
|
||||
<h2>Device name and address</h2>
|
||||
<form id="netForm">
|
||||
<label>Name (<span id="mdnsName">led</span>.local)
|
||||
<input id="hostname" required maxlength="63" pattern="[-A-Za-z0-9]+" autocomplete="off">
|
||||
</label>
|
||||
<label>Client address
|
||||
<select id="ipMode">
|
||||
<option value="dhcp">Automatic (DHCP)</option>
|
||||
<option value="static">Static</option>
|
||||
</select>
|
||||
</label>
|
||||
<div id="staticFields" hidden>
|
||||
<label>IP address
|
||||
<input id="sIp" inputmode="decimal" placeholder="192.168.1.50" autocomplete="off">
|
||||
</label>
|
||||
<label>Netmask
|
||||
<input id="sMask" inputmode="decimal" placeholder="255.255.255.0" autocomplete="off">
|
||||
</label>
|
||||
<label>Gateway
|
||||
<input id="sGw" inputmode="decimal" placeholder="192.168.1.1" autocomplete="off">
|
||||
</label>
|
||||
<label>DNS <span class="muted">(optional, blank uses the gateway)</span>
|
||||
<input id="sDns" inputmode="decimal" autocomplete="off">
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit">Save network settings</button>
|
||||
</form>
|
||||
<p id="netMsg" class="muted" role="status"></p>
|
||||
<p class="muted">The access point always stays at 192.168.4.1, so you can get back in if a setting breaks the client connection.</p>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<!-- Preset editor: a child window opened from Edit or New preset -->
|
||||
<div id="editor-modal" class="modal" hidden>
|
||||
<div class="modal-content" role="dialog" aria-modal="true" aria-labelledby="editor-title">
|
||||
<div class="modal-head">
|
||||
<h2 id="editor-title">Preset</h2>
|
||||
<button id="editorClose" type="button" class="modal-close" aria-label="Close">×</button>
|
||||
</div>
|
||||
|
||||
<label>Preset name
|
||||
<input id="presetName" maxlength="31" autocomplete="off" placeholder="e.g. warm chase">
|
||||
</label>
|
||||
|
||||
<label>Pattern
|
||||
<select id="pattern"></select>
|
||||
</label>
|
||||
|
||||
<div class="field">
|
||||
<span class="label">Colours</span>
|
||||
<div id="colours" class="swatches"></div>
|
||||
<div class="row">
|
||||
<button id="addColour" type="button">Add colour</button>
|
||||
<button id="removeColour" type="button">Remove colour</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>Background
|
||||
<input type="color" id="bg" value="#000000">
|
||||
</label>
|
||||
|
||||
<label>Delay <output id="delayOut"></output>
|
||||
<input type="range" id="delay" min="10" max="3000" step="10">
|
||||
</label>
|
||||
<label>Brightness <output id="brightOut"></output>
|
||||
<input type="range" id="bright" min="0" max="255" step="1">
|
||||
</label>
|
||||
<label>Fade in <output id="fadeOut"></output>
|
||||
<input type="range" id="fade" min="0" max="5000" step="50">
|
||||
</label>
|
||||
|
||||
<div class="checks">
|
||||
<label class="check"><input type="checkbox" id="auto"> Keep running (auto)</label>
|
||||
<label class="check"><input type="checkbox" id="reverse"> Reverse direction</label>
|
||||
<label class="check"><input type="checkbox" id="beatTime"> Beat timing (quarter beats)</label>
|
||||
</div>
|
||||
|
||||
<label id="styleRow" hidden>Style
|
||||
<select id="style"></select>
|
||||
</label>
|
||||
<div id="numbers" class="numbers"></div>
|
||||
|
||||
<p id="presetMsg" class="muted" role="status"></p>
|
||||
|
||||
<div class="modal-actions">
|
||||
<button id="apply" type="button" class="btn-secondary">Apply to strip</button>
|
||||
<button id="presetStartup" type="button" class="btn-secondary" disabled>Use at startup</button>
|
||||
<button id="presetDelete" type="button" class="btn-danger" disabled>Delete</button>
|
||||
<button id="presetSave" type="button">Save preset</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user