Files
led-driver/web/index.html
T
jimmyandClaude Sonnet 5.5 59eb37cad5 feat: access point name and password setting, ap_on in status
- ap_ssid and ap_password on /api/network: empty name uses led-XXXXXX, a password of 8-63 characters
  makes the access point WPA2, empty is open; the password is never sent back (ap_password_set)
- a running access point restarts when its name or password changes
- /api/status reports ap_on; the web page gets the fields

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-12 00:46:04 +13:00

246 lines
10 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>LED strip</title>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<header>
<h1>LED strip</h1>
<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>
<div class="header-device">
<select id="deviceSelect" aria-label="Device"></select>
</div>
<div class="header-bright">
<input type="range" id="globalBright" min="0" max="255" step="1" aria-label="Brightness">
<output id="globalOut"></output>
</div>
</nav>
</header>
<main>
<!-- 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>
<div class="subnav" role="tablist" aria-label="Settings sections">
<button type="button" class="subtab active" data-sub="devices" role="tab">Devices</button>
<button type="button" class="subtab" data-sub="presets" role="tab">Presets</button>
<button type="button" class="subtab" data-sub="led" role="tab">LED strip</button>
<button type="button" class="subtab" data-sub="network" role="tab">Network</button>
<button type="button" class="subtab" data-sub="firmware" role="tab">Firmware</button>
</div>
<div class="subpage" data-sub="devices">
<h2>Devices</h2>
<p class="muted">Control other LED drivers from this page. Add each one by its address, such as 10.1.1.50 or led-desk.local. The list is kept in this browser.</p>
<ul id="devList" class="list"></ul>
<form id="devAdd">
<label>Address
<input id="devHost" maxlength="80" autocomplete="off" placeholder="10.1.1.50">
</label>
<button type="submit">Add device</button>
</form>
<p id="devMsg" class="muted" role="status"></p>
</div>
<div class="subpage" data-sub="presets" 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>Sync presets</h2>
<p class="muted">Copy this device's presets, their order and its startup preset to every other device. A preset with the same name is replaced. Presets that only the other devices have are kept.</p>
<button id="syncPresets" type="button">Sync presets to other devices</button>
<p id="syncMsg" class="muted" role="status"></p>
</div>
<div class="subpage" data-sub="led" hidden>
<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>
</div>
<div class="subpage" data-sub="firmware" hidden>
<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>
</div>
<div class="subpage" data-sub="network" hidden>
<h2>Access point</h2>
<p id="apInfo" hidden>Network <strong id="apName">…</strong> (open). Address <strong>192.168.4.1</strong>.</p>
<p id="apOffInfo" class="muted" hidden>Access point is off.</p>
<h2>Wi-Fi client</h2>
<p>Status: <span id="staState">…</span></p>
<button id="scan" type="button">Scan for networks</button>
<ul id="networks" class="list"></ul>
<form id="wifiForm">
<label>Network name (SSID)
<input id="ssid" required maxlength="32" autocomplete="off">
</label>
<label>Password <span class="muted">(blank for open networks)</span>
<input id="pass" type="password" maxlength="64" autocomplete="off">
</label>
<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>
<label class="check"><input type="checkbox" id="apOn"> Access point on</label>
<label>Access point name <span class="muted">(blank for the default led-XXXXXX)</span>
<input id="apSsid" maxlength="32" autocomplete="off">
</label>
<label>Access point password <span class="muted" id="apPassHint">(blank keeps the current one)</span>
<input id="apPass" type="password" maxlength="63" autocomplete="off">
</label>
<label class="check"><input type="checkbox" id="apOpen"> Open network (no password)</label>
<label class="check"><input type="checkbox" id="ddpOn"> DDP and sync receive on</label>
<p class="muted">Turn it off to use only your Wi-Fi network. Turning it off needs a connected Wi-Fi network. If the network stays down for about a minute, the access point comes back on by itself.</p>
<button type="submit">Save network settings</button>
</form>
<p id="netMsg" class="muted" role="status"></p>
<p class="muted">While the access point is on it stays at 192.168.4.1, so you can get back in if a setting breaks the client connection.</p>
</div>
</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>