Merge pull request #331 from geeksville/master

hotfix
This commit is contained in:
Kevin Hester 2020-08-22 09:15:51 -07:00 committed by GitHub
commit 82fe55471d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 60 deletions

View File

@ -1,3 +1,3 @@
export VERSION=0.9.2 export VERSION=0.9.3

View File

@ -20,7 +20,7 @@ namespace meshtastic
CallbackObserver<Status, const Status *> statusObserver = CallbackObserver<Status, const Status *>(this, &Status::updateStatus); CallbackObserver<Status, const Status *> statusObserver = CallbackObserver<Status, const Status *>(this, &Status::updateStatus);
bool initialized = false; bool initialized = false;
// Workaround for no typeid support // Workaround for no typeid support
int statusType; int statusType = 0;
public: public:
// Allows us to generate observable events // Allows us to generate observable events

View File

@ -102,8 +102,13 @@ bool UBloxGPS::factoryReset()
// It is useful to force back into factory defaults (9600baud, NEMA to test the behavior of boards that don't have // It is useful to force back into factory defaults (9600baud, NEMA to test the behavior of boards that don't have
// GPS_TX connected) // GPS_TX connected)
ublox.factoryReset(); ublox.factoryReset();
delay(3000); delay(5000);
tryConnect(); // sets isConnected tryConnect(); // sets isConnected
// try a second time, the ublox lib serial parsing is buggy?
if (!tryConnect())
tryConnect();
DEBUG_MSG("GPS Factory reset success=%d\n", isConnected); DEBUG_MSG("GPS Factory reset success=%d\n", isConnected);
if (isConnected) if (isConnected)
ok = setUBXMode(); ok = setUBXMode();
@ -122,12 +127,11 @@ int UBloxGPS::prepareSleep(void *unused)
void UBloxGPS::doTask() void UBloxGPS::doTask()
{ {
uint8_t fixtype = 3; // If we are only using the RX pin, assume we have a 3d fix if (isConnected) {
assert(isConnected);
// Consume all characters that have arrived // Consume all characters that have arrived
uint8_t fixtype = 3; // If we are only using the RX pin, assume we have a 3d fix
// if using i2c or serial look too see if any chars are ready // if using i2c or serial look too see if any chars are ready
ublox.checkUblox(); // See if new data is available. Process bytes as they come in. ublox.checkUblox(); // See if new data is available. Process bytes as they come in.
@ -145,9 +149,9 @@ void UBloxGPS::doTask()
if (ublox.getT(maxWait)) { if (ublox.getT(maxWait)) {
/* Convert to unix time /* Convert to unix time
The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January
(midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z).
*/ */
struct tm t; struct tm t;
t.tm_sec = ublox.getSecond(0); t.tm_sec = ublox.getSecond(0);
t.tm_min = ublox.getMinute(0); t.tm_min = ublox.getMinute(0);
@ -185,9 +189,10 @@ The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of s
const meshtastic::GPSStatus status = const meshtastic::GPSStatus status =
meshtastic::GPSStatus(hasLock(), isConnected, latitude, longitude, altitude, dop, heading, numSatellites); meshtastic::GPSStatus(hasLock(), isConnected, latitude, longitude, altitude, dop, heading, numSatellites);
newStatus.notifyObservers(&status); newStatus.notifyObservers(&status);
}
// Once we have sent a location once we only poll the GPS rarely, otherwise check back every 1s until we have something over // Once we have sent a location once we only poll the GPS rarely, otherwise check back every 10s until we have something
// the serial // over the serial
setPeriod(hasValidLocation && !wantNewLocation ? 30 * 1000 : 10 * 1000); setPeriod(hasValidLocation && !wantNewLocation ? 30 * 1000 : 10 * 1000);
} }