diff --git a/armsrc/ticks.c b/armsrc/ticks.c index 1a8d2f8a7..1a726975f 100644 --- a/armsrc/ticks.c +++ b/armsrc/ticks.c @@ -28,7 +28,7 @@ void SpinDelayUs(int us) { for (;;) { uint16_t now = AT91C_BASE_PWMC_CH0->PWMC_CCNTR; - if (now >= (uint16_t)(start + ticks)) + if (now == (uint16_t)(start + ticks)) return; WDT_HIT(); diff --git a/armsrc/util.c b/armsrc/util.c index a5245e356..2fe449942 100644 --- a/armsrc/util.c +++ b/armsrc/util.c @@ -216,7 +216,7 @@ int BUTTON_CLICKED(int ms) { // Still haven't let it off else // Have we held down a full second? - if (now >= (uint16_t)(start + ticks)) + if (now == (uint16_t)(start + ticks)) return BUTTON_HOLD; } @@ -227,7 +227,7 @@ int BUTTON_CLICKED(int ms) { return BUTTON_DOUBLE_CLICK; // Have we ran out of time to double click? - else if (now >= (uint16_t)(start + ticks)) + else if (now == (uint16_t)(start + ticks)) // At least we did a single click return BUTTON_SINGLE_CLICK; @@ -271,7 +271,7 @@ int BUTTON_HELD(int ms) { return BUTTON_SINGLE_CLICK; // Have we waited the full second? - else if (now >= (uint16_t)(start + ticks)) + else if (now == (uint16_t)(start + ticks)) return BUTTON_HOLD; WDT_HIT();