From 4fa0b9e1b081c5ed71e1f8a2d81a1988d1983253 Mon Sep 17 00:00:00 2001 From: Gregor Riepl Date: Mon, 8 Feb 2021 16:28:38 +0100 Subject: [PATCH] Better antiglitch --- feedback/firmware/main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/feedback/firmware/main.c b/feedback/firmware/main.c index 992aa09..8eca023 100644 --- a/feedback/firmware/main.c +++ b/feedback/firmware/main.c @@ -62,11 +62,8 @@ static uint16_t get_status() { static uint16_t graded_status() { uint16_t status = get_status(); - // combine the bits of the last 3 states into one: "at least 2 of 3" - uint16_t graded01 = status_hysteresis[0] & status_hysteresis[1]; - uint16_t graded1n = status_hysteresis[1] & status; - uint16_t gradedn0 = status & status_hysteresis[0]; - uint16_t graded = graded01 | graded1n | gradedn0; + // combine the bits of the last 3 states into one: "3 successive ones" + uint16_t graded = status_hysteresis[0] & status_hysteresis[1] & status; status_hysteresis[0] = status_hysteresis[1]; status_hysteresis[1] = status;