Fix WLED LED stutters: restore DDP PUSH flag, skip HTTP during streaming

Three changes to eliminate periodic LED stutters on high-LED-count
WLED devices:

1. DDP PUSH flag: re-enable on the last packet of each frame so WLED
   waits for the complete frame before rendering (prevents tearing
   from partial multi-packet frames).

2. Health check: skip HTTP probe while a target is actively streaming
   to the device — the device is clearly online and the HTTP request
   to the ESP causes LED output to stutter.

3. Brightness polling: cache the value after first fetch and reuse it
   on subsequent 2-second UI refreshes instead of hitting the ESP
   every cycle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 16:48:08 +03:00
parent afb20f2dac
commit 350dafb1e8
3 changed files with 34 additions and 6 deletions

View File

@@ -4562,7 +4562,21 @@ async function loadTargetsTab() {
devicesWithState.forEach(device => {
attachDeviceListeners(device.id);
if ((device.capabilities || []).includes('brightness_control')) {
fetchDeviceBrightness(device.id);
// Only fetch from device if we don't have a cached value yet —
// avoids HTTP requests to the ESP every 2s which cause LED stutters
if (device.id in _deviceBrightnessCache) {
const bri = _deviceBrightnessCache[device.id];
const slider = document.querySelector(`[data-device-brightness="${device.id}"]`);
if (slider) {
slider.value = bri;
slider.title = Math.round(bri / 255 * 100) + '%';
slider.disabled = false;
}
const wrap = document.querySelector(`[data-brightness-wrap="${device.id}"]`);
if (wrap) wrap.classList.remove('brightness-loading');
} else {
fetchDeviceBrightness(device.id);
}
}
});