From 808fa756d2c6bc26e508256b9b7db2aa083166f9 Mon Sep 17 00:00:00 2001 From: MichaelDvP <59284019+MichaelDvP@users.noreply.github.com> Date: Thu, 4 Mar 2021 19:34:53 +0100 Subject: [PATCH] Only pin 0 wait for vlongpress-release --- lib/PButton/PButon.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/PButton/PButon.cpp b/lib/PButton/PButon.cpp index b91e76067..bfffbff84 100644 --- a/lib/PButton/PButon.cpp +++ b/lib/PButton/PButon.cpp @@ -136,13 +136,13 @@ bool PButton::check(void) { dblClickWaiting_ = false; } - // added code: raise OnLongPress event when only when the button is released + // added code: raise OnLongPress event when the button is released if (state_ == pullMode_ && longPressHappened_ && !vLongPressHappened_) { resultEvent = 3; longPressHappened_ = false; } - // added code: raise OnLongPress event when only when the button is released + // added code: raise OnVLongPress event when the button is released, only for pin 0 if (state_ == pullMode_ && vLongPressHappened_) { resultEvent = 4; vLongPressHappened_ = false; @@ -164,7 +164,10 @@ bool PButton::check(void) { // Trigger "long" hold if ((millisRes - downTime_) >= VLongPressDelay_) { if (vLongPressHappened_ == false) { - // resultEvent = 4; + // raise OnVLongPress, only for pin 0 wait for release + if (pin_) { + resultEvent = 4; + } vLongPressHappened_ = true; // longPressHappened_ = false; }