You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
188
+
62
189
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
63
190
{
64
191
Serial.println(F("u-blox GPS not detected at default I2C address. Please check wiring. Freezing."));
@@ -73,6 +200,11 @@ void setup()
73
200
myGNSS.setNavigationFrequency(1); //Set output in Hz.
74
201
myGNSS.setVal8(UBLOX_CFG_SPARTN_USE_SOURCE, 0); // Use IP source (default). Change this to 1 for L-Band (PMP)
75
202
203
+
myGNSS.setAutoPVTcallbackPtr(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata so we can watch the carrier solution go to fixed
204
+
205
+
myGNSS.setVal8(UBLOX_CFG_MSGOUT_UBX_RXM_COR_I2C, 1); // Enable UBX-RXM-COR messages on I2C
206
+
myGNSS.setRXMCORcallbackPtr(&printRXMCOR); // Print the contents of UBX-RXM-COR messages so we can check if the SPARTN data is being decrypted successfully
207
+
76
208
Serial.print(F("Connecting to local WiFi"));
77
209
WiFi.begin(ssid, password);
78
210
while (WiFi.status() != WL_CONNECTED) {
@@ -85,19 +217,24 @@ void setup()
85
217
Serial.println(WiFi.localIP());
86
218
87
219
while (Serial.available()) Serial.read();
220
+
221
+
Serial.println(F("Press any key to start MQTT/SPARTN Client."));
222
+
88
223
}
89
224
90
225
voidloop()
91
226
{
92
227
if (Serial.available())
93
228
{
94
229
beginClient();
230
+
95
231
while (Serial.available()) Serial.read(); //Empty buffer of any newline chars
232
+
233
+
Serial.println(F("Press any key to start MQTT/SPARTN Client."));
96
234
}
97
235
98
-
Serial.println(F("Press any key to start MQTT/SPARTN Client."));
99
-
100
-
delay(1000);
236
+
myGNSS.checkUblox(); // Check for the arrival of new GNSS data and process it.
237
+
myGNSS.checkCallbacks(); // Check if any GNSS callbacks are waiting to be processed.
101
238
}
102
239
103
240
WiFiClientSecure wifiClient = WiFiClientSecure();
@@ -163,6 +300,7 @@ void beginClient()
163
300
else {
164
301
mqttClient.poll();
165
302
}
303
+
166
304
//Close socket if we don't have new data for 10s
167
305
if (millis() - lastReceived_ms > maxTimeBeforeHangup_ms)
168
306
{
@@ -172,6 +310,9 @@ void beginClient()
172
310
return;
173
311
}
174
312
313
+
myGNSS.checkUblox(); // Check for the arrival of new GNSS data and process it.
314
+
myGNSS.checkCallbacks(); // Check if any GNSS callbacks are waiting to be processed.
0 commit comments