@@ -1332,14 +1332,18 @@ void buttonCheckTask(void *e)
1332
1332
{
1333
1333
// Record the time of the most recent two button releases
1334
1334
// This allows us to detect single and double presses
1335
- unsigned long doubleTapInterval = 500 ; // User must press and release twice within this to create a double tap
1335
+ unsigned long doubleTapInterval = 250 ; // User must press and release twice within this to create a double tap
1336
+
1336
1337
if (present.imu_im19 && (present.display_type == DISPLAY_MAX_NONE))
1337
1338
doubleTapInterval = 1000 ; // We are only interested in double taps, so use a longer interval
1339
+
1338
1340
unsigned long previousButtonRelease = 0 ;
1339
1341
unsigned long thisButtonRelease = 0 ;
1340
1342
bool singleTap = false ;
1341
1343
bool doubleTap = false ;
1342
1344
1345
+ bool showMenu = false ;
1346
+
1343
1347
// Start notification
1344
1348
task.buttonCheckTaskRunning = true ;
1345
1349
if (settings.printTaskStartStop )
@@ -1362,6 +1366,10 @@ void buttonCheckTask(void *e)
1362
1366
{
1363
1367
previousButtonRelease = thisButtonRelease;
1364
1368
thisButtonRelease = millis ();
1369
+
1370
+ // If we are not currently showing the menu, immediately display it
1371
+ if (showMenu == false && systemState != STATE_DISPLAY_SETUP)
1372
+ showMenu = true ;
1365
1373
}
1366
1374
1367
1375
if ((previousButtonRelease > 0 ) && (thisButtonRelease > 0 ) &&
@@ -1380,7 +1388,9 @@ void buttonCheckTask(void *e)
1380
1388
previousButtonRelease = 0 ;
1381
1389
thisButtonRelease = 0 ;
1382
1390
}
1383
- else // if ((previousButtonRelease == 0) && (thisButtonRelease > 0)) // Tap in progress?
1391
+
1392
+ // else // if ((previousButtonRelease == 0) && (thisButtonRelease > 0)) // Tap in progress?
1393
+ else if ((millis () - previousButtonRelease) > 2000 ) // No user interaction
1384
1394
{
1385
1395
doubleTap = false ;
1386
1396
singleTap = false ;
@@ -1478,8 +1488,14 @@ void buttonCheckTask(void *e)
1478
1488
forceSystemStateUpdate = true ;
1479
1489
requestChangeState (STATE_TEST);
1480
1490
}
1481
- else if (singleTap && (firstRoverStart == false ) && (settings.disableSetupButton == false ))
1491
+
1492
+ // If the button is disabled, do nothing
1493
+ // If we detect a singleTap, move through menus
1494
+ // If the button was pressed to initially show the menu, then allow immediate entry and show the menu
1495
+ else if ((settings.disableSetupButton == false ) && ((singleTap && firstRoverStart == false ) || showMenu))
1482
1496
{
1497
+ showMenu = false ;
1498
+
1483
1499
switch (systemState)
1484
1500
{
1485
1501
// If we are in any running state, change to STATE_DISPLAY_SETUP
@@ -1513,6 +1529,9 @@ void buttonCheckTask(void *e)
1513
1529
// Exit into new system state on double tap - see below
1514
1530
// Exit display setup into previous state after ~10s - see updateSystemState()
1515
1531
lastSetupMenuChange = millis ();
1532
+
1533
+ forceDisplayUpdate = true ; // User is interacting so repaint display quickly
1534
+
1516
1535
setupSelectedButton++;
1517
1536
if (setupSelectedButton == setupButtons.size ()) // Limit reached?
1518
1537
setupSelectedButton = 0 ;
@@ -1566,6 +1585,8 @@ void buttonCheckTask(void *e)
1566
1585
} // End singleTap
1567
1586
else if (doubleTap && (firstRoverStart == false ) && (settings.disableSetupButton == false ))
1568
1587
{
1588
+ showMenu = false ;
1589
+
1569
1590
switch (systemState)
1570
1591
{
1571
1592
case STATE_DISPLAY_SETUP: {
0 commit comments