Skip to content

Commit 574123a

Browse files
authored
Merge pull request #523 from LeeLeahy2/ota-data
Group together the OTA data
2 parents dc7f6e0 + 00ef917 commit 574123a

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ int pin_POCI = 19;
104104
int pin_SCK = 18;
105105
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
106106

107-
#include "esp_ota_ops.h" //Needed for partition counting and updateFromSD
108-
109107
// I2C for GNSS, battery gauge, display, accelerometer
110108
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
111109
#include <Wire.h>
@@ -186,10 +184,26 @@ bool sdSizeCheckTaskComplete = false;
186184
char logFileName[sizeof("SFE_Reference_Station_230101_120101.ubx_plusExtraSpace")] = {0};
187185
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
188186

187+
// Over-the-Air (OTA) update support
188+
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
189+
190+
#include "esp_ota_ops.h" //Needed for partition counting and updateFromSD
191+
192+
#ifdef COMPILE_WIFI
193+
#include "ESP32OTAPull.h" //http://librarymanager/All#ESP-OTA-Pull Used for getting
194+
#endif // COMPILE_WIFI
195+
196+
#define OTA_FIRMWARE_JSON_URL \
197+
"https://raw.githubusercontent.com/sparkfun/SparkFun_RTK_Firmware_Binaries/main/RTK-Firmware.json"
198+
#define OTA_RC_FIRMWARE_JSON_URL \
199+
"https://raw.githubusercontent.com/sparkfun/SparkFun_RTK_Firmware_Binaries/main/RTK-RC-Firmware.json"
200+
bool apConfigFirmwareUpdateInProcess = false; // Goes true once WiFi is connected and OTA pull begins
201+
unsigned int binBytesSent = 0; // Tracks firmware bytes sent over WiFi OTA update via AP config.
202+
203+
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
189204
// Connection settings to NTRIP Caster
190205
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
191206
#ifdef COMPILE_WIFI
192-
#include "ESP32OTAPull.h" //http://librarymanager/All#ESP-OTA-Pull Used for getting latest firmware OTA
193207
#include <ArduinoJson.h> //http://librarymanager/All#Arduino_JSON_messagepack v6.19.4
194208
#include <ESPmDNS.h> //Built-in.
195209
#include <HTTPClient.h> //Built-in. Needed for ThingStream API for ZTP
@@ -224,11 +238,6 @@ static uint32_t ntripServerTimer;
224238
static uint32_t ntripServerStartTime;
225239
static int ntripServerConnectionAttemptsTotal; // Count the number of connection attempts absolutely
226240

227-
#define OTA_FIRMWARE_JSON_URL \
228-
"https://raw.githubusercontent.com/sparkfun/SparkFun_RTK_Firmware_Binaries/main/RTK-Firmware.json"
229-
#define OTA_RC_FIRMWARE_JSON_URL \
230-
"https://raw.githubusercontent.com/sparkfun/SparkFun_RTK_Firmware_Binaries/main/RTK-RC-Firmware.json"
231-
bool apConfigFirmwareUpdateInProcess = false; // Goes true once WiFi is connected and OTA pull begins
232241
bool enableRCFirmware = false; // Goes true from AP config page
233242
bool currentlyParsingData = false; // Goes true when we hit 750ms timeout with new data
234243

@@ -437,7 +446,6 @@ const int maxBinFiles = 10;
437446
char binFileNames[maxBinFiles][50];
438447
const char *forceFirmwareFileName =
439448
"RTK_Surveyor_Firmware_Force.bin"; // File that will be loaded at startup regardless of user input
440-
unsigned int binBytesSent = 0; // Tracks firmware bytes sent over WiFi OTA update via AP config.
441449
int binBytesLastUpdate = 0; // Allows websocket notification to be sent every 100k bytes
442450
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
443451

0 commit comments

Comments
 (0)