From 0ee06169ba0b63def2038e16b605d1e2dce6250a Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 23 Nov 2011 00:30:16 +0000 Subject: [PATCH] fixed ajar state change check --- firmware/tuer.pde | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/firmware/tuer.pde b/firmware/tuer.pde index 10efc92..5cde547 100644 --- a/firmware/tuer.pde +++ b/firmware/tuer.pde @@ -462,18 +462,15 @@ void init_heartbeat() ISR(TIMER2_COMPA_vect) { boolean a = get_ajar_status(); + if(a != ajar_last_state) + ajar_state_changed = true; + ajar_last_state = a; heartbeat_cnt++; - if(heartbeat_cnt == HEARTBEAT_DURATION) { + if(heartbeat_cnt == HEARTBEAT_DURATION) heartbeat_off(); - if(a != ajar_last_state) - ajar_state_changed = true; - ajar_last_state = a; - } else if(heartbeat_cnt >= HEARTBEAT_DELAY) { + else if(heartbeat_cnt >= HEARTBEAT_DELAY) { heartbeat_on(); heartbeat_cnt = 0; - if(a != ajar_last_state) - ajar_state_changed = true; - ajar_last_state = a; } } -- 1.7.10.4