fix after button hold, when button released triggers short press. Not yet tested
This commit is contained in:
parent
3cc8457f07
commit
a3a7122610
|
@ -383,7 +383,7 @@ void handleInputs()
|
||||||
timebuttonpressed_trigger=loopmillis; //set time of button press
|
timebuttonpressed_trigger=loopmillis; //set time of button press
|
||||||
timebuttonpressed_trigger_long=loopmillis; //set time of button press, for long hold timing
|
timebuttonpressed_trigger_long=loopmillis; //set time of button press, for long hold timing
|
||||||
}else if(timebuttonpressed_trigger != 0 && digitalRead(PIN_TRIGGER)){ //button released (was pressed)
|
}else if(timebuttonpressed_trigger != 0 && digitalRead(PIN_TRIGGER)){ //button released (was pressed)
|
||||||
if (loopmillis-timebuttonpressed_trigger < BUTTONTIMEHOLD){ //short press
|
if (loopmillis-timebuttonpressed_trigger < BUTTONTIMEHOLD && timebuttonpressed_trigger>0){ //short press
|
||||||
button_trigger=true;
|
button_trigger=true;
|
||||||
}
|
}
|
||||||
timebuttonpressed_trigger=0; //re-enable after short press and release from hold
|
timebuttonpressed_trigger=0; //re-enable after short press and release from hold
|
||||||
|
@ -402,7 +402,7 @@ void handleInputs()
|
||||||
if (timebuttonpressed_left == 0 && !digitalRead(PIN_BTNLEFT)){ //first time pressed down. (low when pressed)
|
if (timebuttonpressed_left == 0 && !digitalRead(PIN_BTNLEFT)){ //first time pressed down. (low when pressed)
|
||||||
timebuttonpressed_left=loopmillis; //set time of button press
|
timebuttonpressed_left=loopmillis; //set time of button press
|
||||||
}else if(timebuttonpressed_left != 0 && digitalRead(PIN_BTNLEFT)){ //button released (was pressed)
|
}else if(timebuttonpressed_left != 0 && digitalRead(PIN_BTNLEFT)){ //button released (was pressed)
|
||||||
if (loopmillis-timebuttonpressed_left < BUTTONTIMEHOLD){ //short press
|
if (loopmillis-timebuttonpressed_left < BUTTONTIMEHOLD && timebuttonpressed_left>0){ //short press
|
||||||
button_left=true;
|
button_left=true;
|
||||||
}
|
}
|
||||||
timebuttonpressed_left=0; //re-enable after short press and release from hold
|
timebuttonpressed_left=0; //re-enable after short press and release from hold
|
||||||
|
@ -415,7 +415,7 @@ void handleInputs()
|
||||||
if (timebuttonpressed_center == 0 && !digitalRead(PIN_BTNCENTER)){ //first time pressed down. (low when pressed)
|
if (timebuttonpressed_center == 0 && !digitalRead(PIN_BTNCENTER)){ //first time pressed down. (low when pressed)
|
||||||
timebuttonpressed_center=loopmillis; //set time of button press
|
timebuttonpressed_center=loopmillis; //set time of button press
|
||||||
}else if(timebuttonpressed_center != 0 && digitalRead(PIN_BTNCENTER)){ //button released (was pressed)
|
}else if(timebuttonpressed_center != 0 && digitalRead(PIN_BTNCENTER)){ //button released (was pressed)
|
||||||
if (loopmillis-timebuttonpressed_center < BUTTONTIMEHOLD){ //short press
|
if (loopmillis-timebuttonpressed_center < BUTTONTIMEHOLD && timebuttonpressed_center>0){ //short press
|
||||||
button_center=true;
|
button_center=true;
|
||||||
}
|
}
|
||||||
timebuttonpressed_center=0; //re-enable after short press and release from hold
|
timebuttonpressed_center=0; //re-enable after short press and release from hold
|
||||||
|
@ -428,7 +428,7 @@ void handleInputs()
|
||||||
if (timebuttonpressed_right == 0 && !digitalRead(PIN_BTNRIGHT)){ //first time pressed down. (low when pressed)
|
if (timebuttonpressed_right == 0 && !digitalRead(PIN_BTNRIGHT)){ //first time pressed down. (low when pressed)
|
||||||
timebuttonpressed_right=loopmillis; //set time of button press
|
timebuttonpressed_right=loopmillis; //set time of button press
|
||||||
}else if(timebuttonpressed_right != 0 && digitalRead(PIN_BTNRIGHT)){ //button released (was pressed)
|
}else if(timebuttonpressed_right != 0 && digitalRead(PIN_BTNRIGHT)){ //button released (was pressed)
|
||||||
if (loopmillis-timebuttonpressed_right < BUTTONTIMEHOLD){ //short press
|
if (loopmillis-timebuttonpressed_right < BUTTONTIMEHOLD && timebuttonpressed_right>0){ //short press
|
||||||
button_right=true;
|
button_right=true;
|
||||||
}
|
}
|
||||||
timebuttonpressed_right=0; //re-enable after short press and release from hold
|
timebuttonpressed_right=0; //re-enable after short press and release from hold
|
||||||
|
|
Loading…
Reference in New Issue