diff --git a/src/OneButton.cpp b/src/OneButton.cpp index 20ea529..17aa967 100644 --- a/src/OneButton.cpp +++ b/src/OneButton.cpp @@ -269,9 +269,9 @@ void OneButton::_fsm(bool activeLevel) { _startTime = now; // remember starting time } else if (waitTime > _press_ms) { + _newState(OneButton::OCS_PRESS); if (_longPressStartFunc) _longPressStartFunc(); if (_paramLongPressStartFunc) _paramLongPressStartFunc(_longPressStartFuncParam); - _newState(OneButton::OCS_PRESS); } // if break; diff --git a/src/OneButtonTiny.cpp b/src/OneButtonTiny.cpp index 88da31f..50108d9 100644 --- a/src/OneButtonTiny.cpp +++ b/src/OneButtonTiny.cpp @@ -157,8 +157,8 @@ void OneButtonTiny::_fsm(bool activeLevel) { _startTime = now; // remember starting time } else if ((activeLevel) && (waitTime > _press_ms)) { - if (_longPressStartFunc) _longPressStartFunc(); _newState(OneButtonTiny::OCS_PRESS); + if (_longPressStartFunc) _longPressStartFunc(); } // if break;