Просмотр исходного кода

[fix]修复短按->长按按键误触发按下事件

Signed-off-by: jaffer <jaffer.work@foxmail.com>

涉及到PR/Issues:

https://github.com/0x1abin/MultiButton/pull/39
https://github.com/0x1abin/MultiButton/pull/36
https://github.com/0x1abin/MultiButton/issues/24

Signed-off-by: Meco Man <920369182@qq.com>
jaffer 3 лет назад
Родитель
Сommit
235c9e602d
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      multi_button.c

+ 2 - 2
multi_button.c

@@ -169,9 +169,9 @@ static void button_handler(struct button* handle)
                 handle->state = 0;
                 handle->state = 0;
             }
             }
         }
         }
-        else if(handle->ticks > SHORT_TICKS)
+        else if(handle->ticks > SHORT_TICKS) // SHORT_TICKS < press down hold time < LONG_TICKS
         {
         {
-            handle->state = 0;
+            handle->state = 1;
         }
         }
         break;
         break;