Skip to content

Commit 7ee5458

Browse files
committed
Update Example18_PointPerfectClient.ino
1 parent a525a27 commit 7ee5458

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

examples/ZED-F9P/Example18_PointPerfectClient/Example18_PointPerfectClient.ino

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> // Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
4646
SFE_UBLOX_GNSS myGNSS;
4747

48+
#define OK(ok) (ok ? F(" -> OK") : F(" -> ERROR!")) // Convert uint8_t into OK/ERROR
49+
4850
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
4951

5052
//Global variables
@@ -186,24 +188,29 @@ void setup()
186188

187189
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
188190

189-
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
191+
while (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
190192
{
191-
Serial.println(F("u-blox GPS not detected at default I2C address. Please check wiring. Freezing."));
192-
while (1);
193+
Serial.println(F("u-blox GNSS module not detected at default I2C address. Please check wiring."));
194+
delay(2000);
193195
}
194-
195-
Serial.println(F("u-blox module connected"));
196-
myGNSS.setI2COutput(COM_TYPE_UBX); //Turn off NMEA noise
197-
myGNSS.setPortInput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_SPARTN); // Be sure SPARTN input is enabled.
198-
199-
myGNSS.setDGNSSConfiguration(SFE_UBLOX_DGNSS_MODE_FIXED); // Set the differential mode - ambiguities are fixed whenever possible
200-
myGNSS.setNavigationFrequency(1); //Set output in Hz.
201-
myGNSS.setVal8(UBLOX_CFG_SPARTN_USE_SOURCE, 0); // Use IP source (default). Change this to 1 for L-Band (PMP)
196+
Serial.println(F("u-blox GNSS module connected"));
197+
198+
uint8_t ok = myGNSS.setI2COutput(COM_TYPE_UBX); //Turn off NMEA noise
199+
if (ok) ok = myGNSS.setPortInput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_SPARTN); // Be sure SPARTN input is enabled.
200+
201+
if (ok) ok = myGNSS.setDGNSSConfiguration(SFE_UBLOX_DGNSS_MODE_FIXED); // Set the differential mode - ambiguities are fixed whenever possible
202+
if (ok) ok = myGNSS.setNavigationFrequency(1); //Set output in Hz.
203+
if (ok) ok = myGNSS.setVal8(UBLOX_CFG_SPARTN_USE_SOURCE, 0); // Use IP source (default). Change this to 1 for L-Band (PMP)
202204

203-
myGNSS.setAutoPVTcallbackPtr(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata so we can watch the carrier solution go to fixed
205+
if (ok) ok = myGNSS.setAutoPVTcallbackPtr(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata so we can watch the carrier solution go to fixed
204206

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+
if (ok) ok = myGNSS.setVal8(UBLOX_CFG_MSGOUT_UBX_RXM_COR_I2C, 1); // Enable UBX-RXM-COR messages on I2C
208+
if (ok) ok = myGNSS.setRXMCORcallbackPtr(&printRXMCOR); // Print the contents of UBX-RXM-COR messages so we can check if the SPARTN data is being decrypted successfully
209+
210+
//if (ok) ok = myGNSS.saveConfiguration(VAL_CFG_SUBSEC_IOPORT | VAL_CFG_SUBSEC_MSGCONF); //Optional: Save the ioPort and message settings to NVM
211+
212+
Serial.print(F("GNSS: configuration "));
213+
Serial.println(OK(ok));
207214

208215
Serial.print(F("Connecting to local WiFi"));
209216
WiFi.begin(ssid, password);

0 commit comments

Comments
 (0)