@@ -207,80 +207,94 @@ void GNSS_ZED::begin()
207
207
}
208
208
209
209
printModuleInfo (); // Print module type and firmware version
210
- }
211
210
212
- UBX_SEC_UNIQID_data_t chipID;
213
- if (_zed->getUniqueChipId (&chipID))
214
- {
215
- snprintf (gnssUniqueId, sizeof (gnssUniqueId), " %s" , _zed->getUniqueChipIdStr (&chipID));
216
- }
211
+ UBX_SEC_UNIQID_data_t chipID;
212
+ if (_zed->getUniqueChipId (&chipID))
213
+ {
214
+ snprintf (gnssUniqueId, sizeof (gnssUniqueId), " %s" , _zed->getUniqueChipIdStr (&chipID));
217
215
218
- systemPrintln (" GNSS ZED online" );
216
+ systemPrintln (" GNSS ZED online" );
217
+ online.gnss = true ;
218
+ return ;
219
+ }
220
+ }
219
221
220
- online.gnss = true ;
222
+ systemPrintln (" GNSS ZED offline" );
223
+ displayGNSSFail (1000 );
221
224
}
222
225
223
226
// ----------------------------------------
224
- // Setup the timepulse output on the PPS pin for external triggering
225
- // Setup TM2 time stamp input as need
227
+ // Setup the timepulse output on the PPS pin for external triggering.
228
+ // Setup TM2 time stamp input as need.
229
+ // Allow this to be called multiple times so that the callback can be
230
+ // set or cleared as needed.
231
+ // This will be called once by setup and possibly multiple times by
232
+ // menuPortsMultiplexed.
226
233
// ----------------------------------------
227
234
bool GNSS_ZED::beginExternalEvent ()
228
235
{
229
236
if (online.gnss == false )
230
237
return (false );
231
238
232
- if (settings.dataPortChannel != MUX_PPS_EVENTTRIGGER)
233
- return (true ); // No need to configure PPS if port is not selected
234
-
235
239
bool response = true ;
236
240
237
- if (settings.enableExternalHardwareEventLogging )
241
+ // Assumes EXTINT is always routed through the multiplexer...
242
+ if (settings.enableExternalHardwareEventLogging && (settings.dataPortChannel == MUX_PPS_EVENTTRIGGER))
238
243
{
239
- _zed->setAutoTIMTM2callbackPtr (
244
+ response &= _zed->setAutoTIMTM2callbackPtr (
240
245
&eventTriggerReceived); // Enable automatic TIM TM2 messages with callback to eventTriggerReceived
241
246
}
242
247
else
243
- _zed->setAutoTIMTM2callbackPtr (nullptr );
248
+ {
249
+ response &= _zed->setAutoTIMTM2callbackPtr (nullptr );
250
+ }
251
+
252
+ if (response == false )
253
+ systemPrintln (" beginExternalEvent failed" );
244
254
245
255
return (response);
246
256
}
247
257
248
258
// ----------------------------------------
249
259
// Setup the timepulse output on the PPS pin for external triggering
260
+ // Allow this to be called multiple times.
261
+ // This will be called once by setup and possibly multiple times by
262
+ // menuPortsMultiplexed.
250
263
// ----------------------------------------
251
264
bool GNSS_ZED::beginPPS ()
252
265
{
253
266
if (online.gnss == false )
254
267
return (false );
255
268
256
- if (settings.dataPortChannel != MUX_PPS_EVENTTRIGGER)
257
- return (true ); // No need to configure PPS if port is not selected
258
-
259
269
bool response = true ;
260
270
261
- response &= _zed->newCfgValset ();
262
- response &= _zed->addCfgValset (UBLOX_CFG_TP_PULSE_DEF, 0 ); // Time pulse definition is a period (in us)
263
- response &= _zed->addCfgValset (UBLOX_CFG_TP_PULSE_LENGTH_DEF, 1 ); // Define timepulse by length (not ratio)
264
- response &=
265
- _zed->addCfgValset (UBLOX_CFG_TP_USE_LOCKED_TP1,
266
- 1 ); // Use CFG-TP-PERIOD_LOCK_TP1 and CFG-TP-LEN_LOCK_TP1 as soon as GNSS time is valid
267
- response &= _zed->addCfgValset (UBLOX_CFG_TP_TP1_ENA, settings.enableExternalPulse ); // Enable/disable timepulse
268
- response &=
269
- _zed->addCfgValset (UBLOX_CFG_TP_POL_TP1, settings.externalPulsePolarity ); // 0 = falling, 1 = rising edge
271
+ // Assumes PPS is always routed through the multiplexer...
272
+ if (settings.dataPortChannel == MUX_PPS_EVENTTRIGGER)
273
+ {
274
+ response &= _zed->newCfgValset ();
275
+ response &= _zed->addCfgValset (UBLOX_CFG_TP_PULSE_DEF, 0 ); // Time pulse definition is a period (in us)
276
+ response &= _zed->addCfgValset (UBLOX_CFG_TP_PULSE_LENGTH_DEF, 1 ); // Define timepulse by length (not ratio)
277
+ response &=
278
+ _zed->addCfgValset (UBLOX_CFG_TP_USE_LOCKED_TP1,
279
+ 1 ); // Use CFG-TP-PERIOD_LOCK_TP1 and CFG-TP-LEN_LOCK_TP1 as soon as GNSS time is valid
280
+ response &= _zed->addCfgValset (UBLOX_CFG_TP_TP1_ENA, settings.enableExternalPulse ); // Enable/disable timepulse
281
+ response &=
282
+ _zed->addCfgValset (UBLOX_CFG_TP_POL_TP1, settings.externalPulsePolarity ); // 0 = falling, 1 = rising edge
270
283
271
- // While the module is _locking_ to GNSS time, turn off pulse
272
- response &= _zed->addCfgValset (UBLOX_CFG_TP_PERIOD_TP1, 1000000 ); // Set the period between pulses in us
273
- response &= _zed->addCfgValset (UBLOX_CFG_TP_LEN_TP1, 0 ); // Set the pulse length in us
284
+ // While the module is _locking_ to GNSS time, turn off pulse
285
+ response &= _zed->addCfgValset (UBLOX_CFG_TP_PERIOD_TP1, 1000000 ); // Set the period between pulses in us
286
+ response &= _zed->addCfgValset (UBLOX_CFG_TP_LEN_TP1, 0 ); // Set the pulse length in us
274
287
275
- // When the module is _locked_ to GNSS time, make it generate 1Hz (Default is 100ms high, 900ms low)
276
- response &= _zed->addCfgValset (UBLOX_CFG_TP_PERIOD_LOCK_TP1,
277
- settings.externalPulseTimeBetweenPulse_us ); // Set the period between pulses is us
278
- response &=
279
- _zed->addCfgValset (UBLOX_CFG_TP_LEN_LOCK_TP1, settings.externalPulseLength_us ); // Set the pulse length in us
280
- response &= _zed->sendCfgValset ();
288
+ // When the module is _locked_ to GNSS time, make it generate 1Hz (Default is 100ms high, 900ms low)
289
+ response &= _zed->addCfgValset (UBLOX_CFG_TP_PERIOD_LOCK_TP1,
290
+ settings.externalPulseTimeBetweenPulse_us ); // Set the period between pulses is us
291
+ response &=
292
+ _zed->addCfgValset (UBLOX_CFG_TP_LEN_LOCK_TP1, settings.externalPulseLength_us ); // Set the pulse length in us
293
+ response &= _zed->sendCfgValset ();
294
+ }
281
295
282
296
if (response == false )
283
- systemPrintln (" beginExternalTriggers config failed" );
297
+ systemPrintln (" beginPPS failed" );
284
298
285
299
return (response);
286
300
}
@@ -313,6 +327,13 @@ bool GNSS_ZED::configureBase()
313
327
if (online.gnss == false )
314
328
return (false );
315
329
330
+ if (settings.gnssConfiguredBase )
331
+ {
332
+ if (settings.debugGnss )
333
+ systemPrintln (" Skipping ZED Base configuration" );
334
+ return true ;
335
+ }
336
+
316
337
update (); // Regularly poll to get latest data
317
338
318
339
_zed->setNMEAGPGGAcallbackPtr (
@@ -394,9 +415,10 @@ bool GNSS_ZED::configureBase()
394
415
395
416
if (!success)
396
417
systemPrintln (" Base config fail" );
397
- else
398
- // Save the current configuration into non-volatile memory (NVM)
399
- saveConfiguration ();
418
+
419
+ // The configuration should be saved to RAM and BBR. No need to saveConfiguration here.
420
+
421
+ settings.gnssConfiguredBase = success;
400
422
401
423
return (success);
402
424
}
0 commit comments