Add button support as input

This commit is contained in:
Mykhailo Khulap
2018-09-27 07:34:09 +03:00
parent ae2187de84
commit 7742747d5d
2 changed files with 15 additions and 7 deletions

View File

@@ -306,7 +306,15 @@ void Input::contactPoll() {
if (store->bounce) store->bounce = store->bounce - 1;
else //confirmed change
{
onContactChanged(currentInputState);
if (inType & IN_PUSH_TOGGLE) {
if (currentInputState) { //react on leading edge only (change from 0 to 1)
store->logicState = !store->logicState;
onContactChanged(store->logicState);
}
} else {
store->logicState = currentInputState;
onContactChanged(currentInputState);
}
store->currentValue = currentInputState;
}
} else // no change