From a7543cf8a420db4548cf66d1a40e9721ebdf7cb6 Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Sat, 24 Jan 2026 17:11:39 +0100 Subject: [PATCH] turn on relay on first call to handleIO() if LEDs are on --- wled00/button.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wled00/button.cpp b/wled00/button.cpp index f6a07f5107..393f928cb8 100644 --- a/wled00/button.cpp +++ b/wled00/button.cpp @@ -368,8 +368,7 @@ void handleIO() // if we want to control on-board LED (ESP8266) or relay we have to do it here as the final show() may not happen until // next loop() cycle if (strip.getBrightness()) { - lastOnTime = millis(); - if (offMode) { + if (offMode || lastOnTime == 0) { BusManager::on(); if (rlyPin>=0) { pinMode(rlyPin, rlyOpenDrain ? OUTPUT_OPEN_DRAIN : OUTPUT); @@ -378,6 +377,7 @@ void handleIO() } offMode = false; } + lastOnTime = millis(); } else if (millis() - lastOnTime > 600 && !strip.needsUpdate()) { // for turning LED or relay off we need to wait until strip no longer needs updates (strip.trigger()) if (!offMode) {