Skip to content

Commit fb7a0b8

Browse files
committed
Exit to previous state after pairing
1 parent cdfb29c commit fb7a0b8

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Firmware/RTK_Surveyor/ESPNOW.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ bool espnowIsPaired()
230230

231231
//Enable radio. User may have arrived here from the setup menu rather than serial menu.
232232
settings.radioType = RADIO_ESPNOW;
233-
recordSystemSettings();
233+
234+
recordSystemSettings(); //Record radioType and espnowPeerCount to NVM
234235

235236
espnowSetState(ESPNOW_PAIRED);
236237
return (true);

Firmware/RTK_Surveyor/States.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,9 @@ void updateSystemState()
920920
if (espnowIsPaired() == true)
921921
{
922922
paintEspNowPaired();
923-
changeState(STATE_ROVER_NOT_STARTED);
923+
924+
// Return to the previous state
925+
changeState(lastSystemState);
924926
}
925927
else
926928
{

Firmware/RTK_Surveyor/Tasks.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ void ButtonCheckTask(void *e)
415415
case STATE_WIFI_CONFIG:
416416
case STATE_ESPNOW_PAIRING_NOT_STARTED:
417417
case STATE_ESPNOW_PAIRING:
418-
lastSystemState = systemState; //Remember this state to return after we mark an event
418+
lastSystemState = systemState; //Remember this state to return after we mark an event or ESP-Now pair
419419
requestChangeState(STATE_DISPLAY_SETUP);
420420
setupState = STATE_MARK_EVENT;
421421
lastSetupMenuChange = millis();
@@ -535,7 +535,7 @@ void ButtonCheckTask(void *e)
535535
case STATE_WIFI_CONFIG:
536536
case STATE_ESPNOW_PAIRING_NOT_STARTED:
537537
case STATE_ESPNOW_PAIRING:
538-
lastSystemState = systemState; //Remember this state to return after we mark an event
538+
lastSystemState = systemState; //Remember this state to return after we mark an event or ESP-Now pair
539539
requestChangeState(STATE_DISPLAY_SETUP);
540540
setupState = STATE_MARK_EVENT;
541541
lastSetupMenuChange = millis();

0 commit comments

Comments
 (0)