1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 18:34:25 +01:00

Improved klackering mechanism for AC

This commit is contained in:
Ralf Ramsauer 2015-06-08 21:49:19 +02:00
parent 052f2ff071
commit 33df5aa8f9

View File

@ -47,14 +47,13 @@ void close_door()
} }
void schnapper(unsigned int i) void schnapper(unsigned int i)
{
while(i--)
{ {
OPEN_SCHNAPPER; OPEN_SCHNAPPER;
_delay_ms(125); while (i--) {
CLOSE_SCHNAPPER; _delay_ms(1000);
_delay_ms(125);
} }
CLOSE_SCHNAPPER;
_delay_ms(100);
} }
ISR(USI_OVERFLOW_vect) ISR(USI_OVERFLOW_vect)
@ -118,7 +117,7 @@ int main(void) {
open_door(); open_door();
if (klacker == 1) if (klacker == 1)
{ {
schnapper(20); schnapper(3);
klacker = 0; klacker = 0;
} }
} }
@ -126,16 +125,14 @@ int main(void) {
if (IS_RESCUE) { if (IS_RESCUE) {
cli(); cli();
open_door(); open_door();
schnapper(30); schnapper(3);
_delay_ms(2000);
sei(); sei();
} else if (IS_SWITCH && open == 0) { } else if (IS_SWITCH && open == 0) {
_delay_ms(300); _delay_ms(300);
if(IS_SWITCH && open == 0) { if(IS_SWITCH && open == 0) {
cli(); cli();
open_door(); open_door();
schnapper(20); schnapper(5);
_delay_ms(3000);
sei(); sei();
} }
} }