From 940d1d0a77b8a80543ccce54d0e60bebd9269332 Mon Sep 17 00:00:00 2001 From: jimmy Date: Tue, 27 Oct 2026 22:30:26 +1300 Subject: [PATCH] fix(espnow): start ESP-NOW before the pattern library on boot On the ESP32-C3 the radio tasks failed to start (Wifi Unknown Error 0x0101) on about every other cold boot once the link and beat modules were loaded. Bringing ESP-NOW up before the pattern library and the LED driver claim memory made 6 of 6 cold boots start cleanly. Co-Authored-By: Claude Sonnet 5.5 --- src/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index e2332dd..465399f 100644 --- a/src/main.py +++ b/src/main.py @@ -26,6 +26,10 @@ dg.load_from_settings(settings) print(settings) gc.collect() +# Bring Wi-Fi up before the pattern library and the LED driver claim memory: on the ESP32-C3 the radio +# tasks otherwise fail to start on about every other cold boot (Wifi Unknown Error 0x0101) +esp = init_espnow(settings) + presets = Presets(settings["led_pin"], settings["num_leds"]) presets.load(settings) presets.b = settings.get("brightness", 255) @@ -34,7 +38,6 @@ gc.collect() apply_startup_pattern(settings, presets) -esp = init_espnow(settings) print(network.WLAN(network.STA_IF).config("channel")) hello = json.dumps({