Skip to content

Commit 0f8d7ad

Browse files
committed
Force display update during menu display. Reduce double tap time.
Show menu immediately if not shown. Fix #373.
1 parent 049085b commit 0f8d7ad

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

Firmware/RTK_Everywhere/Tasks.ino

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,14 +1332,18 @@ void buttonCheckTask(void *e)
13321332
{
13331333
// Record the time of the most recent two button releases
13341334
// 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+
13361337
if (present.imu_im19 && (present.display_type == DISPLAY_MAX_NONE))
13371338
doubleTapInterval = 1000; // We are only interested in double taps, so use a longer interval
1339+
13381340
unsigned long previousButtonRelease = 0;
13391341
unsigned long thisButtonRelease = 0;
13401342
bool singleTap = false;
13411343
bool doubleTap = false;
13421344

1345+
bool showMenu = false;
1346+
13431347
// Start notification
13441348
task.buttonCheckTaskRunning = true;
13451349
if (settings.printTaskStartStop)
@@ -1362,6 +1366,10 @@ void buttonCheckTask(void *e)
13621366
{
13631367
previousButtonRelease = thisButtonRelease;
13641368
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;
13651373
}
13661374

13671375
if ((previousButtonRelease > 0) && (thisButtonRelease > 0) &&
@@ -1380,7 +1388,9 @@ void buttonCheckTask(void *e)
13801388
previousButtonRelease = 0;
13811389
thisButtonRelease = 0;
13821390
}
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
13841394
{
13851395
doubleTap = false;
13861396
singleTap = false;
@@ -1478,8 +1488,14 @@ void buttonCheckTask(void *e)
14781488
forceSystemStateUpdate = true;
14791489
requestChangeState(STATE_TEST);
14801490
}
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))
14821496
{
1497+
showMenu = false;
1498+
14831499
switch (systemState)
14841500
{
14851501
// If we are in any running state, change to STATE_DISPLAY_SETUP
@@ -1513,6 +1529,9 @@ void buttonCheckTask(void *e)
15131529
// Exit into new system state on double tap - see below
15141530
// Exit display setup into previous state after ~10s - see updateSystemState()
15151531
lastSetupMenuChange = millis();
1532+
1533+
forceDisplayUpdate = true; // User is interacting so repaint display quickly
1534+
15161535
setupSelectedButton++;
15171536
if (setupSelectedButton == setupButtons.size()) // Limit reached?
15181537
setupSelectedButton = 0;
@@ -1566,6 +1585,8 @@ void buttonCheckTask(void *e)
15661585
} // End singleTap
15671586
else if (doubleTap && (firstRoverStart == false) && (settings.disableSetupButton == false))
15681587
{
1588+
showMenu = false;
1589+
15691590
switch (systemState)
15701591
{
15711592
case STATE_DISPLAY_SETUP: {

0 commit comments

Comments
 (0)