#define MANUAL_OPEN_PIN 12 // keys for manual open and close
#define MANUAL_CLOSE_PIN 13 //
-#define DEBOUNCE_DELAY 625 // * 16us = 10ms
+#define DEBOUNCE_DELAY 6250 // * 16us = 100ms
#define DEBOUNCE_IDLE 0 // currently no debouncing
#define DEBOUNCE_OPEN 1 // debouncing open key
#define DEBOUNCE_CLOSE 2 // debouncing close key
ISR(TIMER0_COMPA_vect)
{
- if((debounce_state & DEBOUNCE_OPEN && manual_open_pressed()) ||
- (debounce_state & DEBOUNCE_CLOSE && manual_close_pressed())) {
+ if(((debounce_state & DEBOUNCE_OPEN) && manual_open_pressed()) ||
+ ((debounce_state & DEBOUNCE_CLOSE) && manual_close_pressed())) {
if(debounce_cnt) {
debounce_cnt--;
return;
return true;
}
}
- else {
+ else if(debounce_state & DEBOUNCE_OPEN) {
stop_debounce_timer();
debounce_state = DEBOUNCE_IDLE;
}
return true;
}
}
- else {
+ else if(debounce_state & DEBOUNCE_CLOSE) {
stop_debounce_timer();
debounce_state = DEBOUNCE_IDLE;
}