Fix RGB lights
This commit is contained in:
@@ -75,6 +75,8 @@ class RGBLED:
|
||||
"""Sets the RGB color tuple (e.g., (255, 128, 0))."""
|
||||
if isinstance(rgb_tuple, (tuple, list)) and len(rgb_tuple) == 3:
|
||||
self._color = tuple(rgb_tuple)
|
||||
# Automatically turn LED on unless color is OFF (0,0,0)
|
||||
self._is_on = (self._color != self.OFF)
|
||||
self._apply()
|
||||
else:
|
||||
raise ValueError("Color must be a tuple of 3 integers: (R, G, B)")
|
||||
@@ -144,6 +146,7 @@ class RGBLED:
|
||||
if self._is_blinking:
|
||||
self._timer.deinit()
|
||||
self._is_blinking = False
|
||||
self.on() # Ensures LED remains ON steadily after blinking stops
|
||||
|
||||
def blink_toggle(self, interval_ms=500):
|
||||
"""Toggles blinking state (starts if stopped, stops if active)."""
|
||||
|
||||
Reference in New Issue
Block a user