3333SFE_UBLOX_GPS myGPS;
3434
3535#include < SerLCD.h> // Click here to get the library: http://librarymanager/All#SparkFun_SerLCD
36- SerLCD lcd; // Initialize the library with default I2C address 0x72
36+ SerLCD lcd; // Initialize the library with default I2C address 0x72
3737
3838void setup ()
3939{
4040 Serial.begin (115200 );
41- while (!Serial); // Wait for user to open terminal
41+ while (!Serial)
42+ ; // Wait for user to open terminal
4243 Serial.println (" Ublox GPS I2C Test" );
4344
4445 Wire.begin ();
4546
4647 pinMode (STAT_LED, OUTPUT);
4748 digitalWrite (STAT_LED, LOW);
4849
49- lcd.begin (Wire); // Set up the LCD for Serial communication at 9600bps
50+ lcd.begin (Wire); // Set up the LCD for Serial communication at 9600bps
5051 lcd.setBacklight (0x4B0082 ); // indigo, a kind of dark purplish blue
5152 lcd.clear ();
5253 lcd.print (F (" LCD Ready" ));
@@ -57,7 +58,8 @@ void setup()
5758 Serial.println (F (" Ublox GPS not detected at default I2C address. Please check wiring. Freezing." ));
5859 lcd.setCursor (0 , 1 );
5960 lcd.print (F (" No GPS detected" ));
60- while (1 );
61+ while (1 )
62+ ;
6163 }
6264
6365 Wire.setClock (400000 ); // Increase I2C clock speed to 400kHz
@@ -66,7 +68,7 @@ void setup()
6668 lcd.print (" GPS Detected" );
6769
6870 myGPS.setI2COutput (COM_TYPE_UBX); // Set the I2C port to output UBX only (turn off NMEA noise)
69- myGPS.saveConfiguration (); // Save the current settings to flash and BBR
71+ myGPS.saveConfiguration (); // Save the current settings to flash and BBR
7072
7173 boolean response = true ;
7274 response &= myGPS.enableRTCMmessage (UBX_RTCM_1005, COM_PORT_I2C, 1 ); // Enable message 1005 to output through I2C port, message every second
@@ -82,15 +84,17 @@ void setup()
8284 else
8385 {
8486 Serial.println (F (" RTCM failed to enable. Are you sure you have an NEO-M8P?" ));
85- while (1 ); // Freeze
87+ while (1 )
88+ ; // Freeze
8689 }
8790
8891 // Check if Survey is in Progress before initiating one
8992 response = myGPS.getSurveyStatus (2000 ); // Query module for SVIN status with 2000ms timeout (request can take a long time)
9093 if (response == false )
9194 {
9295 Serial.println (F (" Failed to get Survey In status" ));
93- while (1 ); // Freeze
96+ while (1 )
97+ ; // Freeze
9498 }
9599
96100 if (myGPS.svin .active == true )
@@ -108,12 +112,14 @@ void setup()
108112 Serial.println (F (" Survey start failed" ));
109113 lcd.setCursor (0 , 3 );
110114 lcd.print (F (" Survey start failed" ));
111- while (1 );
115+ while (1 )
116+ ;
112117 }
113- Serial.println (F (" Survey started. This will run until 300s has passed and less than 5m accuracy is achieved." ));
118+ Serial.println (F (" Survey started. This will run until 60s has passed and less than 5m accuracy is achieved." ));
114119 }
115120
116- while (Serial.available ()) Serial.read (); // Clear buffer
121+ while (Serial.available ())
122+ Serial.read (); // Clear buffer
117123
118124 lcd.clear ();
119125 lcd.print (F (" Survey in progress" ));
@@ -171,7 +177,7 @@ void loop()
171177 myGPS.checkUblox (); // See if new data is available. Process bytes as they come in.
172178
173179 // Do anything you want. Call checkUblox() every second. NEO-M8P-2 has TX buffer of 4k bytes.
174-
180+
175181 delay (250 ); // Don't pound too hard on the I2C bus
176182}
177183
@@ -181,8 +187,10 @@ void loop()
181187void SFE_UBLOX_GPS::processRTCM (uint8_t incoming)
182188{
183189 // Let's just pretty-print the HEX values for now
184- if (myGPS.rtcmFrameCounter % 16 == 0 ) Serial.println ();
190+ if (myGPS.rtcmFrameCounter % 16 == 0 )
191+ Serial.println ();
185192 Serial.print (" " );
186- if (incoming < 0x10 ) Serial.print (" 0" );
193+ if (incoming < 0x10 )
194+ Serial.print (" 0" );
187195 Serial.print (incoming, HEX);
188196}
0 commit comments