Skip to content

Commit 69989bc

Browse files
committed
Move EEPROM settings access so we can check enableResetDisplay setting. Move resetCount to purely NVM (no file).
1 parent f7cf3db commit 69989bc

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void beginBoard()
3838

3939
//Bug in ZED-F9P v1.13 firmware causes RTK LED to not light when RTK Floating with SBAS on.
4040
//The following changes the POR default but will be overwritten by settings in NVM or settings file
41-
ubxConstellations[1].enabled = false;
41+
ubxConstellations[1].enabled = false;
4242

4343
strcpy(platformFilePrefix, "SFE_Surveyor");
4444
strcpy(platformPrefix, "Surveyor");
@@ -112,14 +112,25 @@ void beginBoard()
112112
if (esp_reset_reason() == ESP_RST_POWERON)
113113
{
114114
reuseLastLog = false; //Start new log
115-
settings.resetCount = 0;
116-
recordSystemSettings(); //Record to NVM
115+
116+
loadSettingsPartial();
117+
if (settings.enableResetDisplay == true)
118+
{
119+
settings.resetCount = 0;
120+
recordSystemSettings(); //Record to NVM
121+
}
117122
}
118123
else
119124
{
120125
reuseLastLog = true; //Attempt to reuse previous log
121-
settings.resetCount++;
122-
recordSystemSettings(); //Record to NVM
126+
127+
loadSettingsPartial();
128+
if (settings.enableResetDisplay == true)
129+
{
130+
settings.resetCount++;
131+
recordSystemSettings(); //Record to NVM
132+
Serial.printf("resetCount: %d\n\r", settings.resetCount);
133+
}
123134

124135
Serial.print("Reset reason: ");
125136
switch (esp_reset_reason())
@@ -336,6 +347,7 @@ void beginGNSS()
336347

337348
printModuleInfo(); //Print module type and firmware version
338349
}
350+
339351
online.gnss = true;
340352
}
341353

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,6 @@ uint32_t casterResponseWaitStartTime = 0; //Used to detect if caster service tim
147147
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
148148
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
149149

150-
//Note: There are two prevalent versions of the ZED-F9P: v1.12 (part# -01B) and v1.13 (-02B).
151-
//v1.13 causes the RTK LED to not function if SBAS is enabled. To avoid this, we
152-
//disable SBAS by default.
153-
154150
char zedFirmwareVersion[20]; //The string looks like 'HPG 1.12'. Output to debug menu and settings file.
155151
uint8_t zedModuleType = PLATFORM_F9P; //Controls which messages are supported and configured
156152

@@ -221,7 +217,7 @@ uint8_t rBuffer[SERIAL_SIZE_RX]; //Buffer for reading from F9P to SPP
221217
uint8_t wBuffer[SERIAL_SIZE_RX]; //Buffer for writing from incoming SPP to F9P
222218
TaskHandle_t F9PSerialReadTaskHandle = NULL; //Store handles so that we can kill them if user goes into WiFi NTRIP Server mode
223219
TaskHandle_t F9PSerialWriteTaskHandle = NULL; //Store handles so that we can kill them if user goes into WiFi NTRIP Server mode
224-
const uint8_t F9PSerialWriteTaskPriority = 1; //Priority, with 3 being the highest, and 0 being the lowest.
220+
const uint8_t F9PSerialWriteTaskPriority = 1; //3 being the highest, and 0 being the lowest.
225221
const uint8_t F9PSerialReadTaskPriority = 1;
226222

227223
TaskHandle_t pinUART2TaskHandle = NULL; //Dummy task to start UART2 on core 0.
@@ -275,7 +271,7 @@ Button *setupBtn = NULL; //We can't instantiate the buttons here because we don'
275271
Button *powerBtn = NULL;
276272

277273
TaskHandle_t ButtonCheckTaskHandle = NULL;
278-
const uint8_t ButtonCheckTaskPriority = 1; //Priority, with 3 being the highest, and 0 being the lowest.
274+
const uint8_t ButtonCheckTaskPriority = 1; //3 being the highest, and 0 being the lowest.
279275
const int buttonTaskStackSize = 2000;
280276

281277
const int shutDownButtonTime = 2000; //ms press and hold before shutdown
@@ -360,20 +356,19 @@ void setup()
360356
Serial.begin(115200); //UART0 for programming and debugging
361357

362358
Wire.begin(); //Start I2C on core 1
363-
Wire.setClock(400000);
359+
//Wire.setClock(400000);
360+
Wire.setClock(100000);
364361

365362
beginGNSS(); //Connect to GNSS
366363

364+
beginEEPROM(); //Start EEPROM and SD for settings
365+
367366
beginBoard(); //Determine what hardware platform we are running on
368367

369368
beginDisplay(); //Check if an external Qwiic OLED is attached
370369

371370
beginLEDs(); //LED and PWM setup
372371

373-
//Start EEPROM and SD for settings, and display for output
374-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
375-
beginEEPROM();
376-
377372
//eepromErase();
378373

379374
beginSD(); //Test if SD is present
@@ -384,7 +379,6 @@ void setup()
384379
}
385380

386381
loadSettings(); //Attempt to load settings after SD is started so we can read the settings file if available
387-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
388382

389383
beginUART2(); //Start UART2 on core 0, used to receive serial from ZED and pass out over SPP
390384

Firmware/RTK_Surveyor/Tasks.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//High frequency tasks made by createTask()
1+
//High frequency tasks made by xTaskCreate()
22
//And any low frequency tasks that are called by Ticker
33

44
//If the phone has any new data (NTRIP RTCM, etc), read it in over Bluetooth and pass along to ZED

Firmware/RTK_Surveyor/menuDebug.ino

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ void menuDebug()
3838
if (settings.enableResetDisplay == true) Serial.println(F("Enabled"));
3939
else Serial.println(F("Disabled"));
4040

41+
Serial.println(F("r) Force system reset"));
42+
4143
Serial.println(F("x) Exit"));
4244

4345
byte incoming = getByteChoice(menuTimeout); //Timeout after x seconds
@@ -105,6 +107,15 @@ void menuDebug()
105107
else if (incoming == '8')
106108
{
107109
settings.enableResetDisplay ^= 1;
110+
if (settings.enableResetDisplay == true)
111+
{
112+
settings.resetCount = 0;
113+
recordSystemSettings(); //Record to NVM
114+
}
115+
}
116+
else if (incoming == 'r')
117+
{
118+
ESP.restart();
108119
}
109120
else if (incoming == 'x')
110121
break;

0 commit comments

Comments
 (0)