1414 ZED-F9P to the phone and receive any RTCM from the phone and feed it back
1515 to the ZED-F9P to achieve RTK: F9PSerialWriteTask(), F9PSerialReadTask().
1616
17- A settings file is accessed on microSD if available otherwise settings are pulled from
17+ A settings file is accessed on microSD if available otherwise settings are pulled from
1818 ESP32's emulated EEPROM.
1919
2020 The main loop handles lower priority updates such as:
21- * Fuel gauge checking and power LED color update
22- * Setup switch monitoring (module configure between Rover and Base)
23- * Text menu interactions
24-
25- Menu System:
26- (Done) Log RAWX to SD
27- (Done) Display MAC address / broadcast name
21+ Fuel gauge checking and power LED color update
22+ Setup switch monitoring (module configure between Rover and Base)
23+ Text menu interactions
24+
25+ Main Menu (Display MAC address / broadcast name):
26+ (Done) GNSS - Configure measurement rate, reset module
27+ (Done) Log - Log to SD, enable/disable RAWX
28+ (Done) Base - Enter fixed coordinates, survey-in settings
2829 (Done) Test menu
29- Enable various debug output over BT?
30- Change broadcast name + MAC
31- Change max survey in time before cold start
32- Enter permanent coordinates
33- Enable/disable detection of permanent base
34- Set radius (5m default) for auto-detection of base
35- Set update rate
36-
30+
3731*/
3832
3933const int FIRMWARE_VERSION_MAJOR = 1 ;
@@ -203,24 +197,17 @@ void setup()
203197 checkBatteryLevels (); // Force display so you see battery level immediately at power on
204198
205199 beginBT (); // Get MAC, start radio
206-
200+
207201 beginGNSS (); // Connect and configure ZED-F9P
208202
209203 if (online.microSD == true )
210204 Serial.println (F (" microSD card online" ));
211205
212- // Display splash of some sort
213- if (online.display == true )
214- {
215- oled.drawIcon (1 , 35 , Antenna_Width, Antenna_Height, Antenna, sizeof (Antenna), true );
216- oled.display ();
217- }
218-
219206 Serial.flush (); // Complete any previous prints
220207
221208 danceLEDs (); // Turn on LEDs like a car dashboard
222209
223- if (online.microSD == true && settings.zedOutputLogging == true ) startLogTime_minutes = 0 ; // Mark now as start of logging
210+ if (online.microSD == true && settings.zedOutputLogging == true ) startLogTime_minutes = 0 ; // Mark now as start of logging
224211
225212 // myGPS.enableDebugging(); //Enable debug messages over Serial (default)
226213}
@@ -317,11 +304,10 @@ void updateDisplay()
317304 if (millis () - lastDisplayUpdate > 1000 )
318305 {
319306 lastDisplayUpdate = millis ();
320- Serial.println (" Display update" );
321307
322- // oled.clear(PAGE); // Clear the display's internal memory
323- // oled.clear(ALL); // Clear the library's display buffer
308+ oled.clear (PAGE); // Clear the display's internal buffer
324309
310+ // Current battery charge level
325311 if (battLevel < 25 )
326312 oled.drawIcon (45 , 0 , Battery_0_Width, Battery_0_Height, Battery_0, sizeof (Battery_0), true );
327313 else if (battLevel < 50 )
@@ -331,16 +317,56 @@ void updateDisplay()
331317 else // batt level > 75
332318 oled.drawIcon (45 , 0 , Battery_3_Width, Battery_3_Height, Battery_3, sizeof (Battery_3), true );
333319
334- // Bluetooth Address
335- char macAddress[5 ];
336- sprintf (macAddress, " %02X%02X" , unitMACAddress[4 ], unitMACAddress[5 ]);
337- Serial.printf (" MAC: %s" , macAddress);
320+ // Bluetooth Address or RSSI
321+ if (bluetoothState == BT_CONNECTED)
322+ {
323+ oled.drawIcon (4 , 0 , BT_Symbol_Width, BT_Symbol_Height, BT_Symbol, sizeof (BT_Symbol), true );
324+ }
325+ else
326+ {
327+ char macAddress[5 ];
328+ sprintf (macAddress, " %02X%02X" , unitMACAddress[4 ], unitMACAddress[5 ]);
329+ oled.setFontType (0 ); // Set font to smallest
330+ oled.setCursor (0 , 4 );
331+ oled.print (macAddress);
332+ }
333+
334+ if (digitalRead (baseSwitch) == LOW)
335+ oled.drawIcon (27 , 0 , Base_Width, Base_Height, Base, sizeof (Base), true ); // true - blend with other pixels
336+ else
337+ oled.drawIcon (27 , 3 , Rover_Width, Rover_Height, Rover, sizeof (Rover), true );
338+
339+ // Horz positional accuracy
340+ oled.setFontType (1 ); // Set font to type 1: 8x16
341+ oled.drawIcon (0 , 18 , CrossHair_Width, CrossHair_Height, CrossHair, sizeof (CrossHair), true );
342+ oled.setCursor (16 , 20 ); // x, y
343+ oled.print (" :" );
344+ float hpa = myGPS.getHorizontalAccuracy () / 10000.0 ;
345+ Serial.printf (" hpa: %03f\n " , hpa);
346+ if (hpa > 30.0 )
347+ {
348+ oled.print (" >30" );
349+ }
350+ else if (hpa > 9.9 )
351+ {
352+ oled.print (hpa, 1 ); // Print down to decimeter
353+ }
354+ else if (hpa > 1.0 )
355+ {
356+ oled.print (hpa, 2 ); // Print down to centimeter
357+ }
358+ else
359+ {
360+ oled.print (" ." ); // Remove leading zero
361+ oled.printf (" %03d" , (int )(hpa * 1000 )); // Print down to millimeter
362+ }
363+
364+ // SIV
365+ oled.drawIcon (2 , 35 , Antenna_Width, Antenna_Height, Antenna, sizeof (Antenna), true );
366+ oled.setCursor (16 , 36 ); // x, y
367+ oled.print (" :" );
368+ oled.print (myGPS.getSIV ());
338369
339- // oled.setFontType(1);
340- oled.setFontType (0 ); // Set font to smallest
341- oled.setCursor (0 , 4 );
342- // oled.print(macAddress);
343- oled.print (" O" );
344370
345371 oled.display ();
346372 }
@@ -395,10 +421,58 @@ void beginDisplay()
395421 {
396422 online.display = true ;
397423
398- // Init display
424+ // Init and display splash
399425 oled.begin (); // Initialize the OLED
400426 oled.clear (PAGE); // Clear the display's internal memory
401- oled.clear (ALL); // Clear the library's display buffer
427+
428+ oled.setCursor (10 , 2 ); // x, y
429+ oled.setFontType (0 ); // Set font to smallest
430+ oled.print (" SparkFun" );
431+
432+ oled.setCursor (21 , 13 );
433+ oled.setFontType (1 );
434+ oled.print (" RTK" );
435+
436+ int surveyorTextY = 25 ;
437+ int surveyorTextX = 2 ;
438+ int surveyorTextKerning = 8 ;
439+ oled.setFontType (1 );
440+
441+ oled.setCursor (surveyorTextX, surveyorTextY);
442+ oled.print (" S" );
443+
444+ surveyorTextX += surveyorTextKerning;
445+ oled.setCursor (surveyorTextX, surveyorTextY);
446+ oled.print (" u" );
447+
448+ surveyorTextX += surveyorTextKerning;
449+ oled.setCursor (surveyorTextX, surveyorTextY);
450+ oled.print (" r" );
451+
452+ surveyorTextX += surveyorTextKerning;
453+ oled.setCursor (surveyorTextX, surveyorTextY);
454+ oled.print (" v" );
455+
456+ surveyorTextX += surveyorTextKerning;
457+ oled.setCursor (surveyorTextX, surveyorTextY);
458+ oled.print (" e" );
459+
460+ surveyorTextX += surveyorTextKerning;
461+ oled.setCursor (surveyorTextX, surveyorTextY);
462+ oled.print (" y" );
463+
464+ surveyorTextX += surveyorTextKerning;
465+ oled.setCursor (surveyorTextX, surveyorTextY);
466+ oled.print (" o" );
467+
468+ surveyorTextX += surveyorTextKerning;
469+ oled.setCursor (surveyorTextX, surveyorTextY);
470+ oled.print (" r" );
471+
472+ oled.setCursor (20 , 41 );
473+ oled.setFontType (0 ); // Set font to smallest
474+ oled.printf (" v%d.%d" , FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR);
475+ oled.display ();
402476 }
403477}
404478
@@ -417,22 +491,22 @@ void beginGNSS()
417491 }
418492
419493 // Check the firmware version of the ZED-F9P. Based on Example21_ModuleInfo.
420- // if (myGPS.getModuleInfo(1100) == true) // Try to get the module info
421- // {
422- // if (strcmp(myGPS.minfo.extension[1], latestZEDFirmware) != 0)
423- // {
424- // Serial.print("The ZED-F9P appears to have outdated firmware. Found: ");
425- // Serial.println(myGPS.minfo.extension[1]);
426- // Serial.print("The Surveyor works best with ");
427- // Serial.println(latestZEDFirmware);
428- // Serial.print("Please upgrade using u-center.");
429- // Serial.println();
430- // }
431- // else
432- // {
433- // Serial.println("ZED-F9P firmware is current");
434- // }
435- // }
494+ // if (myGPS.getModuleInfo(1100) == true) // Try to get the module info
495+ // {
496+ // if (strcmp(myGPS.minfo.extension[1], latestZEDFirmware) != 0)
497+ // {
498+ // Serial.print("The ZED-F9P appears to have outdated firmware. Found: ");
499+ // Serial.println(myGPS.minfo.extension[1]);
500+ // Serial.print("The Surveyor works best with ");
501+ // Serial.println(latestZEDFirmware);
502+ // Serial.print("Please upgrade using u-center.");
503+ // Serial.println();
504+ // }
505+ // else
506+ // {
507+ // Serial.println("ZED-F9P firmware is current");
508+ // }
509+ // }
436510
437511 bool response = configureUbloxModule ();
438512 if (response == false )
@@ -470,7 +544,7 @@ void beginBT()
470544 bluetoothState = BT_ON_NOCONNECTION;
471545 digitalWrite (bluetoothStatusLED, HIGH);
472546 lastBluetoothLEDBlink = millis ();
473- }
547+ }
474548}
475549
476550// Set LEDs for output and configure PWM
0 commit comments