only:docs

This commit is contained in:
Andrey 2023-06-15 17:40:24 -04:00
parent 86ce899026
commit 97b415436d
1 changed files with 2 additions and 0 deletions

View File

@ -80,6 +80,7 @@ void ButtonDebounce::startConfiguration () {
@returns true if the button is pressed, and will not return true again within the set timeout @returns true if the button is pressed, and will not return true again within the set timeout
*/ */
bool ButtonDebounce::readPinEvent() { bool ButtonDebounce::readPinEvent() {
// TRICKY: depending on which API you use (readPinEvent vs readPinState) same variable holds different kind of state
storedValue = false; storedValue = false;
return readPinState(); return readPinState();
} }
@ -91,6 +92,7 @@ bool ButtonDebounce::readPinState() {
efitick_t timeNowNt = getTimeNowNt(); efitick_t timeNowNt = getTimeNowNt();
// If it's been less than the threshold since we were last called // If it's been less than the threshold since we were last called
if (timeLast.getElapsedNt(timeNowNt) < m_threshold) { if (timeLast.getElapsedNt(timeNowNt) < m_threshold) {
// see 'TRICKY' comment in readPinEvent()
return storedValue; return storedValue;
} }
// storedValue is a class variable, so it needs to be reset. // storedValue is a class variable, so it needs to be reset.