From 542ee83c044b276ec424db97ccf844db1fd8e9d3 Mon Sep 17 00:00:00 2001 From: Dirk Jahnke Date: Fri, 2 Feb 2018 14:16:34 +0100 Subject: [PATCH] Fixed button handler --- src/buttonHandler.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/buttonHandler.c b/src/buttonHandler.c index 4d18032..41d90ec 100644 --- a/src/buttonHandler.c +++ b/src/buttonHandler.c @@ -2,9 +2,10 @@ #include "mgos_gpio.h" #include "mgos_timers.h" #include "buttonHandler.h" +#include -#define ON_BOARD_BUTTON_PIN 5 -#define MAX_TIME_BETWEEN_MULTIPLE_BUTTON_PRESS_EVENTS 200 +#define ON_BOARD_BUTTON_PIN 0 +#define MAX_TIME_BETWEEN_MULTIPLE_BUTTON_PRESS_EVENTS 0.3 /* seconds */ static double lastButtonPressTime = 0; static uint8_t buttonPressCounter = 0; @@ -31,7 +32,7 @@ void add_button_press_callback(int numberPressed, button_press_callback cb) { static void multiPressButtonHandler(void *arg) { (void) arg; - LOG(LL_DEBUG, ("multiPressButtonHandler called after %d presses", buttonPressCounter)); + LOG(LL_DEBUG, ("multiPressButtonHandler called after %d presses, uptime=%f", buttonPressCounter, mgos_uptime())); multiPressTimerId = 0; // timer used only once, thus we clear it for (int i=0; i