Skip to content

Commit df898f6

Browse files
committed
Discard first button press
1 parent d0fa2ed commit df898f6

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

Firmware/RTK_Everywhere/Tasks.ino

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,7 @@ void buttonCheckTask(void *e)
13671367
previousButtonRelease = thisButtonRelease;
13681368
thisButtonRelease = millis();
13691369

1370-
//If we are not currently showing the menu, immediately display it
1370+
// If we are not currently showing the menu, immediately display it
13711371
if (showMenu == false && systemState != STATE_DISPLAY_SETUP)
13721372
showMenu = true;
13731373
}
@@ -1383,10 +1383,18 @@ void buttonCheckTask(void *e)
13831383
else if ((thisButtonRelease > 0) &&
13841384
((millis() - thisButtonRelease) > doubleTapInterval)) // Do we have a single tap?
13851385
{
1386-
doubleTap = false;
1387-
singleTap = true;
1388-
previousButtonRelease = 0;
1389-
thisButtonRelease = 0;
1386+
// Discard the first button press as it was used to display the menu
1387+
if (showMenu == true)
1388+
{
1389+
showMenu = false;
1390+
}
1391+
else
1392+
{
1393+
doubleTap = false;
1394+
singleTap = true;
1395+
previousButtonRelease = 0;
1396+
thisButtonRelease = 0;
1397+
}
13901398
}
13911399

13921400
// else // if ((previousButtonRelease == 0) && (thisButtonRelease > 0)) // Tap in progress?
@@ -1488,14 +1496,12 @@ void buttonCheckTask(void *e)
14881496
forceSystemStateUpdate = true;
14891497
requestChangeState(STATE_TEST);
14901498
}
1491-
1499+
14921500
// If the button is disabled, do nothing
14931501
// If we detect a singleTap, move through menus
14941502
// If the button was pressed to initially show the menu, then allow immediate entry and show the menu
14951503
else if ((settings.disableSetupButton == false) && ((singleTap && firstRoverStart == false) || showMenu))
14961504
{
1497-
showMenu = false;
1498-
14991505
switch (systemState)
15001506
{
15011507
// If we are in any running state, change to STATE_DISPLAY_SETUP
@@ -1522,6 +1528,7 @@ void buttonCheckTask(void *e)
15221528
requestChangeState(STATE_DISPLAY_SETUP);
15231529
lastSetupMenuChange = millis();
15241530
setupSelectedButton = 0; // Highlight the first button
1531+
forceDisplayUpdate = true; // User is interacting so repaint display quickly
15251532
break;
15261533

15271534
case STATE_DISPLAY_SETUP:
@@ -1585,8 +1592,6 @@ void buttonCheckTask(void *e)
15851592
} // End singleTap
15861593
else if (doubleTap && (firstRoverStart == false) && (settings.disableSetupButton == false))
15871594
{
1588-
showMenu = false;
1589-
15901595
switch (systemState)
15911596
{
15921597
case STATE_DISPLAY_SETUP: {

0 commit comments

Comments
 (0)