Antiglitch, try 3
This commit is contained in:
parent
4fa0b9e1b0
commit
b0d91e6290
1 changed files with 6 additions and 3 deletions
|
@ -62,8 +62,11 @@ 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: "3 successive ones"
|
// report a one bit if the majority of the last states had a one
|
||||||
uint16_t graded = status_hysteresis[0] & status_hysteresis[1] & status;
|
uint16_t graded =
|
||||||
|
(status_hysteresis[0] & status_hysteresis[1]) |
|
||||||
|
(status_hysteresis[1] & status) |
|
||||||
|
(status_hysteresis[0] & status);
|
||||||
|
|
||||||
status_hysteresis[0] = status_hysteresis[1];
|
status_hysteresis[0] = status_hysteresis[1];
|
||||||
status_hysteresis[1] = status;
|
status_hysteresis[1] = status;
|
||||||
|
@ -113,7 +116,7 @@ static void loop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_delay_us(100);
|
_delay_ms(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
Loading…
Reference in a new issue