From c85d2cc38aba14a68d57ea437387f26d62c50429 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 3 Aug 2022 15:05:38 -0400 Subject: [PATCH] bootentry: Don't consider a reset in less than 10ms a double click Signed-off-by: Kevin O'Connor --- src/bootentry.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bootentry.c b/src/bootentry.c index 3ed5ef3..e83ee96 100644 --- a/src/bootentry.c +++ b/src/bootentry.c @@ -28,18 +28,22 @@ check_button_pressed(void) return gpio_in_read(button) == button_high; } +#define DOUBLE_CLICK_MIN_US 10000 +#define DOUBLE_CLICK_MAX_US 500000 + // Check for a bootloader request via double tap of reset button static void check_double_reset(void) { if (!CONFIG_ENABLE_DOUBLE_RESET) return; - // set request signature and delay for two seconds. This enters the bootloader if + // Set request signature and delay - this enters the bootloader if // the reset button is double clicked + udelay(DOUBLE_CLICK_MIN_US); set_bootup_code(REQUEST_CANBOOT); - udelay(500000); + udelay(DOUBLE_CLICK_MAX_US - DOUBLE_CLICK_MIN_US); + // No reset, clear the bootup code set_bootup_code(0); - // No reset, read the key back out to clear it } // Check if bootloader or application should be started