bugfix minimal push button time
This commit is contained in:
parent
c663bb527e
commit
fd12dcccf0
|
@ -12,6 +12,7 @@ static struct timer debouncetimer;
|
||||||
static int status(int type);
|
static int status(int type);
|
||||||
static int enabled = 0;
|
static int enabled = 0;
|
||||||
volatile static int bstate;
|
volatile static int bstate;
|
||||||
|
volatile static int bstatei;
|
||||||
struct sensors_sensor *sensors[1];
|
struct sensors_sensor *sensors[1];
|
||||||
unsigned char sensors_flags[1];
|
unsigned char sensors_flags[1];
|
||||||
|
|
||||||
|
@ -22,18 +23,18 @@ unsigned char sensors_flags[1];
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
ISR(INT4_vect)
|
ISR(INT4_vect)
|
||||||
{
|
{
|
||||||
|
|
||||||
// leds_toggle(LEDS_RED);
|
|
||||||
if(BUTTON_CHECK_IRQ()) {
|
if(BUTTON_CHECK_IRQ()) {
|
||||||
|
bstatei = (PINE & _BV(PE4) ? 0 : 1);
|
||||||
if(timer_expired(&debouncetimer)) {
|
if(timer_expired(&debouncetimer)) {
|
||||||
// led1_on();
|
// led1_on();
|
||||||
timer_set(&debouncetimer, CLOCK_SECOND / 8);
|
timer_set(&debouncetimer, CLOCK_SECOND / 16);
|
||||||
bstate = (PINE & _BV(PE4) ? 0 : 1);
|
bstate = (PINE & _BV(PE4) ? 0 : 1);
|
||||||
sensors_changed(&button_sensor);
|
if(bstate == bstatei){
|
||||||
|
sensors_changed(&button_sensor);
|
||||||
|
}
|
||||||
// led1_off();
|
// led1_off();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue