WS2812 troubleshooting
This commit is contained in:
@@ -344,6 +344,7 @@ print(f"DEBUG: initializing NeoPixel on pin {BACKLIGHT_PIN} with {total_backligh
|
|||||||
leds_bl = NeoPixel(Pin(BACKLIGHT_PIN), total_backlight_leds)
|
leds_bl = NeoPixel(Pin(BACKLIGHT_PIN), total_backlight_leds)
|
||||||
print("DEBUG: NeoPixel initialized")
|
print("DEBUG: NeoPixel initialized")
|
||||||
|
|
||||||
|
print("DEBUG: about to init backlight arrays")
|
||||||
backlight_color = [(0, 0, 0) for _ in range(num_gauges)]
|
backlight_color = [(0, 0, 0) for _ in range(num_gauges)]
|
||||||
backlight_brightness = [100 for _ in range(num_gauges)]
|
backlight_brightness = [100 for _ in range(num_gauges)]
|
||||||
backlight_on = [False for _ in range(num_gauges)]
|
backlight_on = [False for _ in range(num_gauges)]
|
||||||
@@ -357,6 +358,8 @@ _BL_SAVE_DELAY_MS = 5000
|
|||||||
_disco_saved_brightness = [100] * num_gauges
|
_disco_saved_brightness = [100] * num_gauges
|
||||||
_disco_saved_color = [[0, 0, 0] for _ in range(num_gauges)]
|
_disco_saved_color = [[0, 0, 0] for _ in range(num_gauges)]
|
||||||
|
|
||||||
|
print("DEBUG: about to define functions")
|
||||||
|
|
||||||
|
|
||||||
def _flush_backlight(client):
|
def _flush_backlight(client):
|
||||||
for i in range(num_gauges):
|
for i in range(num_gauges):
|
||||||
@@ -471,6 +474,8 @@ _last_mqtt_check = 0
|
|||||||
|
|
||||||
_disco_end_time = 0
|
_disco_end_time = 0
|
||||||
|
|
||||||
|
print("DEBUG: about to define _publish")
|
||||||
|
|
||||||
|
|
||||||
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."""
|
||||||
@@ -635,6 +640,8 @@ def connect_mqtt():
|
|||||||
_mqtt_check_interval_ms = 30000
|
_mqtt_check_interval_ms = 30000
|
||||||
_last_mqtt_check = 0
|
_last_mqtt_check = 0
|
||||||
|
|
||||||
|
print("DEBUG: about to define check_mqtt")
|
||||||
|
|
||||||
|
|
||||||
def check_mqtt():
|
def check_mqtt():
|
||||||
global client_ref, _mqtt_connected, _last_mqtt_check
|
global client_ref, _mqtt_connected, _last_mqtt_check
|
||||||
@@ -692,6 +699,8 @@ def check_mqtt():
|
|||||||
log_err("MQTT reconnection failed after 3 attempts")
|
log_err("MQTT reconnection failed after 3 attempts")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
print("DEBUG: about to define publish_discovery")
|
||||||
|
|
||||||
|
|
||||||
def publish_discovery(client):
|
def publish_discovery(client):
|
||||||
"""Publish all HA MQTT discovery payloads for gauges and LEDs."""
|
"""Publish all HA MQTT discovery payloads for gauges and LEDs."""
|
||||||
|
|||||||
Reference in New Issue
Block a user