Move FPS from color strip source to target; dynamic capture rate

FPS is a consumption property (how fast to send to a device), not a
production property. Two targets sharing the same source may need
different FPS. This moves the fps field from PictureColorStripSource
to WledPictureTarget across the full stack.

The capture stream now auto-adjusts its rate to max(all connected
target FPS values) via ColorStripStreamManager tracking per-consumer
FPS. UI updates: FPS slider in target editor, FPS badge on target
cards, LED count repositioned in CSS editor, consistent speed icons.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-21 03:46:08 +03:00
parent 1204676c30
commit 1f6c913343
14 changed files with 126 additions and 57 deletions

View File

@@ -13,13 +13,13 @@ DEFAULT_STATE_CHECK_INTERVAL = 30 # seconds
class WledPictureTarget(PictureTarget):
"""LED picture target — pairs an LED device with a ColorStripSource.
The ColorStripSource encapsulates everything needed to produce LED colors
(calibration, color correction, smoothing, fps). The LED target itself only
holds device-specific timing/keepalive settings.
The ColorStripSource produces LED colors (calibration, color correction,
smoothing). The target controls device-specific settings including send FPS.
"""
device_id: str = ""
color_strip_source_id: str = ""
fps: int = 30 # target send FPS (10-90)
standby_interval: float = 1.0 # seconds between keepalive sends when screen is static
state_check_interval: int = DEFAULT_STATE_CHECK_INTERVAL
@@ -34,6 +34,7 @@ class WledPictureTarget(PictureTarget):
target_id=self.id,
device_id=self.device_id,
color_strip_source_id=self.color_strip_source_id,
fps=self.fps,
standby_interval=self.standby_interval,
state_check_interval=self.state_check_interval,
)
@@ -42,6 +43,7 @@ class WledPictureTarget(PictureTarget):
"""Push changed fields to the processor manager."""
if settings_changed:
manager.update_target_settings(self.id, {
"fps": self.fps,
"standby_interval": self.standby_interval,
"state_check_interval": self.state_check_interval,
})
@@ -51,7 +53,7 @@ class WledPictureTarget(PictureTarget):
manager.update_target_device(self.id, self.device_id)
def update_fields(self, *, name=None, device_id=None, color_strip_source_id=None,
standby_interval=None, state_check_interval=None,
fps=None, standby_interval=None, state_check_interval=None,
# Legacy params accepted but ignored to keep base class compat:
picture_source_id=None, settings=None,
key_colors_settings=None, description=None) -> None:
@@ -61,6 +63,8 @@ class WledPictureTarget(PictureTarget):
self.device_id = device_id
if color_strip_source_id is not None:
self.color_strip_source_id = color_strip_source_id
if fps is not None:
self.fps = fps
if standby_interval is not None:
self.standby_interval = standby_interval
if state_check_interval is not None:
@@ -75,6 +79,7 @@ class WledPictureTarget(PictureTarget):
d = super().to_dict()
d["device_id"] = self.device_id
d["color_strip_source_id"] = self.color_strip_source_id
d["fps"] = self.fps
d["standby_interval"] = self.standby_interval
d["state_check_interval"] = self.state_check_interval
return d
@@ -88,6 +93,7 @@ class WledPictureTarget(PictureTarget):
target_type="led",
device_id=data.get("device_id", ""),
color_strip_source_id=data.get("color_strip_source_id", ""),
fps=data.get("fps", 30),
standby_interval=data.get("standby_interval", 1.0),
state_check_interval=data.get("state_check_interval", DEFAULT_STATE_CHECK_INTERVAL),
description=data.get("description"),