From ef0edff0d6b08565251292273f2c57d4a5c7de62 Mon Sep 17 00:00:00 2001 From: GwynBleidD Date: Sun, 29 Sep 2024 16:05:01 +0200 Subject: [PATCH] fix: First open/error timeout firing immediately. First timeout for opening door or indicating error was firing immediately due to interrupt flag being set after the boot. This also improves stability of quick subsequent reads, as the interrupt flag is now cleared before enabling the interrupt. --- Core/Src/wiegand.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/Src/wiegand.c b/Core/Src/wiegand.c index 9979766..9b6a71c 100644 --- a/Core/Src/wiegand.c +++ b/Core/Src/wiegand.c @@ -205,6 +205,7 @@ void canpybara_wiegand_zone_response(uint8_t response) } __HAL_TIM_SET_COUNTER(&htim3, 0); + __HAL_TIM_CLEAR_FLAG(&htim3, TIM_FLAG_UPDATE); HAL_TIM_Base_Start_IT(&htim3); }