docs(ui): update help assets and regenerate help pdf
This commit is contained in:
@@ -179,9 +179,10 @@
|
||||
<input type="number" id="preset-n8-input" min="0" max="255" value="0" class="n-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-actions">
|
||||
<div class="modal-actions preset-editor-modal-actions">
|
||||
<button class="btn btn-secondary" id="preset-send-btn">Try</button>
|
||||
<button class="btn btn-secondary" id="preset-default-btn">Default</button>
|
||||
<button type="button" class="btn btn-danger" id="preset-remove-from-tab-btn" hidden>Remove from tab</button>
|
||||
<button class="btn btn-primary" id="preset-save-btn">Save & Send</button>
|
||||
<button class="btn btn-secondary" id="preset-editor-close-btn">Close</button>
|
||||
</div>
|
||||
@@ -262,8 +263,13 @@
|
||||
<input type="text" id="device-name-input" name="device_name" placeholder="e.g. led-controller" required>
|
||||
<small>This name may be used for mDNS (e.g. <code>name.local</code>) and UI display.</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="wifi-channel-input">WiFi channel (ESP-NOW)</label>
|
||||
<input type="number" id="wifi-channel-input" name="wifi_channel" min="1" max="11" required>
|
||||
<small>STA channel (1–11) for LED drivers and the serial bridge. Use the same value everywhere.</small>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-primary btn-full">Save Name</button>
|
||||
<button type="submit" class="btn btn-primary btn-full">Save device settings</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -170,11 +170,26 @@
|
||||
|
||||
<div class="settings-header">
|
||||
<h1>Device Settings</h1>
|
||||
<p>Configure WiFi Access Point settings</p>
|
||||
<p>Configure WiFi Access Point and ESP-NOW options</p>
|
||||
</div>
|
||||
|
||||
<div id="message" class="message"></div>
|
||||
|
||||
<!-- ESP-NOW (LED driver / bridge channel) -->
|
||||
<div class="settings-section">
|
||||
<h2>ESP-NOW</h2>
|
||||
<form id="espnow-form">
|
||||
<div class="form-group">
|
||||
<label for="wifi-channel-page-input">WiFi channel (ESP-NOW)</label>
|
||||
<input type="number" id="wifi-channel-page-input" name="wifi_channel" min="1" max="11" required>
|
||||
<small>STA channel (1–11) for LED drivers and the serial bridge. Use the same value on every device.</small>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-primary btn-full">Save channel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- WiFi Access Point Settings -->
|
||||
<div class="settings-section">
|
||||
<h2>WiFi Access Point Settings</h2>
|
||||
@@ -222,6 +237,46 @@
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
async function loadEspnowChannel() {
|
||||
try {
|
||||
const response = await fetch('/settings');
|
||||
const data = await response.json();
|
||||
const chInput = document.getElementById('wifi-channel-page-input');
|
||||
if (chInput && data && typeof data === 'object') {
|
||||
const ch = data.wifi_channel;
|
||||
chInput.value =
|
||||
ch !== undefined && ch !== null && ch !== '' ? String(ch) : '6';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error loading ESP-NOW channel:', error);
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('espnow-form').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
const chRaw = document.getElementById('wifi-channel-page-input').value;
|
||||
const wifiChannel = parseInt(chRaw, 10);
|
||||
if (Number.isNaN(wifiChannel) || wifiChannel < 1 || wifiChannel > 11) {
|
||||
showMessage('WiFi channel must be between 1 and 11', 'error');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const response = await fetch('/settings/settings', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ wifi_channel: wifiChannel }),
|
||||
});
|
||||
const result = await response.json();
|
||||
if (response.ok) {
|
||||
showMessage('ESP-NOW channel saved.', 'success');
|
||||
} else {
|
||||
showMessage(`Error: ${result.error || 'Failed to save'}`, 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
showMessage(`Error: ${error.message}`, 'error');
|
||||
}
|
||||
});
|
||||
|
||||
// Load AP status and config
|
||||
async function loadAPStatus() {
|
||||
try {
|
||||
@@ -299,6 +354,7 @@
|
||||
});
|
||||
|
||||
// Load all data on page load
|
||||
loadEspnowChannel();
|
||||
loadAPStatus();
|
||||
|
||||
// Refresh status every 10 seconds
|
||||
|
||||
Reference in New Issue
Block a user