Fix flux_led turn on when brightness is zero on newer devices (#64129)
This commit is contained in:
parent
2d5fe93cb2
commit
b273c37d2b
3 changed files with 298 additions and 16 deletions
|
@ -52,3 +52,26 @@ def _str_to_multi_color_effect(effect_str: str) -> MultiColorEffects:
|
|||
return effect
|
||||
# unreachable due to schema validation
|
||||
assert False # pragma: no cover
|
||||
|
||||
|
||||
def _min_rgb_brightness(rgb: tuple[int, int, int]) -> tuple[int, int, int]:
|
||||
"""Ensure the RGB value will not turn off the device from a turn on command."""
|
||||
if all(byte == 0 for byte in rgb):
|
||||
return (1, 1, 1)
|
||||
return rgb
|
||||
|
||||
|
||||
def _min_rgbw_brightness(rgbw: tuple[int, int, int, int]) -> tuple[int, int, int, int]:
|
||||
"""Ensure the RGBW value will not turn off the device from a turn on command."""
|
||||
if all(byte == 0 for byte in rgbw):
|
||||
return (1, 1, 1, 0)
|
||||
return rgbw
|
||||
|
||||
|
||||
def _min_rgbwc_brightness(
|
||||
rgbwc: tuple[int, int, int, int, int]
|
||||
) -> tuple[int, int, int, int, int]:
|
||||
"""Ensure the RGBWC value will not turn off the device from a turn on command."""
|
||||
if all(byte == 0 for byte in rgbwc):
|
||||
return (1, 1, 1, 0, 0)
|
||||
return rgbwc
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue