@@ -1575,25 +1575,29 @@ void buttonCheckTask(void *e)
15751575 if ((previousButtonRelease > 0 ) && (thisButtonRelease > 0 ) &&
15761576 ((thisButtonRelease - previousButtonRelease) <= doubleTapInterval)) // Do we have a double tap?
15771577 {
1578- doubleTap = true ;
1579- singleTap = false ;
1580- previousButtonRelease = 0 ;
1581- thisButtonRelease = 0 ;
1578+ // Do not register button taps until the system is displaying the menu
1579+ if (systemState == STATE_DISPLAY_SETUP)
1580+ {
1581+ doubleTap = true ;
1582+ singleTap = false ;
1583+ previousButtonRelease = 0 ;
1584+ thisButtonRelease = 0 ;
1585+ }
15821586 }
15831587 else if ((thisButtonRelease > 0 ) &&
15841588 ((millis () - thisButtonRelease) > doubleTapInterval)) // Do we have a single tap?
15851589 {
1586- // Discard the first button press as it was used to display the menu
1587- if (showMenu == true )
1588- {
1589- showMenu = false ;
1590- }
1591- else
1590+ // Do not register button taps until the system is displaying the menu
1591+ if (systemState == STATE_DISPLAY_SETUP)
15921592 {
1593- doubleTap = false ;
1594- singleTap = true ;
15951593 previousButtonRelease = 0 ;
15961594 thisButtonRelease = 0 ;
1595+ doubleTap = false ;
1596+
1597+ if (firstButtonThrownOut == false )
1598+ firstButtonThrownOut = true ; // Throw away the first button press
1599+ else
1600+ singleTap = true ;
15971601 }
15981602 }
15991603
@@ -1750,8 +1754,8 @@ void buttonCheckTask(void *e)
17501754 lastSystemState = systemState; // Remember this state to return if needed
17511755 requestChangeState (STATE_DISPLAY_SETUP);
17521756 lastSetupMenuChange = millis ();
1753- setupSelectedButton = 0 ; // Highlight the first button
1754- forceDisplayUpdate = true ; // User is interacting so repaint display quickly
1757+ setupSelectedButton = 0 ; // Highlight the first button
1758+ showMenu = false ;
17551759 break ;
17561760
17571761 case STATE_DISPLAY_SETUP:
@@ -1838,7 +1842,10 @@ void buttonCheckTask(void *e)
18381842 requestChangeState (STATE_PROFILE);
18391843 }
18401844 else if (it->newState == STATE_NOT_SET) // Exit
1845+ {
1846+ firstButtonThrownOut = false ;
18411847 requestChangeState (lastSystemState);
1848+ }
18421849 else
18431850 requestChangeState (it->newState );
18441851
0 commit comments