@@ -1284,14 +1284,16 @@ void buttonCheckTask(void *e)
1284
1284
thisButtonRelease = millis ();
1285
1285
}
1286
1286
1287
- if ((previousButtonRelease > 0 ) && (thisButtonRelease > 0 ) && ((thisButtonRelease - previousButtonRelease) <= doubleTapInterval)) // Do we have a double tap?
1287
+ if ((previousButtonRelease > 0 ) && (thisButtonRelease > 0 ) &&
1288
+ ((thisButtonRelease - previousButtonRelease) <= doubleTapInterval)) // Do we have a double tap?
1288
1289
{
1289
1290
doubleTap = true ;
1290
1291
singleTap = false ;
1291
1292
previousButtonRelease = 0 ;
1292
1293
thisButtonRelease = 0 ;
1293
1294
}
1294
- else if ((thisButtonRelease > 0 ) && ((millis () - thisButtonRelease) > doubleTapInterval)) // Do we have a single tap?
1295
+ else if ((thisButtonRelease > 0 ) &&
1296
+ ((millis () - thisButtonRelease) > doubleTapInterval)) // Do we have a single tap?
1295
1297
{
1296
1298
doubleTap = false ;
1297
1299
singleTap = true ;
@@ -1316,43 +1318,43 @@ void buttonCheckTask(void *e)
1316
1318
1317
1319
else if (doubleTap)
1318
1320
{
1319
- // If we are in Rover/Base mode, enter WiFi Config Mode
1320
- if (inRoverMode () || inBaseMode ())
1321
+ // If we are in Rover/Base mode, enter WiFi Config Mode
1322
+ if (inRoverMode () || inBaseMode ())
1323
+ {
1324
+ // Beep if we are not locally compiled or a release candidate
1325
+ if (ENABLE_DEVELOPER == false )
1321
1326
{
1322
- // Beep if we are not locally compiled or a release candidate
1323
- if (ENABLE_DEVELOPER == false )
1324
- {
1325
- beepOn ();
1326
- delay (300 );
1327
- beepOff ();
1328
- delay (100 );
1329
- beepOn ();
1330
- delay (300 );
1331
- beepOff ();
1332
- }
1333
-
1334
- forceSystemStateUpdate = true ; // Immediately go to this new state
1335
- changeState (STATE_WIFI_CONFIG_NOT_STARTED);
1327
+ beepOn ();
1328
+ delay (300 );
1329
+ beepOff ();
1330
+ delay (100 );
1331
+ beepOn ();
1332
+ delay (300 );
1333
+ beepOff ();
1336
1334
}
1337
1335
1338
- // If we are in WiFi Config Mode, exit to Rover
1339
- else if (inWiFiConfigMode ())
1340
- {
1341
- // Beep if we are not locally compiled or a release candidate
1342
- if (ENABLE_DEVELOPER == false )
1343
- {
1344
- beepOn ();
1345
- delay (300 );
1346
- beepOff ();
1347
- delay (100 );
1348
- beepOn ();
1349
- delay (300 );
1350
- beepOff ();
1351
- }
1336
+ forceSystemStateUpdate = true ; // Immediately go to this new state
1337
+ changeState (STATE_WIFI_CONFIG_NOT_STARTED);
1338
+ }
1352
1339
1353
- forceSystemStateUpdate = true ; // Immediately go to this new state
1354
- changeState (STATE_ROVER_NOT_STARTED);
1340
+ // If we are in WiFi Config Mode, exit to Rover
1341
+ else if (inWiFiConfigMode ())
1342
+ {
1343
+ // Beep if we are not locally compiled or a release candidate
1344
+ if (ENABLE_DEVELOPER == false )
1345
+ {
1346
+ beepOn ();
1347
+ delay (300 );
1348
+ beepOff ();
1349
+ delay (100 );
1350
+ beepOn ();
1351
+ delay (300 );
1352
+ beepOff ();
1355
1353
}
1354
+
1355
+ forceSystemStateUpdate = true ; // Immediately go to this new state
1356
+ changeState (STATE_ROVER_NOT_STARTED);
1357
+ }
1356
1358
}
1357
1359
1358
1360
// The RTK Torch uses a shutdown IC configured to turn off ~3s
@@ -1363,7 +1365,7 @@ void buttonCheckTask(void *e)
1363
1365
if (ENABLE_DEVELOPER == false )
1364
1366
beepDurationMs (500 ); // Announce powering down
1365
1367
}
1366
- } // End productVariant == Torch
1368
+ } // End productVariant == Torch
1367
1369
else // RTK EVK, RTK Facet v2, RTK Facet mosaic
1368
1370
{
1369
1371
if (systemState == STATE_SHUTDOWN)
@@ -1448,71 +1450,69 @@ void buttonCheckTask(void *e)
1448
1450
requestChangeState (STATE_CONFIG_VIA_ETH_RESTART_BASE);
1449
1451
break ;
1450
1452
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?
1465
- break;
1466
- */
1453
+ /* These lines are commented to allow default to print the diagnostic.
1454
+ case STATE_KEYS_STARTED:
1455
+ case STATE_KEYS_NEEDED:
1456
+ case STATE_KEYS_WIFI_STARTED:
1457
+ case STATE_KEYS_WIFI_CONNECTED:
1458
+ case STATE_KEYS_WIFI_TIMEOUT:
1459
+ case STATE_KEYS_EXPIRED:
1460
+ case STATE_KEYS_DAYS_REMAINING:
1461
+ case STATE_KEYS_LBAND_CONFIGURE:
1462
+ case STATE_KEYS_LBAND_ENCRYPTED:
1463
+ case STATE_KEYS_PROVISION_WIFI_STARTED:
1464
+ case STATE_KEYS_PROVISION_WIFI_CONNECTED:
1465
+ // Abort key download?
1466
+ // TODO: check this! I think we want to be able to terminate STATE_KEYS via the button?
1467
+ break;
1468
+ */
1467
1469
1468
1470
default :
1469
1471
systemPrintf (" buttonCheckTask single tap - untrapped system state: %d\r\n " , systemState);
1470
- // requestChangeState(STATE_BASE_NOT_STARTED);
1472
+ // requestChangeState(STATE_BASE_NOT_STARTED);
1471
1473
break ;
1472
1474
} // End singleTap switch (systemState)
1473
- } // End singleTap
1475
+ } // End singleTap
1474
1476
else if (doubleTap && (firstRoverStart == false ) && (settings.disableSetupButton == false ))
1475
1477
{
1476
1478
switch (systemState)
1477
1479
{
1478
- case STATE_DISPLAY_SETUP:
1480
+ case STATE_DISPLAY_SETUP: {
1481
+ // If we are displaying the setup menu, a single tap will cycle through possible system states - see
1482
+ // above Exit into new system state on double tap Exit display setup into previous state after ~10s
1483
+ // - see updateSystemState()
1484
+ lastSetupMenuChange = millis (); // Prevent a timeout during state change
1485
+ uint8_t thisIsButton = 0 ;
1486
+ for (auto it = setupButtons.begin (); it != setupButtons.end (); it = std::next (it))
1479
1487
{
1480
- // If we are displaying the setup menu, a single tap will cycle through possible system states - see above
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
1484
- uint8_t thisIsButton = 0 ;
1485
- for (auto it = setupButtons.begin (); it != setupButtons.end (); it = std::next (it))
1488
+ if (thisIsButton == setupSelectedButton)
1486
1489
{
1487
- if (thisIsButton == setupSelectedButton)
1490
+ setupButton theButton = *it;
1491
+
1492
+ if (theButton.newState == STATE_PROFILE)
1488
1493
{
1489
- setupButton theButton = *it;
1490
-
1491
- if (theButton.newState == STATE_PROFILE)
1492
- {
1493
- displayProfile = theButton.newProfile ; // paintProfile needs the unit
1494
- requestChangeState (STATE_PROFILE);
1495
- }
1496
- else if (theButton.newState == STATE_NOT_SET) // Exit
1497
- requestChangeState (lastSystemState);
1498
- else
1499
- requestChangeState (theButton.newState );
1500
-
1501
- break ;
1494
+ displayProfile = theButton.newProfile ; // paintProfile needs the unit
1495
+ requestChangeState (STATE_PROFILE);
1502
1496
}
1503
- thisIsButton++;
1497
+ else if (theButton.newState == STATE_NOT_SET) // Exit
1498
+ requestChangeState (lastSystemState);
1499
+ else
1500
+ requestChangeState (theButton.newState );
1501
+
1502
+ break ;
1504
1503
}
1504
+ thisIsButton++;
1505
1505
}
1506
- break ;
1507
-
1506
+ }
1507
+ break ;
1508
1508
1509
1509
default :
1510
1510
systemPrintf (" buttonCheckTask double tap - untrapped system state: %d\r\n " , systemState);
1511
- // requestChangeState(STATE_BASE_NOT_STARTED);
1511
+ // requestChangeState(STATE_BASE_NOT_STARTED);
1512
1512
break ;
1513
1513
} // End doubleTap switch (systemState)
1514
- } // End doubleTap
1515
- } // End productVariant != Torch
1514
+ } // End doubleTap
1515
+ } // End productVariant != Torch
1516
1516
1517
1517
feedWdt ();
1518
1518
taskYIELD ();
0 commit comments