X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=tinyboard.git;a=blobdiff_plain;f=projects%2Fstep-up%2Fbuttons.c;h=a25379734db3fa868770d873edbc230c2633cebd;hp=b03a8162600314684e77aa14884f9d331726aa96;hb=HEAD;hpb=fa1f7d30307b72620fc766db4f4aade13bb8d1b5 diff --git a/projects/step-up/buttons.c b/projects/step-up/buttons.c index b03a816..a253797 100644 --- a/projects/step-up/buttons.c +++ b/projects/step-up/buttons.c @@ -7,9 +7,9 @@ #include "lights.h" #define WAKEUP_LIMIT 5 // times 100 ms -#define SHORT_PRESS_MIN 10 // in jiffies (100 Hz ticks) -#define SHORT_PRESS_MAX 50 -#define LONG_PRESS_MIN 100 +#define SHORT_PRESS_MIN 2 // in jiffies (16 Hz ticks) +#define SHORT_PRESS_MAX 5 +#define LONG_PRESS_MIN 10 static uint16_t button_start; static unsigned char prev_state; @@ -67,7 +67,7 @@ void timer_check_buttons() } else if (!cur && prev) { // --- just released --- uint16_t duration = jiffies - button_start; - if (duration > SHORT_PRESS_MIN && duration < SHORT_PRESS_MAX) { + if (duration >= SHORT_PRESS_MIN && duration < SHORT_PRESS_MAX) { short_press(); } else if (duration > LONG_PRESS_MIN) { // set_status_led(button, NULL);