@@ -1381,50 +1381,48 @@ void buttonCheckTask(void *e)
1381
1381
}
1382
1382
else if ((systemState == STATE_BASE_NOT_STARTED) && (firstRoverStart == true ) && (userBtn->pressedFor (500 )))
1383
1383
{
1384
+ lastSetupMenuChange = millis (); // Prevent a timeout during state change
1384
1385
forceSystemStateUpdate = true ;
1385
1386
requestChangeState (STATE_TEST);
1386
- lastTestMenuChange = millis (); // Avoid exiting test menu for 1s
1387
1387
}
1388
1388
else if (singleTap && (firstRoverStart == false ) && (settings.disableSetupButton == false ))
1389
1389
{
1390
1390
switch (systemState)
1391
1391
{
1392
- // If we are in any running state, change to STATE_DISPLAY_SETUP and require a double tap to exit
1392
+ // If we are in any running state, change to STATE_DISPLAY_SETUP
1393
+ case STATE_ROVER_NOT_STARTED:
1394
+ case STATE_ROVER_NO_FIX:
1395
+ case STATE_ROVER_FIX:
1396
+ case STATE_ROVER_RTK_FLOAT:
1397
+ case STATE_ROVER_RTK_FIX:
1393
1398
case STATE_BASE_NOT_STARTED:
1394
1399
case STATE_BASE_TEMP_SETTLE:
1395
1400
case STATE_BASE_TEMP_SURVEY_STARTED:
1396
1401
case STATE_BASE_TEMP_TRANSMITTING:
1397
1402
case STATE_BASE_FIXED_NOT_STARTED:
1398
1403
case STATE_BASE_FIXED_TRANSMITTING:
1399
- case STATE_ROVER_NOT_STARTED:
1400
- case STATE_ROVER_NO_FIX:
1401
- case STATE_ROVER_FIX:
1402
- case STATE_ROVER_RTK_FLOAT:
1403
- case STATE_ROVER_RTK_FIX:
1404
- case STATE_NTPSERVER_NOT_STARTED:
1405
- case STATE_NTPSERVER_NO_SYNC:
1406
- case STATE_NTPSERVER_SYNC:
1407
1404
case STATE_WIFI_CONFIG_NOT_STARTED:
1408
1405
case STATE_WIFI_CONFIG:
1409
- case STATE_CONFIG_VIA_ETH_NOT_STARTED:
1410
1406
case STATE_ESPNOW_PAIRING_NOT_STARTED:
1411
1407
case STATE_ESPNOW_PAIRING:
1408
+ case STATE_NTPSERVER_NOT_STARTED:
1409
+ case STATE_NTPSERVER_NO_SYNC:
1410
+ case STATE_NTPSERVER_SYNC:
1411
+ case STATE_CONFIG_VIA_ETH_NOT_STARTED:
1412
1412
lastSystemState = systemState; // Remember this state to return if needed
1413
1413
requestChangeState (STATE_DISPLAY_SETUP);
1414
1414
lastSetupMenuChange = millis ();
1415
1415
setupSelectedButton = 0 ; // Highlight the first button
1416
1416
break ;
1417
1417
1418
- case STATE_CONFIG_VIA_ETH_STARTED:
1419
- case STATE_CONFIG_VIA_ETH:
1420
- // If the user presses the button during configure-via-ethernet, then do a complete restart into
1421
- // Base mode
1422
- requestChangeState (STATE_CONFIG_VIA_ETH_RESTART_BASE);
1423
- break ;
1424
-
1425
- case STATE_PROFILE:
1426
- // If the user presses the setup button during a profile change, do nothing
1427
- // Allow system to return to lastSystemState
1418
+ case STATE_DISPLAY_SETUP:
1419
+ // If we are displaying the setup menu, a single tap will cycle through possible system states
1420
+ // Exit into new system state on double tap - see below
1421
+ // Exit display setup into previous state after ~10s - see updateSystemState()
1422
+ lastSetupMenuChange = millis ();
1423
+ setupSelectedButton++;
1424
+ if (setupSelectedButton == setupButtons.size ()) // Limit reached?
1425
+ setupSelectedButton = 0 ;
1428
1426
break ;
1429
1427
1430
1428
case STATE_TEST:
@@ -1433,21 +1431,43 @@ void buttonCheckTask(void *e)
1433
1431
1434
1432
case STATE_TESTING:
1435
1433
// If we are in testing, return to Base Not Started
1434
+ lastSetupMenuChange = millis (); // Prevent a timeout during state change
1436
1435
requestChangeState (STATE_BASE_NOT_STARTED);
1437
1436
break ;
1438
1437
1439
- case STATE_DISPLAY_SETUP:
1440
- // If we are displaying the setup menu, a single tap will cycle through possible system states
1441
- // Exit into new system state on double tap
1442
- // Exit display setup into previous state after ~30s in updateSystemState()
1443
- setupSelectedButton++;
1444
- if (setupSelectedButton == setupButtons.size ()) // Limit reached?
1445
- setupSelectedButton = 0 ;
1438
+ case STATE_PROFILE:
1439
+ // If the user presses the setup button during a profile change, do nothing
1440
+ // Allow system to return to lastSystemState
1441
+ break ;
1442
+
1443
+ case STATE_CONFIG_VIA_ETH_STARTED:
1444
+ case STATE_CONFIG_VIA_ETH:
1445
+ // If the user presses the button during configure-via-ethernet,
1446
+ // do a complete restart into Base mode
1447
+ lastSetupMenuChange = millis (); // Prevent a timeout during state change
1448
+ requestChangeState (STATE_CONFIG_VIA_ETH_RESTART_BASE);
1449
+ break ;
1450
+
1451
+ /* These lines are commented to allow default to print the diagnostic.
1452
+ case STATE_KEYS_STARTED:
1453
+ case STATE_KEYS_NEEDED:
1454
+ case STATE_KEYS_WIFI_STARTED:
1455
+ case STATE_KEYS_WIFI_CONNECTED:
1456
+ case STATE_KEYS_WIFI_TIMEOUT:
1457
+ case STATE_KEYS_EXPIRED:
1458
+ case STATE_KEYS_DAYS_REMAINING:
1459
+ case STATE_KEYS_LBAND_CONFIGURE:
1460
+ case STATE_KEYS_LBAND_ENCRYPTED:
1461
+ case STATE_KEYS_PROVISION_WIFI_STARTED:
1462
+ case STATE_KEYS_PROVISION_WIFI_CONNECTED:
1463
+ // Abort key download?
1464
+ // TODO: check this! I think we want to be able to terminate STATE_KEYS via the button?
1446
1465
break;
1466
+ */
1447
1467
1448
1468
default :
1449
- systemPrintf (" ButtonCheckTask single tap - unknown system state: %d\r\n " , systemState);
1450
- requestChangeState (STATE_BASE_NOT_STARTED);
1469
+ systemPrintf (" buttonCheckTask single tap - untrapped system state: %d\r\n " , systemState);
1470
+ // requestChangeState(STATE_BASE_NOT_STARTED);
1451
1471
break ;
1452
1472
} // End singleTap switch (systemState)
1453
1473
} // End singleTap
@@ -1457,7 +1477,10 @@ void buttonCheckTask(void *e)
1457
1477
{
1458
1478
case STATE_DISPLAY_SETUP:
1459
1479
{
1480
+ // If we are displaying the setup menu, a single tap will cycle through possible system states - see above
1460
1481
// Exit into new system state on double tap
1482
+ // Exit display setup into previous state after ~10s - see updateSystemState()
1483
+ lastSetupMenuChange = millis (); // Prevent a timeout during state change
1461
1484
uint8_t thisIsButton = 0 ;
1462
1485
for (auto it = setupButtons.begin (); it != setupButtons.end (); it = std::next (it))
1463
1486
{
@@ -1477,7 +1500,6 @@ void buttonCheckTask(void *e)
1477
1500
1478
1501
break ;
1479
1502
}
1480
-
1481
1503
thisIsButton++;
1482
1504
}
1483
1505
}
0 commit comments