...
 
Commits (3)
......@@ -71,6 +71,7 @@
// Config
#define BLINK_RATE 250
#define RUNNING_LIGHT_BLINK_RATE 920
#define MINIMUM_PRESS_TIME 50
#define HOLD_DOWN_TIME 500
#define DEBOUNCE_COOLDOWN_TIME 200
......@@ -197,7 +198,7 @@ void blink_speaker_frame(int divisor)
// Each frame, this increments L/R/B hold time variables while the user is holding a button (or both) down.
// It also checks for the release. In that case it flips on either input_single_* or input_hold_* variables
// to be consumed later in the frame.
void read_dual_buttons()
void read_buttons()
{
for (int i = 0; i < num_ui_actions; i++) {
input_single_hit[i] = false;
......@@ -216,7 +217,7 @@ void read_dual_buttons()
{
for (int i = 0; i < num_ui_actions; i++)
{
if (hold_time[i] && !new_input_blocked && !hold_waiting)
if (hold_time[i] > MINIMUM_PRESS_TIME && !new_input_blocked && !hold_waiting)
{
input_single_hit[i] = true;
debounce_subsequent_input();
......@@ -245,7 +246,7 @@ void read_dual_buttons()
void set_up_mode()
{
read_dual_buttons();
read_buttons();
if (input_hold_hit[btn_grip_both])
{
......@@ -299,9 +300,9 @@ void loop()
if (fg_mode != last_fg_mode || bg_mode != last_bg_mode)
reset_all();
if (fg_mode == FG_MODE_BLINK_L)
if (fg_mode == FG_MODE_BLINK_L || hold_time[btn_grip_left] > MINIMUM_PRESS_TIME)
blink_frame(true, false);
else if (fg_mode == FG_MODE_BLINK_R)
else if (fg_mode == FG_MODE_BLINK_R || hold_time[btn_grip_right] > MINIMUM_PRESS_TIME)
blink_frame(false, true);
else if (bg_mode == BG_MODE_HAZARDS)
blink_frame(true, true, 3);
......@@ -315,7 +316,7 @@ void loop()
reset_all();
// Horn is driven asynchronously from the rest of the blinking logic
if (hold_time[btn_horn] > 0)
if (hold_time[btn_horn] > MINIMUM_PRESS_TIME)
{
digitalWrite(PIN_OUT_HORN, HIGH); // TOOOOOOT
......