Add LED skip start/end, rename standby_interval to keepalive_interval, remove migrations
LED skip: set first N and last M LEDs to black on a target. Color sources (static, gradient, effect, color cycle) render across only the active (non-skipped) LEDs. Processor pads with blacks before sending to device. Rename standby_interval → keepalive_interval across all Python, API schemas, and JS. from_dict falls back to old key for existing configs. Remove legacy migration functions (_migrate_devices_to_targets, _migrate_targets_to_color_strips) and legacy fields from target model. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -95,8 +95,10 @@ def _target_to_response(target) -> PictureTargetResponse:
|
||||
device_id=target.device_id,
|
||||
color_strip_source_id=target.color_strip_source_id,
|
||||
fps=target.fps,
|
||||
standby_interval=target.standby_interval,
|
||||
keepalive_interval=target.keepalive_interval,
|
||||
state_check_interval=target.state_check_interval,
|
||||
led_skip_start=target.led_skip_start,
|
||||
led_skip_end=target.led_skip_end,
|
||||
description=target.description,
|
||||
created_at=target.created_at,
|
||||
updated_at=target.updated_at,
|
||||
@@ -150,8 +152,10 @@ async def create_target(
|
||||
device_id=data.device_id,
|
||||
color_strip_source_id=data.color_strip_source_id,
|
||||
fps=data.fps,
|
||||
standby_interval=data.standby_interval,
|
||||
keepalive_interval=data.keepalive_interval,
|
||||
state_check_interval=data.state_check_interval,
|
||||
led_skip_start=data.led_skip_start,
|
||||
led_skip_end=data.led_skip_end,
|
||||
picture_source_id=data.picture_source_id,
|
||||
key_colors_settings=kc_settings,
|
||||
description=data.description,
|
||||
@@ -264,8 +268,10 @@ async def update_target(
|
||||
device_id=data.device_id,
|
||||
color_strip_source_id=data.color_strip_source_id,
|
||||
fps=data.fps,
|
||||
standby_interval=data.standby_interval,
|
||||
keepalive_interval=data.keepalive_interval,
|
||||
state_check_interval=data.state_check_interval,
|
||||
led_skip_start=data.led_skip_start,
|
||||
led_skip_end=data.led_skip_end,
|
||||
picture_source_id=data.picture_source_id,
|
||||
key_colors_settings=kc_settings,
|
||||
description=data.description,
|
||||
@@ -276,8 +282,10 @@ async def update_target(
|
||||
target.sync_with_manager(
|
||||
manager,
|
||||
settings_changed=(data.fps is not None or
|
||||
data.standby_interval is not None or
|
||||
data.keepalive_interval is not None or
|
||||
data.state_check_interval is not None or
|
||||
data.led_skip_start is not None or
|
||||
data.led_skip_end is not None or
|
||||
data.key_colors_settings is not None),
|
||||
source_changed=data.color_strip_source_id is not None,
|
||||
device_changed=data.device_id is not None,
|
||||
|
||||
@@ -54,8 +54,10 @@ class PictureTargetCreate(BaseModel):
|
||||
device_id: str = Field(default="", description="LED device ID")
|
||||
color_strip_source_id: str = Field(default="", description="Color strip source ID")
|
||||
fps: int = Field(default=30, ge=1, le=90, description="Target send FPS (1-90)")
|
||||
standby_interval: float = Field(default=1.0, description="Keepalive send interval when screen is static (0.5-5.0s)", ge=0.5, le=5.0)
|
||||
keepalive_interval: float = Field(default=1.0, description="Keepalive send interval when screen is static (0.5-5.0s)", ge=0.5, le=5.0)
|
||||
state_check_interval: int = Field(default=DEFAULT_STATE_CHECK_INTERVAL, description="Device health check interval (5-600s)", ge=5, le=600)
|
||||
led_skip_start: int = Field(default=0, ge=0, description="Number of LEDs at the start to keep black")
|
||||
led_skip_end: int = Field(default=0, ge=0, description="Number of LEDs at the end to keep black")
|
||||
# KC target fields
|
||||
picture_source_id: str = Field(default="", description="Picture source ID (for key_colors targets)")
|
||||
key_colors_settings: Optional[KeyColorsSettingsSchema] = Field(None, description="Key colors settings (for key_colors targets)")
|
||||
@@ -70,8 +72,10 @@ class PictureTargetUpdate(BaseModel):
|
||||
device_id: Optional[str] = Field(None, description="LED device ID")
|
||||
color_strip_source_id: Optional[str] = Field(None, description="Color strip source ID")
|
||||
fps: Optional[int] = Field(None, ge=1, le=90, description="Target send FPS (1-90)")
|
||||
standby_interval: Optional[float] = Field(None, description="Keepalive interval (0.5-5.0s)", ge=0.5, le=5.0)
|
||||
keepalive_interval: Optional[float] = Field(None, description="Keepalive interval (0.5-5.0s)", ge=0.5, le=5.0)
|
||||
state_check_interval: Optional[int] = Field(None, description="Health check interval (5-600s)", ge=5, le=600)
|
||||
led_skip_start: Optional[int] = Field(None, ge=0, description="Number of LEDs at the start to keep black")
|
||||
led_skip_end: Optional[int] = Field(None, ge=0, description="Number of LEDs at the end to keep black")
|
||||
# KC target fields
|
||||
picture_source_id: Optional[str] = Field(None, description="Picture source ID (for key_colors targets)")
|
||||
key_colors_settings: Optional[KeyColorsSettingsSchema] = Field(None, description="Key colors settings (for key_colors targets)")
|
||||
@@ -88,8 +92,10 @@ class PictureTargetResponse(BaseModel):
|
||||
device_id: str = Field(default="", description="LED device ID")
|
||||
color_strip_source_id: str = Field(default="", description="Color strip source ID")
|
||||
fps: Optional[int] = Field(None, description="Target send FPS")
|
||||
standby_interval: float = Field(default=1.0, description="Keepalive interval (s)")
|
||||
keepalive_interval: float = Field(default=1.0, description="Keepalive interval (s)")
|
||||
state_check_interval: int = Field(default=DEFAULT_STATE_CHECK_INTERVAL, description="Health check interval (s)")
|
||||
led_skip_start: int = Field(default=0, description="LEDs skipped at start")
|
||||
led_skip_end: int = Field(default=0, description="LEDs skipped at end")
|
||||
# KC target fields
|
||||
picture_source_id: str = Field(default="", description="Picture source ID (key_colors)")
|
||||
key_colors_settings: Optional[KeyColorsSettingsSchema] = Field(None, description="Key colors settings")
|
||||
|
||||
Reference in New Issue
Block a user