Skip to content

Commit 89cbcd1

Browse files
committed
Add prelim support for ZED-F9R
1 parent e734939 commit 89cbcd1

File tree

14 files changed

+280
-187
lines changed

14 files changed

+280
-187
lines changed

Firmware/RTK_Surveyor/Base.ino

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ bool configureUbloxModuleBase()
55
bool response = true;
66
int maxWait = 2000;
77

8-
if (productVariant == RTK_SURVEYOR)
9-
{
10-
digitalWrite(pin_positionAccuracyLED_1cm, LOW);
11-
digitalWrite(pin_positionAccuracyLED_10cm, LOW);
12-
digitalWrite(pin_positionAccuracyLED_100cm, LOW);
13-
}
14-
158
i2cGNSS.checkUblox(); //Regularly poll to get latest data and any RTCM
169

1710
if (i2cGNSS.getSurveyInActive() == true)

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ void beginBoard()
1212
}
1313
else if (isConnected(0x19) == true) //Check for accelerometer
1414
{
15-
productVariant = RTK_EXPRESS;
15+
if (zedModuleType == PLATFORM_F9P) productVariant = RTK_EXPRESS;
16+
else if (zedModuleType == PLATFORM_F9R) productVariant = RTK_EXPRESS_PLUS;
1617
}
1718
else
1819
{
@@ -38,7 +39,7 @@ void beginBoard()
3839
strcpy(platformFilePrefix, "SFE_Surveyor");
3940
strcpy(platformPrefix, "Surveyor");
4041
}
41-
else if (productVariant == RTK_EXPRESS)
42+
else if (productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS_PLUS)
4243
{
4344
pin_muxA = 2;
4445
pin_muxB = 4;
@@ -61,8 +62,16 @@ void beginBoard()
6162

6263
setMuxport(settings.dataPortChannel); //Set mux to user's choice: NMEA, I2C, PPS, or DAC
6364

64-
strcpy(platformFilePrefix, "SFE_Express");
65-
strcpy(platformPrefix, "Express");
65+
if (productVariant == RTK_EXPRESS)
66+
{
67+
strcpy(platformFilePrefix, "SFE_Express");
68+
strcpy(platformPrefix, "Express");
69+
}
70+
else if (productVariant == RTK_EXPRESS_PLUS)
71+
{
72+
strcpy(platformFilePrefix, "SFE_Express_Plus");
73+
strcpy(platformPrefix, "Express Plus");
74+
}
6675
}
6776
else if (productVariant == RTK_FACET)
6877
{
@@ -268,7 +277,7 @@ void beginDisplay()
268277
}
269278
}
270279

271-
//Connect to and configure ZED-F9P
280+
//Connect to ZED module and identify particulars
272281
void beginGNSS()
273282
{
274283
if (i2cGNSS.begin() == false)
@@ -297,10 +306,24 @@ void beginGNSS()
297306
if (ptr != NULL)
298307
strcpy(zedFirmwareVersion, ptr + strlen("FWVER="));
299308

300-
Serial.print(F("ZED-F9P firmware: "));
301-
Serial.println(zedFirmwareVersion);
309+
//Determine if we have a ZED-F9P (Express/Facet) or an ZED-F9R (Express Plus/Facet Plus)
310+
if (strstr(i2cGNSS.minfo.extension[3], "ZED-F9P") != NULL)
311+
{
312+
zedModuleType = PLATFORM_F9P;
313+
}
314+
else if (strstr(i2cGNSS.minfo.extension[3], "ZED-F9R") != NULL)
315+
{
316+
zedModuleType = PLATFORM_F9R;
317+
}
318+
319+
printModuleInfo(); //Print module type and firmware version
302320
}
321+
online.gnss = true;
322+
}
303323

324+
//Configuration can take >1s so configure during splash
325+
void configureGNSS()
326+
{
304327
bool response = configureUbloxModule();
305328
if (response == false)
306329
{
@@ -318,8 +341,6 @@ void beginGNSS()
318341
}
319342

320343
Serial.println(F("GNSS configuration complete"));
321-
322-
online.gnss = true;
323344
}
324345

325346
//Set LEDs for output and configure PWM
@@ -400,7 +421,7 @@ void beginSystemState()
400421

401422
setupBtn = new Button(pin_setupButton); //Create the button in memory
402423
}
403-
else if (productVariant == RTK_EXPRESS)
424+
else if (productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS_PLUS)
404425
{
405426
systemState = settings.lastState; //Return to system state previous to power down.
406427

Firmware/RTK_Surveyor/Buttons.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
//Let's make sure they continue to press for two seconds
44
void powerOnCheck()
55
{
6+
#ifndef COMPILE_WIFI
7+
return;
8+
#endif
9+
#ifndef COMPILE_BT
10+
return;
11+
#endif
12+
613
powerPressedStartTime = millis();
714
while (digitalRead(pin_powerSenseAndControl) == LOW)
815
{

Firmware/RTK_Surveyor/Display.ino

Lines changed: 87 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -113,46 +113,38 @@ void displaySplash()
113113
oled.begin(); // Initialize the OLED
114114
oled.clear(PAGE); // Clear the display's internal memory
115115

116-
oled.setCursor(10, 2); //x, y
117-
oled.setFontType(0); //Set font to smallest
118-
oled.print(F("SparkFun"));
116+
int yPos = 0;
117+
int fontHeight = 8;
119118

120-
oled.setCursor(21, 13);
121-
oled.setFontType(1);
122-
oled.print(F("RTK"));
119+
printTextCenter("SparkFun", yPos, 0, 1, false); //text, y, font type, kerning, inverted
123120

124-
int textX;
125-
int textY;
126-
int textKerning;
121+
yPos = yPos + fontHeight + 2;
122+
printTextCenter("RTK", yPos, 1, 1, false);
123+
124+
yPos = yPos + fontHeight + 4;
127125

128126
if (productVariant == RTK_SURVEYOR)
129127
{
130-
textX = 2;
131-
textY = 25;
132-
textKerning = 8;
133-
oled.setFontType(1);
134-
printTextwithKerning("Surveyor", textX, textY, textKerning);
128+
printTextCenter("Surveyor", yPos, 1, 1, false);
135129
}
136130
else if (productVariant == RTK_EXPRESS)
137131
{
138-
textX = 3;
139-
textY = 25;
140-
textKerning = 9;
141-
oled.setFontType(1);
142-
printTextwithKerning("Express", textX, textY, textKerning);
132+
printTextCenter("Express", yPos, 1, 1, false);
133+
}
134+
else if (productVariant == RTK_EXPRESS_PLUS)
135+
{
136+
printTextCenter("Express+", yPos, 1, 1, false);
143137
}
144138
else if (productVariant == RTK_FACET)
145139
{
146-
textX = 11;
147-
textY = 25;
148-
textKerning = 9;
149-
oled.setFontType(1);
150-
printTextwithKerning("Facet", textX, textY, textKerning);
140+
printTextCenter("Facet", yPos, 1, 1, false);
151141
}
152142

153-
oled.setCursor(20, 41);
154-
oled.setFontType(0); //Set font to smallest
155-
oled.printf("v%d.%d", FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR);
143+
yPos = yPos + fontHeight + 9;
144+
char unitFirmware[50];
145+
sprintf(unitFirmware, "v%d.%d", FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR);
146+
printTextCenter(unitFirmware, yPos, 0, 1, false);
147+
156148
oled.display();
157149
}
158150
}
@@ -1362,42 +1354,76 @@ void paintDisplaySetup()
13621354
{
13631355
if (online.display == true)
13641356
{
1365-
if (setupState == STATE_MARK_EVENT)
1366-
{
1367-
printTextCenter("Mark", 12 * 0, 1, 1, true); //string, y, font type, kerning, inverted
1368-
printTextCenter("Rover", 12 * 1, 1, 1, false);
1369-
printTextCenter("Base", 12 * 2, 1, 1, false);
1370-
printTextCenter("Bubble", 12 * 3, 1, 1, false);
1371-
}
1372-
else if (setupState == STATE_ROVER_NOT_STARTED)
1373-
{
1374-
printTextCenter("Mark", 12 * 0, 1, 1, false);
1375-
printTextCenter("Rover", 12 * 1, 1, 1, true);
1376-
printTextCenter("Base", 12 * 2, 1, 1, false);
1377-
printTextCenter("Bubble", 12 * 3, 1, 1, false);
1378-
}
1379-
else if (setupState == STATE_BASE_NOT_STARTED)
1380-
{
1381-
printTextCenter("Mark", 12 * 0, 1, 1, false); //string, y, font type, kerning, inverted
1382-
printTextCenter("Rover", 12 * 1, 1, 1, false);
1383-
printTextCenter("Base", 12 * 2, 1, 1, true);
1384-
printTextCenter("Bubble", 12 * 3, 1, 1, false);
1385-
}
1386-
else if (setupState == STATE_BUBBLE_LEVEL)
1357+
if (zedModuleType == PLATFORM_F9P)
13871358
{
1388-
printTextCenter("Mark", 12 * 0, 1, 1, false); //string, y, font type, kerning, inverted
1389-
printTextCenter("Rover", 12 * 1, 1, 1, false);
1390-
printTextCenter("Base", 12 * 2, 1, 1, false);
1391-
printTextCenter("Bubble", 12 * 3, 1, 1, true);
1392-
}
1393-
else if (setupState == STATE_WIFI_CONFIG_NOT_STARTED)
1359+
if (setupState == STATE_MARK_EVENT)
1360+
{
1361+
printTextCenter("Mark", 12 * 0, 1, 1, true); //string, y, font type, kerning, inverted
1362+
printTextCenter("Rover", 12 * 1, 1, 1, false);
1363+
printTextCenter("Base", 12 * 2, 1, 1, false);
1364+
printTextCenter("Bubble", 12 * 3, 1, 1, false);
1365+
}
1366+
else if (setupState == STATE_ROVER_NOT_STARTED)
1367+
{
1368+
printTextCenter("Mark", 12 * 0, 1, 1, false);
1369+
printTextCenter("Rover", 12 * 1, 1, 1, true);
1370+
printTextCenter("Base", 12 * 2, 1, 1, false);
1371+
printTextCenter("Bubble", 12 * 3, 1, 1, false);
1372+
}
1373+
else if (setupState == STATE_BASE_NOT_STARTED)
1374+
{
1375+
printTextCenter("Mark", 12 * 0, 1, 1, false); //string, y, font type, kerning, inverted
1376+
printTextCenter("Rover", 12 * 1, 1, 1, false);
1377+
printTextCenter("Base", 12 * 2, 1, 1, true);
1378+
printTextCenter("Bubble", 12 * 3, 1, 1, false);
1379+
}
1380+
else if (setupState == STATE_BUBBLE_LEVEL)
1381+
{
1382+
printTextCenter("Mark", 12 * 0, 1, 1, false); //string, y, font type, kerning, inverted
1383+
printTextCenter("Rover", 12 * 1, 1, 1, false);
1384+
printTextCenter("Base", 12 * 2, 1, 1, false);
1385+
printTextCenter("Bubble", 12 * 3, 1, 1, true);
1386+
}
1387+
else if (setupState == STATE_WIFI_CONFIG_NOT_STARTED)
1388+
{
1389+
printTextCenter("Rover", 12 * 0, 1, 1, false);
1390+
printTextCenter("Base", 12 * 1, 1, 1, false);
1391+
printTextCenter("Bubble", 12 * 2, 1, 1, false);
1392+
printTextCenter("Config", 12 * 3, 1, 1, true);
1393+
}
1394+
} //end type F9P
1395+
else if (zedModuleType == PLATFORM_F9R)
13941396
{
1395-
printTextCenter("Rover", 12 * 0, 1, 1, false);
1396-
printTextCenter("Base", 12 * 1, 1, 1, false);
1397-
printTextCenter("Bubble", 12 * 2, 1, 1, false);
1398-
printTextCenter("Config", 12 * 3, 1, 1, true);
1399-
}
1400-
}
1397+
if (setupState == STATE_MARK_EVENT)
1398+
{
1399+
printTextCenter("Mark", 12 * 0, 1, 1, true); //string, y, font type, kerning, inverted
1400+
printTextCenter("Rover", 12 * 1, 1, 1, false);
1401+
printTextCenter("Bubble", 12 * 2, 1, 1, false);
1402+
printTextCenter("Config", 12 * 3, 1, 1, false);
1403+
}
1404+
else if (setupState == STATE_ROVER_NOT_STARTED)
1405+
{
1406+
printTextCenter("Mark", 12 * 0, 1, 1, false);
1407+
printTextCenter("Rover", 12 * 1, 1, 1, true);
1408+
printTextCenter("Bubble", 12 * 2, 1, 1, false);
1409+
printTextCenter("Config", 12 * 3, 1, 1, false);
1410+
}
1411+
else if (setupState == STATE_BUBBLE_LEVEL)
1412+
{
1413+
printTextCenter("Mark", 12 * 0, 1, 1, false);
1414+
printTextCenter("Rover", 12 * 1, 1, 1, false);
1415+
printTextCenter("Bubble", 12 * 2, 1, 1, true);
1416+
printTextCenter("Config", 12 * 3, 1, 1, false);
1417+
}
1418+
else if (setupState == STATE_WIFI_CONFIG_NOT_STARTED)
1419+
{
1420+
printTextCenter("Mark", 12 * 0, 1, 1, false);
1421+
printTextCenter("Rover", 12 * 1, 1, 1, false);
1422+
printTextCenter("Bubble", 12 * 2, 1, 1, false);
1423+
printTextCenter("Config", 12 * 3, 1, 1, true);
1424+
}
1425+
} //end type F9R
1426+
} //end display online
14011427
}
14021428

14031429
//Given text, and location, print text center of the screen

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
const int FIRMWARE_VERSION_MAJOR = 1;
4242
const int FIRMWARE_VERSION_MINOR = 5;
4343

44-
#define COMPILE_WIFI 1 //Comment out to remove all WiFi functionality
45-
#define COMPILE_BT 1 //Comment out to disable all Bluetooth
44+
//#define COMPILE_WIFI 1 //Comment out to remove all WiFi functionality
45+
//#define COMPILE_BT 1 //Comment out to disable all Bluetooth
4646

4747
//Define the RTK board identifier:
4848
// This is an int which is unique to this variant of the RTK Surveyor hardware which allows us
@@ -151,6 +151,7 @@ uint32_t casterResponseWaitStartTime = 0; //Used to detect if caster service tim
151151
//disable SBAS by default.
152152

153153
char zedFirmwareVersion[20]; //The string looks like 'FWVER=HPG 1.12'. Output to debug menu and settings file.
154+
uint8_t zedModuleType = PLATFORM_F9P; //Controls which messages are supported and configured
154155

155156
// Extend the class for getModuleInfo. Used to diplay ZED-F9P firmware version in debug menu.
156157
class SFE_UBLOX_GNSS_ADD : public SFE_UBLOX_GNSS
@@ -295,7 +296,6 @@ int incomingSettingsSpot = 0;
295296
unsigned long timeSinceLastIncomingSetting = 0;
296297
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
297298

298-
299299
//Global variables
300300
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
301301
uint8_t unitMACAddress[6]; //Use MAC address in BT broadcast and display
@@ -358,6 +358,8 @@ void setup()
358358
Wire.begin(); //Start I2C on core 1
359359
Wire.setClock(400000);
360360

361+
beginGNSS(); //Connect to GNSS
362+
361363
beginBoard(); //Determine what hardware platform we are running on
362364

363365
beginDisplay(); //Check if an external Qwiic OLED is attached
@@ -385,7 +387,7 @@ void setup()
385387
beginFuelGauge(); //Configure battery fuel guage monitor
386388
checkBatteryLevels(); //Force display so you see battery level immediately at power on
387389

388-
beginGNSS(); //Connect and configure ZED-F9P
390+
configureGNSS(); //Configure ZED module
389391

390392
beginAccelerometer();
391393

Firmware/RTK_Surveyor/Rover.ino

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ bool configureUbloxModuleRover()
55
bool response = true;
66
int maxWait = 2000;
77

8-
response = i2cGNSS.disableSurveyMode(maxWait); //Disable survey
9-
if (response == false)
10-
Serial.println(F("Disable Survey failed"));
8+
//Survey mode is only available on ZED-F9P modules
9+
if (zedModuleType == PLATFORM_F9P)
10+
{
11+
response = i2cGNSS.disableSurveyMode(maxWait); //Disable survey
12+
if (response == false)
13+
Serial.println(F("Disable Survey failed"));
14+
}
1115

1216
// Set dynamic model
1317
if (i2cGNSS.getDynamicModel(maxWait) != settings.dynamicModel)
@@ -17,11 +21,15 @@ bool configureUbloxModuleRover()
1721
Serial.println(F("setDynamicModel failed"));
1822
}
1923

20-
//Disable RTCM sentences on I2C, USB, and UART2
21-
response = true; //Reset
22-
response &= disableRTCMSentences(COM_PORT_I2C);
23-
response &= disableRTCMSentences(COM_PORT_UART2);
24-
response &= disableRTCMSentences(COM_PORT_USB);
24+
//RTCM is only available on ZED-F9P modules
25+
if (zedModuleType == PLATFORM_F9P)
26+
{
27+
//Disable RTCM sentences on I2C, USB, and UART2
28+
response = true; //Reset
29+
response &= disableRTCMSentences(COM_PORT_I2C);
30+
response &= disableRTCMSentences(COM_PORT_UART2);
31+
response &= disableRTCMSentences(COM_PORT_USB);
32+
}
2533

2634
//Re-enable any RTCM msgs on UART1 the user has set within settings
2735
response &= configureGNSSMessageRates(COM_PORT_UART1, ubxMessages); //Make sure the appropriate messages are enabled

0 commit comments

Comments
 (0)