Hi, I want to detect long and short press in same button. Define "BUTTON_DETECTION_DELAY" can detect one delay. Let me know to detect more than two delays.
I think Nikita was onto the answer for you. Start a 3 second timer when the button is pushed. When the timer expires if the button is still pushed perform your system off actions. If the button released event occurs before the timer expires, cancel the timer and do your short button push actions.