Fix keepalive not sent during zero-brightness suppression
When brightness source (e.g. Audio Volume) returned 0 during silence, the zero-brightness suppression path skipped all frames without sending DDP keepalive packets, causing WLED to exit live mode after ~2.5s. Now sends periodic keepalive even when suppressing zero-brightness frames. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -707,8 +707,24 @@ class WledTargetProcessor(TargetProcessor):
|
|||||||
cur_brightness = 0
|
cur_brightness = 0
|
||||||
|
|
||||||
# Zero-brightness suppression: if output is black and
|
# Zero-brightness suppression: if output is black and
|
||||||
# the last sent frame was also black, skip sending.
|
# the last sent frame was also black, skip sending
|
||||||
|
# (but still send periodic keepalive to hold DDP live mode).
|
||||||
if cur_brightness <= 1 and _prev_brightness <= 1 and has_any_frame:
|
if cur_brightness <= 1 and _prev_brightness <= 1 and has_any_frame:
|
||||||
|
if self._needs_keepalive and (loop_start - last_send_time) >= keepalive_interval:
|
||||||
|
if not self._is_running or self._led_client is None:
|
||||||
|
break
|
||||||
|
send_colors = _cached_brightness(
|
||||||
|
self._fit_to_device(prev_frame_ref, _total_leds),
|
||||||
|
cur_brightness,
|
||||||
|
)
|
||||||
|
if self._led_client.supports_fast_send:
|
||||||
|
self._led_client.send_pixels_fast(send_colors)
|
||||||
|
else:
|
||||||
|
await self._led_client.send_pixels(send_colors)
|
||||||
|
now = time.perf_counter()
|
||||||
|
last_send_time = now
|
||||||
|
send_timestamps.append(now)
|
||||||
|
self._metrics.frames_keepalive += 1
|
||||||
self._metrics.frames_skipped += 1
|
self._metrics.frames_skipped += 1
|
||||||
while send_timestamps and send_timestamps[0] < loop_start - 1.0:
|
while send_timestamps and send_timestamps[0] < loop_start - 1.0:
|
||||||
send_timestamps.popleft()
|
send_timestamps.popleft()
|
||||||
|
|||||||
Reference in New Issue
Block a user