Fix debounce (#1814)
* 1,2,4,7,9 * 6 * fix type mismatch * change field * comment * Revert "comment" This reverts commit f7ce8ed48d015490ed82d692270198817569b5a3. * Revert "Revert "comment"" This reverts commit 99f2d5cadcbf444bf58acf9e57a6fed61355d5be. * Revert "change field" This reverts commit 55ec050cd947696cdffccae6b29fe48d95ab5f17. * rename var * comments * use func in init * default values * remove redundant check * check * use bool * mark false when done * pointer * check GPIO_UNASSIGNED * wat * merge carnage * oops, accidentally downgraded submodule
This commit is contained in:
parent
2d771018e8
commit
181113ff17
|
@ -56,13 +56,17 @@ void ButtonDebounce::stopConfiguration () {
|
|||
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
|
||||
#ifndef EFI_UNIT_TEST
|
||||
brain_pin_markUnused(active_pin);
|
||||
needsInit = true;
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
}
|
||||
}
|
||||
|
||||
void ButtonDebounce::startConfiguration () {
|
||||
#ifndef EFI_UNIT_TEST
|
||||
efiSetPadMode("Button", *m_pin, getInputMode(*m_mode));
|
||||
if (needsInit) {
|
||||
efiSetPadMode("Button", *m_pin, getInputMode(*m_mode));
|
||||
needsInit = false;
|
||||
}
|
||||
#endif
|
||||
active_pin = *m_pin;
|
||||
active_mode = *m_mode;
|
||||
|
@ -77,7 +81,7 @@ bool ButtonDebounce::readPinEvent() {
|
|||
}
|
||||
|
||||
bool ButtonDebounce::readPinState() {
|
||||
if (!m_pin) {
|
||||
if (*m_pin == GPIO_UNASSIGNED) {
|
||||
return false;
|
||||
}
|
||||
efitick_t timeNow = getTimeNowNt();
|
||||
|
|
|
@ -33,4 +33,5 @@ private:
|
|||
bool initialized = false;
|
||||
ButtonDebounce *nextDebounce = nullptr;
|
||||
static ButtonDebounce* s_firstDebounce;
|
||||
bool needsInit = false;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue