Better antiglitch
This commit is contained in:
parent
016e37e009
commit
4fa0b9e1b0
1 changed files with 2 additions and 5 deletions
|
@ -62,11 +62,8 @@ static uint16_t get_status() {
|
||||||
static uint16_t graded_status() {
|
static uint16_t graded_status() {
|
||||||
uint16_t status = get_status();
|
uint16_t status = get_status();
|
||||||
|
|
||||||
// combine the bits of the last 3 states into one: "at least 2 of 3"
|
// combine the bits of the last 3 states into one: "3 successive ones"
|
||||||
uint16_t graded01 = status_hysteresis[0] & status_hysteresis[1];
|
uint16_t graded = status_hysteresis[0] & status_hysteresis[1] & status;
|
||||||
uint16_t graded1n = status_hysteresis[1] & status;
|
|
||||||
uint16_t gradedn0 = status & status_hysteresis[0];
|
|
||||||
uint16_t graded = graded01 | graded1n | gradedn0;
|
|
||||||
|
|
||||||
status_hysteresis[0] = status_hysteresis[1];
|
status_hysteresis[0] = status_hysteresis[1];
|
||||||
status_hysteresis[1] = status;
|
status_hysteresis[1] = status;
|
||||||
|
|
Loading…
Reference in a new issue