@@ -3,9 +3,6 @@ bool configureUbloxModuleBase()
3
3
{
4
4
if (online.gnss == false ) return (false );
5
5
6
- bool response = true ;
7
- int maxWait = 2000 ;
8
-
9
6
// If our settings haven't changed, and this is first config since power on, trust ZED's settings
10
7
if (settings.updateZEDSettings == false && firstPowerOn == true )
11
8
{
@@ -18,75 +15,73 @@ bool configureUbloxModuleBase()
18
15
19
16
i2cGNSS.checkUblox (); // Regularly poll to get latest data and any RTCM
20
17
21
- const int baseNavigationFrequency = 1 ;
22
-
23
- // In Base mode we force 1Hz
24
- response &= setRate (1 );
25
- if (response == false )
26
- Serial.println (" Set rate failed" );
18
+ i2cGNSS.setNMEAGPGGAcallbackPtr (NULL ); // Disable GPGGA call back that may have been set during Rover NTRIP Client mode
27
19
28
- i2cGNSS. checkUblox (); // Regularly poll to get latest data and any RTCM
20
+ bool response = true ;
29
21
30
- i2cGNSS.setNMEAGPGGAcallbackPtr (NULL ); // Disable GPGGA call back that may have been set during Rover NTRIP Client mode
31
- i2cGNSS.disableNMEAMessage (UBX_NMEA_GGA, COM_PORT_I2C); // Disable NMEA message that may have been set during Rover NTRIP Client mode
22
+ // In Base mode we force 1Hz
23
+ response &= i2cGNSS.newCfgValset16 (UBLOX_CFG_RATE_MEAS, 1000 );
24
+ response &= i2cGNSS.addCfgValset16 (UBLOX_CFG_RATE_NAV, 1 );
32
25
33
- response = i2cGNSS.setSurveyMode (0 , 0 , 0 ); // Disable Survey-In or Fixed Mode
34
- if (response == false )
35
- Serial.println (" Disable TMODE3 failed" );
26
+ // Since we are at 1Hz, allow GSV NMEA to be reported at whatever the user has chosen
27
+ response &= i2cGNSS.addCfgValset8 (settings.ubxMessages [8 ].msgConfigKey , settings.ubxMessages [8 ].msgRate ); // Update rate on module
36
28
37
- // Set dynamic model
38
- if (i2cGNSS.getDynamicModel (maxWait) != DYN_MODEL_STATIONARY)
39
- {
40
- response &= i2cGNSS.setDynamicModel (DYN_MODEL_STATIONARY, maxWait);
41
- if (response == false )
42
- {
43
- Serial.println (" setDynamicModel failed" );
44
- return (false );
45
- }
46
- }
29
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_NMEA_ID_GGA_I2C, 0 ); // Disable NMEA message that may have been set during Rover NTRIP Client mode
47
30
48
- #define OUTPUT_SETTING 14
31
+ // Survey mode is only available on ZED-F9P modules
32
+ if (zedModuleType == PLATFORM_F9P)
33
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_TMODE_MODE, 0 ); // Disable survey-in mode
49
34
50
- // Turn on RTCM so that we can harvest RTCM over I2C and send out over WiFi
51
- // This is easier than parsing over UART because the library handles the frame detection
52
- getPortSettings (COM_PORT_I2C); // Load the settingPayload with this port's settings
53
- if (settingPayload[OUTPUT_SETTING] != (COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_RTCM3))
54
- response &= i2cGNSS.setPortOutput (COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_RTCM3); // Set the I2C port to output UBX (config), and RTCM3 (casting)
55
- // response &= i2cGNSS.setPortOutput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_RTCM3); //Not a valid state. Goes to UBX+NMEA+RTCM3
35
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_NAVSPG_DYNMODEL, (dynModel)settings.dynamicModel ); // Set dynamic model
56
36
57
- // In base mode the Surveyor should output RTCM over all ports:
37
+ // In base mode the RTK device should output RTCM over all ports:
58
38
// (Primary) UART2 in case the Surveyor is connected via radio to rover
59
39
// (Optional) I2C in case user wants base to connect to WiFi and NTRIP Caster
60
40
// (Seconday) USB in case the Surveyor is used as an NTRIP caster connected to SBC or other
61
41
// (Tertiary) UART1 in case Surveyor is sending RTCM to phone that is then NTRIP Caster
62
- response &= enableRTCMSentences (COM_PORT_UART2);
63
- response &= enableRTCMSentences (COM_PORT_UART1);
64
- response &= enableRTCMSentences (COM_PORT_USB);
65
- response &= enableRTCMSentences (COM_PORT_I2C); // Enable for plain radio so we can count RTCM packets for display
66
-
67
- // If enabled, adjust GSV NMEA to be reported at 1Hz
68
- if (settings.ubxMessages [8 ].msgRate > baseNavigationFrequency)
69
- setMessageRateByName (" UBX_NMEA_GSV" , baseNavigationFrequency); // Update GSV setting in file
70
-
71
- response &= configureGNSSMessageRates (COM_PORT_UART1, settings.ubxMessages ); // In the interest of logging, make sure the appropriate messages are enabled
42
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1 );
43
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1074_I2C, 1 );
44
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1084_I2C, 1 );
45
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1094_I2C, 1 );
46
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1124_I2C, 1 );
47
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1230_I2C, 1 );
48
+
49
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_USB, 1 );
50
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1074_USB, 1 );
51
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1084_USB, 1 );
52
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1094_USB, 1 );
53
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1124_USB, 1 );
54
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1230_USB, 1 );
55
+
56
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_UART1, 1 );
57
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1074_UART1, 1 );
58
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1084_UART1, 1 );
59
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1094_UART1, 1 );
60
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1124_UART1, 1 );
61
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1230_UART1, 1 );
62
+
63
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_UART2, 1 );
64
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1074_UART2, 1 );
65
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1084_UART2, 1 );
66
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1094_UART2, 1 );
67
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1124_UART2, 1 );
68
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1230_UART2, 1 );
69
+
70
+ response &= i2cGNSS.sendCfgValset8 (UBLOX_CFG_MSGOUT_NMEA_ID_VTG_SPI, 0 ); // Dummy closing value - #31
72
71
73
72
if (response == false )
74
- {
75
- Serial.println (" RTCM settings failed to enable" );
76
- return (false );
77
- }
78
-
79
- response &= i2cGNSS.saveConfiguration (); // Save the current settings to flash and BBR
80
- if (response == false )
81
- Serial.println (" Module failed to save." );
73
+ Serial.println (" Base config fail" );
82
74
83
75
return (response);
84
76
}
85
77
86
78
// Start survey
87
79
// The ZED-F9P is slightly different than the NEO-M8P. See the Integration manual 3.5.8 for more info.
88
- bool beginSurveyIn ()
80
+ bool surveyInStart ()
89
81
{
82
+ i2cGNSS.setVal8 (UBLOX_CFG_TMODE_MODE, 0 ); // Disable survey-in mode
83
+ delay (100 );
84
+
90
85
bool needSurveyReset = false ;
91
86
if (i2cGNSS.getSurveyInActive (100 ) == true ) needSurveyReset = true ;
92
87
if (i2cGNSS.getSurveyInValid (100 ) == true ) needSurveyReset = true ;
@@ -95,17 +90,19 @@ bool beginSurveyIn()
95
90
{
96
91
Serial.println (" Resetting survey" );
97
92
98
- if (resetSurvey () == false )
93
+ if (surveyInReset () == false )
99
94
{
100
95
Serial.println (" Survey reset failed" );
101
- if (resetSurvey () == false )
102
- {
96
+ if (surveyInReset () == false )
103
97
Serial.println (" Survey reset failed - 2nd attempt" );
104
- }
105
98
}
106
99
}
107
100
108
- bool response = i2cGNSS.enableSurveyMode (settings.observationSeconds , settings.observationPositionAccuracy , 5000 ); // Enable Survey in, with user parameters. Wait up to 5s.
101
+ bool response = true ;
102
+ response &= i2cGNSS.setVal8 (UBLOX_CFG_TMODE_MODE, 1 ); // Survey-in enable
103
+ response &= i2cGNSS.setVal32 (UBLOX_CFG_TMODE_SVIN_ACC_LIMIT, settings.observationPositionAccuracy * 10000 );
104
+ response &= i2cGNSS.setVal32 (UBLOX_CFG_TMODE_SVIN_MIN_DUR, settings.observationSeconds );
105
+
109
106
if (response == false )
110
107
{
111
108
Serial.println (" Survey start failed" );
@@ -129,16 +126,25 @@ bool beginSurveyIn()
129
126
return (true );
130
127
}
131
128
132
- bool resetSurvey ()
129
+ // Slightly modified method for restarting survey-in from: https://portal.u-blox.com/s/question/0D52p00009IsVoMCAV/restarting-surveyin-on-an-f9p
130
+ bool surveyInReset ()
133
131
{
134
132
int maxWait = 2000 ;
135
133
136
- // Slightly modified method for restarting survey-in from: https://portal.u-blox.com/s/question/0D52p00009IsVoMCAV/restarting-surveyin-on-an-f9p
137
- bool response = i2cGNSS.setSurveyMode (maxWait, 0 , 0 ); // Disable Survey-In or Fixed Mode
134
+ bool response = true ;
135
+
136
+ // Disable survey-in mode
137
+ response &= i2cGNSS.setVal8 (UBLOX_CFG_TMODE_MODE, 0 );
138
138
delay (1000 );
139
- response &= i2cGNSS.enableSurveyMode (1000 , 400.000 , maxWait); // Enable Survey in with bogus values
139
+
140
+ // Enable Survey in with bogus values
141
+ response &= i2cGNSS.newCfgValset8 (UBLOX_CFG_TMODE_MODE, 1 ); // Survey-in enable
142
+ response &= i2cGNSS.addCfgValset32 (UBLOX_CFG_TMODE_SVIN_ACC_LIMIT, 40 * 10000 ); // 40.0m
143
+ response &= i2cGNSS.sendCfgValset32 (UBLOX_CFG_TMODE_SVIN_MIN_DUR, 1000 ); // 1000s
140
144
delay (1000 );
141
- response &= i2cGNSS.setSurveyMode (maxWait, 0 , 0 ); // Disable Survey-In or Fixed Mode
145
+
146
+ // Disable survey-in mode
147
+ response &= i2cGNSS.setVal8 (UBLOX_CFG_TMODE_MODE, 0 );
142
148
143
149
if (response == false )
144
150
return (response);
@@ -158,7 +164,7 @@ bool resetSurvey()
158
164
// Start the base using fixed coordinates
159
165
bool startFixedBase ()
160
166
{
161
- bool response = false ;
167
+ bool response = true ;
162
168
int maxWait = 2000 ;
163
169
164
170
if (settings.fixedBaseCoordinateType == COORD_TYPE_ECEF)
@@ -178,20 +184,23 @@ bool startFixedBase()
178
184
179
185
// Units are cm with a high precision extension so -1234.5678 should be called: (-123456, -78)
180
186
// -1280208.308,-4716803.847,4086665.811 is SparkFun HQ so...
181
- response = i2cGNSS.setStaticPosition (majorEcefX, minorEcefX,
182
- majorEcefY, minorEcefY,
183
- majorEcefZ, minorEcefZ,
184
- false ,
185
- maxWait
186
- ); // With high precision 0.1mm parts
187
+
188
+ response &= i2cGNSS.newCfgValset8 (UBLOX_CFG_TMODE_MODE, 2 ); // Fixed
189
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_TMODE_POS_TYPE, 0 ); // Position in ECEF
190
+ response &= i2cGNSS.addCfgValset32 (UBLOX_CFG_TMODE_ECEF_X, majorEcefX);
191
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_TMODE_ECEF_X_HP, minorEcefX);
192
+ response &= i2cGNSS.addCfgValset32 (UBLOX_CFG_TMODE_ECEF_Y, majorEcefY);
193
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_TMODE_ECEF_Y_HP, minorEcefY);
194
+ response &= i2cGNSS.addCfgValset32 (UBLOX_CFG_TMODE_ECEF_Z, majorEcefZ);
195
+ response &= i2cGNSS.sendCfgValset8 (UBLOX_CFG_TMODE_ECEF_Z_HP, minorEcefZ);
187
196
}
188
197
else if (settings.fixedBaseCoordinateType == COORD_TYPE_GEODETIC)
189
198
{
190
199
// Add height of instrument (HI) to fixed altitude
191
200
// https://www.e-education.psu.edu/geog862/node/1853
192
201
// For example, if HAE is at 100.0m, + 2m stick + 73mm ARP = 102.073
193
202
float totalFixedAltitude = settings.fixedAltitude + (settings.antennaHeight / 1000.0 ) + (settings.antennaReferencePoint / 1000.0 );
194
-
203
+
195
204
// Break coordinates into main and high precision parts
196
205
// The type casting should not effect rounding of original double cast coordinate
197
206
int64_t majorLat = settings.fixedLat * 10000000 ;
@@ -213,12 +222,14 @@ bool startFixedBase()
213
222
// Serial.printf("major (should be 156022): %ld\r\n", majorAlt);
214
223
// Serial.printf("minor (should be 84): %ld\r\n", minorAlt);
215
224
216
- response = i2cGNSS.setStaticPosition (
217
- majorLat, minorLat,
218
- majorLong, minorLong,
219
- majorAlt, minorAlt,
220
- true , // Use lat/long as input
221
- maxWait);
225
+ response &= i2cGNSS.newCfgValset8 (UBLOX_CFG_TMODE_MODE, 2 ); // Fixed
226
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_TMODE_POS_TYPE, 1 ); // Position in LLH
227
+ response &= i2cGNSS.addCfgValset32 (UBLOX_CFG_TMODE_LAT, majorLat);
228
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_TMODE_LAT_HP, minorLat);
229
+ response &= i2cGNSS.addCfgValset32 (UBLOX_CFG_TMODE_LON, majorLong);
230
+ response &= i2cGNSS.addCfgValset8 (UBLOX_CFG_TMODE_LON_HP, minorLong);
231
+ response &= i2cGNSS.addCfgValset32 (UBLOX_CFG_TMODE_HEIGHT, majorAlt);
232
+ response &= i2cGNSS.sendCfgValset8 (UBLOX_CFG_TMODE_HEIGHT_HP, minorAlt);
222
233
}
223
234
224
235
return (response);
@@ -250,7 +261,7 @@ void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
250
261
{
251
262
rtcmLastReceived = millis ();
252
263
rtcmBytesSent++;
253
-
264
+
254
265
ntripServerProcessRTCM (incoming);
255
266
256
267
espnowProcessRTCM (incoming);
0 commit comments