#include <TinyGPS++.h>
TinyGPSPlus gps;
void setup(void) {
Serial3.begin(9600);
}
void loop()
{
gpsWaitFix (2);
}
bool gpsWaitFix(uint16_t waitSecs)
{
//waits a specified number of seconds for a fix, returns true for good fix
uint32_t endwaitmS;
uint8_t GPSchar;
uint32_t endFixmS;
Serial.print(F("Wait GPS Fix "));
Serial.print(waitSecs);
Serial.println(F(" seconds"));
endwaitmS = millis() + (waitSecs * 1000);
while (millis() < endwaitmS)
{
if (Serial3.available() > 0)
{
GPSchar = Serial3.read();
gps.encode(GPSchar);
}
if (gps.location.isUpdated() && gps.altitude.isUpdated() && gps.date.isUpdated())
{
endFixmS = millis();
Serial.println(endFixmS);//record the time when we got a GPS fix
Serial.print(gps.location.lat(), 6);
Serial.print(F(","));
Serial.println(gps.location.lng(), 6);
return true;
}
}
return false;
}
Which works fine but I want to active power save (from another switch input).
I understand from the Neo DOCs Neo Specs that I can use the command UBX-RXM-PMREQ.
Does anyone know how to implement this and sleep and wake up the GPS? Ideally I want the sleep mode to save some power but still wake and be able to do a hot fix.
Thanks Srnet. I did find that and now have it running.
I can see I can open message windows and see the bytes to send (as in serialWrite).
My confusion is; in the image attached which appears to be the basic turn on and off, its sets a time period for each then just seems to reset to the original state so how do I keep it on or off?