Skip to content

Commit

Permalink
Fix reseting CHDK pin to LOW
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DerFlob committed Aug 11, 2014
1 parent c13a831 commit 5908fd5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5908fd5

Please sign in to comment.