Troubleshooting

This commit is contained in:
2026-04-12 02:42:07 +02:00
parent 179f202dfe
commit 6209cb0b2d

View File

@@ -155,6 +155,7 @@ BL_UNIT = _cfg.get("backlight_unit", "%")
# Gauge initialization
# ---------------------------------------------------------------------------
info("Initialising gauge objects...")
gauge_objects = []
for g in gauges:
gauge_objects.append(
@@ -169,6 +170,7 @@ for g in gauges:
info(
f"Gauge {g['id']}: {g['name']} pins={g['pins']} mode={g['mode']} range=[{g['min']}, {g['max']}]"
)
info("Gauge objects done")
gauge_targets = [g["min"] for g in gauges] # target value per gauge
gauge_last_rezero = [utime.ticks_ms() for _ in gauges]
@@ -318,6 +320,7 @@ def check_wifi():
# LEDs (per gauge)
# ---------------------------------------------------------------------------
info("Initialising LEDs...")
num_gauges = len(gauges)
leds_red = []
leds_green = []
@@ -327,11 +330,13 @@ for g in gauges:
leds_green.append(Pin(g["green_pin"], Pin.OUT, value=0))
total_backlight_leds = num_gauges * (BACKLIGHT_LEDS_PER_GAUGE + STATUS_LEDS_PER_GAUGE)
info(f"Total backlight LEDs: {total_backlight_leds}")
leds_bl = (
NeoPixel(Pin(BACKLIGHT_PIN), total_backlight_leds)
if total_backlight_leds > 0
else None
)
info("LEDs done")
backlight_color = [(0, 0, 0) for _ in range(num_gauges)]
backlight_brightness = [100 for _ in range(num_gauges)]
@@ -819,21 +824,29 @@ def publish_state(client):
def main():
utime.sleep_ms(0)
info("=" * 48)
info("Gauge MQTT controller starting")
info("=" * 48)
info("Connecting WiFi...")
connect_wifi(WIFI_SSID, WIFI_PASSWORD)
info("WiFi done")
info("Zeroing gauges on startup ...")
for i, g in enumerate(gauge_objects):
g.zero()
info(f"Zeroed gauge {i}")
info("Zero complete")
info("Zero done")
info("Connecting MQTT...")
connect_mqtt()
info("MQTT done")
info("Publishing discovery...")
publish_discovery(client_ref)
publish_state(client_ref)
info("Discovery done")
info("Entering main loop")
info("-" * 48)