Compare commits

...

No commits in common. 'b4cc8c2034ce8beb5d2f931f00ddc4dcd2799923' and 'ce56b1b4099e7e7340e24e2094facb5ecc5cb190' have entirely different histories.

@ -238,9 +238,9 @@ int main(void)
in3state = 0; in3state = 0;
} }
if (hbw_timer - logtimer0 < 100) { if (logtimer0 && (hbw_timer - logtimer0 < 100)) {
state = 0; state = 0;
if (bit_is_clear(PINB, Relais1)) if (bit_is_set(PINB, Relais1))
state = 200; state = 200;
if (!hbw_send_channel(0, 1, &state)) if (!hbw_send_channel(0, 1, &state))
logtimer0 += 300; logtimer0 += 300;
@ -248,9 +248,9 @@ int main(void)
logtimer0 = 0; logtimer0 = 0;
} }
if (hbw_timer - logtimer1 < 100) { if (logtimer1 && (hbw_timer - logtimer1 < 100)) {
state = 0; state = 0;
if (bit_is_clear(PINB, Relais2)) if (bit_is_set(PINB, Relais2))
state = 200; state = 200;
if (!hbw_send_channel(1, 1, &state)) if (!hbw_send_channel(1, 1, &state))
logtimer1 += 300; logtimer1 += 300;

@ -6,6 +6,7 @@
uint8_t expled; uint8_t expled;
uint8_t expbutton; uint8_t expbutton;
uint8_t expdouble;
uint16_t exptime; uint16_t exptime;
uint16_t explong; uint16_t explong;
uint16_t longtime; uint16_t longtime;
@ -123,13 +124,6 @@ int main(void)
PORTD &= ~(1<<ExpLED); PORTD &= ~(1<<ExpLED);
PORTD |= (1<<ExpButton); PORTD |= (1<<ExpButton);
expled = 0;
expbutton = 0;
exptime = 0;
explong = 0;
logtimer = 0;
hbw_init(); hbw_init();
state = 255; state = 255;
@ -156,17 +150,29 @@ int main(void)
} else { } else {
exptime = now; exptime = now;
explong = 0; explong = 0;
if (expdouble == 1)
expdouble = 2;
} }
} }
if (bit_is_set(PIND, ExpButton)) { if (bit_is_set(PIND, ExpButton)) {
if (exptime) { if (exptime) {
if (now - exptime > 50 && !explong) { if (now - exptime > 50 && !explong && (expdouble == 2)) {
expbutton++;
state = 1;
expdouble = 0;
}
if (now - exptime > 300 && !explong && (expdouble == 1)) {
expbutton++; expbutton++;
state = 2; state = 2;
expdouble = 0;
} }
if (now - exptime > 50 && explong) if (now - exptime > 50 && !explong && (expdouble == 0))
expdouble = 1;
if (now - exptime > 50 && explong) {
state = 0; state = 0;
expdouble = 0;
}
exptime = 0; exptime = 0;
} }
} }
@ -174,9 +180,9 @@ int main(void)
if (hbw_send_key(1, expbutton, state)) if (hbw_send_key(1, expbutton, state))
state = 255; state = 255;
if (hbw_timer - logtimer < 100) { if (logtimer && (hbw_timer - logtimer < 100)) {
led = 0; led = 0;
if (bit_is_clear(PIND, ExpLED)) if (bit_is_set(PIND, ExpLED))
led = 200; led = 200;
if (!hbw_send_channel(0, 1, &led)) if (!hbw_send_channel(0, 1, &led))
logtimer += 300; logtimer += 300;

Loading…
Cancel
Save