Removing troubleshooting artifacts
This commit is contained in:
@@ -313,6 +313,40 @@ _bl_dirty_since = None
|
|||||||
_BL_SAVE_DELAY_MS = 5000
|
_BL_SAVE_DELAY_MS = 5000
|
||||||
|
|
||||||
|
|
||||||
|
def set_backlight_color(i, r, g, b, brightness):
|
||||||
|
backlight_color[i] = (r, g, b)
|
||||||
|
backlight_brightness[i] = brightness
|
||||||
|
backlight_on[i] = True
|
||||||
|
_update_backlight(i)
|
||||||
|
|
||||||
|
|
||||||
|
def set_backlight_brightness(i, brightness):
|
||||||
|
backlight_brightness[i] = brightness
|
||||||
|
backlight_on[i] = brightness > 0
|
||||||
|
_update_backlight(i)
|
||||||
|
|
||||||
|
|
||||||
|
def set_status_led(i, color, state):
|
||||||
|
if color == "red":
|
||||||
|
status_led_red[i] = state
|
||||||
|
idx = i * (BACKLIGHT_LEDS_PER_GAUGE + STATUS_LEDS_PER_GAUGE) + BACKLIGHT_LEDS_PER_GAUGE
|
||||||
|
else:
|
||||||
|
status_led_green[i] = state
|
||||||
|
idx = i * (BACKLIGHT_LEDS_PER_GAUGE + STATUS_LEDS_PER_GAUGE) + BACKLIGHT_LEDS_PER_GAUGE + 1
|
||||||
|
leds_bl[idx] = (255 if state else 0, 0, 0) if color == "red" else (0, 255 if state else 0, 0)
|
||||||
|
leds_bl.write()
|
||||||
|
|
||||||
|
|
||||||
|
def _update_backlight(i):
|
||||||
|
r, g, b = backlight_color[i]
|
||||||
|
br = backlight_brightness[i]
|
||||||
|
scaled_br = (br * 255 + 127) // 100
|
||||||
|
base = i * (BACKLIGHT_LEDS_PER_GAUGE + STATUS_LEDS_PER_GAUGE)
|
||||||
|
for j in range(BACKLIGHT_LEDS_PER_GAUGE):
|
||||||
|
leds_bl[base + j] = (g if j < 2 else b, r if j < 1 else g, b)
|
||||||
|
leds_bl.write()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _publish(topic, payload, retain=False):
|
def _publish(topic, payload, retain=False):
|
||||||
"""Safely publish MQTT message, returning True on success."""
|
"""Safely publish MQTT message, returning True on success."""
|
||||||
|
|||||||
Reference in New Issue
Block a user