From 5908fd5cecb257a18e37d55fae55d846c5dcffa8 Mon Sep 17 00:00:00 2001 From: Florian Baumann Date: Mon, 11 Aug 2014 14:12:32 +0200 Subject: [PATCH] Fix reseting CHDK pin to LOW chdkActive was set to false regardless of (millis() - chdkHigh) being bigger than the CHDK_DELAY or not. So if (millis() - chdkHigh) wasn't bigger than the delay the first time, the CHDK would never be set back to LOW. Also, don't return from the function, as there might be other stuff to do, after the CHDK check. --- Marlin/Marlin_main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index b373e2213..b1c9e4d3c 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3516,10 +3516,9 @@ void manage_inactivity() } #ifdef CHDK //Check if pin should be set to LOW after M240 set it to HIGH - if (chdkActive) + if (chdkActive && (millis() - chdkHigh > CHDK_DELAY)) { chdkActive = false; - if (millis()-chdkHigh < CHDK_DELAY) return; WRITE(CHDK, LOW); } #endif