From 33df5aa8f9724a228275e710fa624039740dce7d Mon Sep 17 00:00:00 2001 From: Ralf Ramsauer Date: Mon, 8 Jun 2015 21:49:19 +0200 Subject: [PATCH] Improved klackering mechanism for AC --- avr-code/main.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/avr-code/main.c b/avr-code/main.c index c820e14..eeeb85c 100644 --- a/avr-code/main.c +++ b/avr-code/main.c @@ -48,13 +48,12 @@ void close_door() void schnapper(unsigned int i) { - while(i--) - { - OPEN_SCHNAPPER; - _delay_ms(125); - CLOSE_SCHNAPPER; - _delay_ms(125); + OPEN_SCHNAPPER; + while (i--) { + _delay_ms(1000); } + CLOSE_SCHNAPPER; + _delay_ms(100); } ISR(USI_OVERFLOW_vect) @@ -118,7 +117,7 @@ int main(void) { open_door(); if (klacker == 1) { - schnapper(20); + schnapper(3); klacker = 0; } } @@ -126,16 +125,14 @@ int main(void) { if (IS_RESCUE) { cli(); open_door(); - schnapper(30); - _delay_ms(2000); + schnapper(3); sei(); } else if (IS_SWITCH && open == 0) { _delay_ms(300); if(IS_SWITCH && open == 0) { cli(); open_door(); - schnapper(20); - _delay_ms(3000); + schnapper(5); sei(); } }