File tree Expand file tree Collapse file tree 5 files changed +35
-0
lines changed Expand file tree Collapse file tree 5 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -362,3 +362,25 @@ void beginAccelerometer()
362362
363363 online.accelerometer = true ;
364364}
365+
366+ // Depending on platform and previous power down state, set system state
367+ void beginSystemState ()
368+ {
369+ if (productVariant == RTK_SURVEYOR)
370+ {
371+ // Assume Rover. checkButtons() will correct as needed.
372+ systemState = STATE_ROVER_NOT_STARTED;
373+ buttonPreviousState = BUTTON_BASE;
374+ }
375+ if (productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS)
376+ {
377+ systemState = settings.lastState ; // Return to system state previous to power down.
378+
379+ if (systemState == STATE_ROVER_NOT_STARTED)
380+ buttonPreviousState = BUTTON_ROVER;
381+ else if (systemState == STATE_BASE_NOT_STARTED)
382+ buttonPreviousState = BUTTON_BASE;
383+ else
384+ buttonPreviousState = BUTTON_ROVER;
385+ }
386+ }
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ void recordSystemSettingsToFile()
137137 settingsFile.println (" sppRxQueueSize=" + (String)settings.sppRxQueueSize );
138138 settingsFile.println (" sppTxQueueSize=" + (String)settings.sppTxQueueSize );
139139 settingsFile.println (" dynamicModel=" + (String)settings.dynamicModel );
140+ settingsFile.println (" lastState=" + (String)settings.lastState );
140141
141142 // Record message settings
142143 for (int x = 0 ; x < MAX_UBX_MSG ; x++)
@@ -385,6 +386,8 @@ bool parseLine(char* str) {
385386 settings.sppTxQueueSize = d;
386387 else if (strcmp (settingName, " dynamicModel" ) == 0 )
387388 settings.dynamicModel = d;
389+ else if (strcmp (settingName, " lastState" ) == 0 )
390+ settings.lastState = (SystemState)d;
388391
389392 // Check for message rates
390393 // Must be last on else list
Original file line number Diff line number Diff line change @@ -332,6 +332,8 @@ void setup()
332332
333333 beginAccelerometer ();
334334
335+ beginSystemState (); // Determine initial system state
336+
335337 Serial.flush (); // Complete any previous prints
336338
337339 danceLEDs (); // Turn on LEDs like a car dashboard
Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ void updateSystemState()
3232
3333 if (productVariant == RTK_SURVEYOR)
3434 digitalWrite (pin_baseStatusLED, LOW);
35+
36+ settings.lastState = STATE_ROVER_NOT_STARTED;
37+ recordSystemSettings ();
38+
3539 displayRoverSuccess (500 );
3640
3741 changeState (STATE_ROVER_NO_FIX);
@@ -101,6 +105,9 @@ void updateSystemState()
101105
102106 if (configureUbloxModuleBase () == true )
103107 {
108+ settings.lastState = STATE_BASE_NOT_STARTED; // Record this state for next POR
109+ recordSystemSettings ();
110+
104111 displayBaseSuccess (500 ); // Show 'Base Started'
105112
106113 if (settings.fixedBase == false )
Original file line number Diff line number Diff line change @@ -282,6 +282,7 @@ struct struct_settings {
282282 uint16_t sppRxQueueSize = 2048 ;
283283 uint16_t sppTxQueueSize = 512 ;
284284 uint8_t dynamicModel = DYN_MODEL_PORTABLE ;
285+ SystemState lastState = STATE_ROVER_NO_FIX ; //For Express, start unit in state prior to powerdown
285286} settings ;
286287
287288//These are the devices on board RTK Surveyor that may be on or offline.
You can’t perform that action at this time.
0 commit comments