GPS sleep mode WIP - alas this thread will have to be back burner for a

while because my TX wire on my ONLY T-BEAM broke while I was soldering
a jtag connector - so I can only RX from the GPS.

My other 5 boards are still delayed due to corona virus.

So I'll work on other features for now
1.2-legacy
geeksville 2020-02-22 20:05:38 -08:00
rodzic 6eba792537
commit 635e189007
2 zmienionych plików z 27 dodań i 23 usunięć

Wyświetl plik

@ -2,6 +2,8 @@
Items to complete before the first alpha release. Items to complete before the first alpha release.
* turn on gps https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/blob/master/examples/Example18_PowerSaveMode/Example18_PowerSaveMode.ino
* switch gps to 38400 baud https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/blob/master/examples/Example11_ResetModule/Example2_FactoryDefaultsviaSerial/Example2_FactoryDefaultsviaSerial.ino
* have state machine properly enter deep sleep based on loss of mesh and phone comms * have state machine properly enter deep sleep based on loss of mesh and phone comms
* have gps implement canSleep(), print nmea for debugging and discard buffers on the way into sleep * have gps implement canSleep(), print nmea for debugging and discard buffers on the way into sleep
* implement CustomRF95::canSleep * implement CustomRF95::canSleep

Wyświetl plik

@ -27,6 +27,7 @@ void GPS::setup()
_serial_gps.begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); _serial_gps.begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
ublox.enableDebugging(Serial); ublox.enableDebugging(Serial);
#if 0
// note: the lib's implementation has the wrong docs for what the return val is // note: the lib's implementation has the wrong docs for what the return val is
// it is not a bool, it returns zero for success // it is not a bool, it returns zero for success
bool errCode = ublox.begin(_serial_gps); bool errCode = ublox.begin(_serial_gps);
@ -41,6 +42,7 @@ void GPS::setup()
// ublox.saveConfiguration(); // ublox.saveConfiguration();
assert(ok); assert(ok);
#endif #endif
#endif
} }
void GPS::readFromRTC() void GPS::readFromRTC()
@ -97,7 +99,6 @@ bool GPS::canSleep()
void GPS::prepareSleep() void GPS::prepareSleep()
{ {
// discard all rx serial bytes so we don't try to parse them when we come back // discard all rx serial bytes so we don't try to parse them when we come back
} }
void GPS::doTask() void GPS::doTask()
@ -105,6 +106,7 @@ void GPS::doTask()
#ifdef GPS_RX_PIN #ifdef GPS_RX_PIN
// Consume all characters that have arrived // Consume all characters that have arrived
#if 0
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.
if (ublox.getPVT()) if (ublox.getPVT())
@ -144,6 +146,7 @@ void GPS::doTask()
} }
else // we didn't get a location update, go back to sleep and hope the characters show up else // we didn't get a location update, go back to sleep and hope the characters show up
wantNewLocation = true; wantNewLocation = true;
#endif
#endif #endif
// Once we have sent a location once we only poll the GPS rarely, otherwise check back every 100ms until we have something over the serial // Once we have sent a location once we only poll the GPS rarely, otherwise check back every 100ms until we have something over the serial
@ -156,4 +159,3 @@ void GPS::startLock()
wantNewLocation = true; wantNewLocation = true;
setPeriod(1); setPeriod(1);
} }