Show edge test colors on LED device when overlay is active

Lights up device LEDs with calibration edge colors (top=red, right=green,
bottom=blue, left=yellow) when the overlay is started, and clears them when
the overlay is stopped. Skips if the target is currently processing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 14:39:37 +03:00
parent bef28ece5c
commit ff4e054ef8

View File

@@ -453,16 +453,38 @@ class ProcessorManager:
# ===== OVERLAY VISUALIZATION (delegates to processor) ===== # ===== OVERLAY VISUALIZATION (delegates to processor) =====
# Default edge colors for overlay LED test (same as frontend EDGE_TEST_COLORS)
_OVERLAY_EDGE_COLORS = {
"top": [255, 0, 0],
"right": [0, 255, 0],
"bottom": [0, 100, 255],
"left": [255, 255, 0],
}
async def start_overlay(self, target_id: str, target_name: str = None) -> None: async def start_overlay(self, target_id: str, target_name: str = None) -> None:
proc = self._get_processor(target_id) proc = self._get_processor(target_id)
if not proc.supports_overlay(): if not proc.supports_overlay():
raise ValueError(f"Target {target_id} does not support overlays") raise ValueError(f"Target {target_id} does not support overlays")
await proc.start_overlay(target_name) await proc.start_overlay(target_name)
# Light up device LEDs with edge test colors while overlay is visible
if isinstance(proc, WledTargetProcessor) and not proc.is_running:
try:
await self.set_test_mode(proc.device_id, self._OVERLAY_EDGE_COLORS)
except Exception as e:
logger.warning(f"Failed to set edge test for overlay on {proc.device_id}: {e}")
async def stop_overlay(self, target_id: str) -> None: async def stop_overlay(self, target_id: str) -> None:
proc = self._get_processor(target_id) proc = self._get_processor(target_id)
await proc.stop_overlay() await proc.stop_overlay()
# Clear device LEDs when overlay is dismissed
if isinstance(proc, WledTargetProcessor) and not proc.is_running:
try:
await self.set_test_mode(proc.device_id, {})
except Exception as e:
logger.warning(f"Failed to clear edge test after overlay on {proc.device_id}: {e}")
def is_overlay_active(self, target_id: str) -> bool: def is_overlay_active(self, target_id: str) -> bool:
return self._get_processor(target_id).is_overlay_active() return self._get_processor(target_id).is_overlay_active()