From: Christian Pointner Date: Wed, 23 Nov 2011 00:30:16 +0000 (+0000) Subject: fixed ajar state change check X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=0ee06169ba0b63def2038e16b605d1e2dce6250a;p=svn42.git fixed ajar state change check --- 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; } }