From b7670d1e24382486c0ed78bced2b2c8c7b59e12c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Thu, 11 Aug 2022 14:13:24 +0200 Subject: [PATCH] app: minor, calibrate dial steps --- application.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application.c b/application.c index eb8b730..aaa3d36 100644 --- a/application.c +++ b/application.c @@ -83,8 +83,8 @@ static bool drv8825_reached = false; /**< set when the goal is reached */ // dials position info #define DIAL_SWITCH_PIN PB4 /**< pin connected to reed switch, connected to ground when the hour dial is nearby */ -#define DIAL_CYCLE_STEPS 11904U /**< number of steps for the hour dial to make a round */ -#define DIAL_MIDNIGHT_STEPS 6557U /**< number of steps after dial detection for dials to show midnight */ +#define DIAL_CYCLE_STEPS 4200U /**< number of steps for the hour dial to make a round */ +#define DIAL_MIDNIGHT_STEPS 3207U /**< number of steps after dial detection for dials to show midnight */ static volatile uint32_t dial_steps = 0; /**< set to drv8825_steps when dial is nearby */ #define WSMATRIX_HEIGHT (2 * 8) /**< WS2812b panel height, in pixels */ @@ -1233,7 +1233,7 @@ void GPIO_EXTI_ISR(DIAL_SWITCH_PIN)(void) if (gpio_get(GPIO_PORT(DIAL_SWITCH_PIN), GPIO_PIN(DIAL_SWITCH_PIN))) { // be sure the pin is actually low return; } - if (drv8825_steps > dial_steps + 1000) { // ignore going away debounce + if (drv8825_steps > DIAL_CYCLE_STEPS / 4) { // ignore going away debounce dial_steps = drv8825_steps; // remember on which step we are drv8825_steps = 0; // restart step counter }