You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The constructor was very long
I now changed it to a simple constructor where you just setup the desired button pin.
Then the user can simply select what callback it needs. No need anymore to setup ALL the callbacks before you can use this library.
_buttonCurrentState = BUTTON_STATE_WAITING; // Reset the button state ready for next press
249
-
_CallBackPressLongRelease();// This mode may have a release event to undo the prevously held state
289
+
if(_CallBackPressLongRelease) _CallBackPressLongRelease(); // This mode may have a release event to undo the prevously held state
250
290
}
251
291
break;
252
292
caseBUTTON_STATE_HOLD:
253
293
{
254
294
DEBUG_PRINT("\n_CallBackHoldRelease");
255
295
_isStartOfHold = true; // Reset _isStartOfHold so that is ready to accept the start on a new hold next time
256
296
_buttonCurrentState = BUTTON_STATE_WAITING; // Reset the button state ready for next press
257
-
_CallBackHoldRelease();// This mode may have a release event to undo the prevously held state
297
+
if(_CallBackHoldRelease) _CallBackHoldRelease(); // This mode may have a release event to undo the prevously held state
258
298
}
259
299
break;
260
300
caseBUTTON_STATE_SHIFT:
261
301
{
262
302
DEBUG_PRINT("\n_CallBackShiftRelease");
263
303
_isStartOfShift = true; // Reset _isStartOfShift so that is ready to accept the start on a new shift next time
264
304
_buttonCurrentState = BUTTON_STATE_WAITING; // This needs to be done before _CallBackShiftRelease otherwise isButtonInShiftMode() returns the wrong value when called in _CallBackShiftRelease
265
-
_CallBackShiftRelease(); // This callback allows a user set release event
305
+
if(_CallBackShiftRelease) _CallBackShiftRelease(); // This callback allows a user set release event
0 commit comments