sometimes save config fails on ublox, don't cause a reboot for that

This commit is contained in:
geeksville 2020-07-22 10:23:56 -07:00
parent 7f6dc104f0
commit d674aaaa29
2 changed files with 6 additions and 3 deletions

View File

@ -3,7 +3,7 @@
#include <Arduino.h> #include <Arduino.h>
/// Error codes for critical error /// Error codes for critical error
enum CriticalErrorCode { NoError, ErrTxWatchdog, ErrSleepEnterWait, ErrNoRadio, ErrUnspecified }; enum CriticalErrorCode { NoError, ErrTxWatchdog, ErrSleepEnterWait, ErrNoRadio, ErrUnspecified, UBloxInitFailed };
/// Record an error that should be reported via analytics /// Record an error that should be reported via analytics
void recordCriticalError(CriticalErrorCode code, uint32_t address = 0); void recordCriticalError(CriticalErrorCode code, uint32_t address = 0);

View File

@ -1,4 +1,5 @@
#include "UBloxGPS.h" #include "UBloxGPS.h"
#include "error.h"
#include "sleep.h" #include "sleep.h"
#include <assert.h> #include <assert.h>
@ -83,7 +84,8 @@ bool UBloxGPS::setup()
assert(ok); assert(ok);
} }
ok = ublox.saveConfiguration(3000); ok = ublox.saveConfiguration(3000);
assert(ok); if (!ok)
recordCriticalError(UBloxInitFailed); // Don't halt the boot if saving the config fails, but do report the bug
concurrency::PeriodicTask::setup(); // We don't start our periodic task unless we actually found the device concurrency::PeriodicTask::setup(); // We don't start our periodic task unless we actually found the device
@ -150,7 +152,8 @@ The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of s
// bogus lat lon is reported as 0 or 0 (can be bogus just for one) // bogus lat lon is reported as 0 or 0 (can be bogus just for one)
// Also: apparently when the GPS is initially reporting lock it can output a bogus latitude > 90 deg! // Also: apparently when the GPS is initially reporting lock it can output a bogus latitude > 90 deg!
hasValidLocation = (latitude != 0) && (longitude != 0) && (latitude <= 900000000 && latitude >= -900000000) && (numSatellites > 0); hasValidLocation =
(latitude != 0) && (longitude != 0) && (latitude <= 900000000 && latitude >= -900000000) && (numSatellites > 0);
// we only notify if position has changed due to a new fix // we only notify if position has changed due to a new fix
if ((fixtype >= 3 && fixtype <= 4) && ublox.getP(maxWait)) // rd fixes only if ((fixtype >= 3 && fixtype <= 4) && ublox.getP(maxWait)) // rd fixes only