@@ -2570,7 +2570,9 @@ uint8_t SFE_UBLOX_GPS::getPowerSaveMode(uint16_t maxWait)
25702570}
25712571
25722572// Powers off the GPS device for a given duration to reduce power consumption.
2573- // WARNING: Querying the device before the duration is complete, for example by "getLatitude()" will wake it up!
2573+ // NOTE: Querying the device before the duration is complete, for example by "getLatitude()" will wake it up!
2574+ // returns true if command has not failed
2575+ // returns false if command has not been acknowledged or maxWait = 0
25742576boolean SFE_UBLOX_GPS::powerOff (uint32_t durationInMs, uint16_t maxWait)
25752577{
25762578 // use durationInMs = 0 for infinite duration
@@ -2594,14 +2596,24 @@ boolean SFE_UBLOX_GPS::powerOff(uint32_t durationInMs, uint16_t maxWait)
25942596 payloadCfg[2 ] = (durationInMs >> (8 *2 )) & 0xff ;
25952597 payloadCfg[3 ] = (durationInMs >> (8 *3 )) & 0xff ;
25962598
2597- // check for "not acknowledged" command
2598- return (sendCommand (&packetCfg, maxWait) != SFE_UBLOX_STATUS_COMMAND_NACK);
2599+ if (maxWait != 0 )
2600+ {
2601+ // check for "not acknowledged" command
2602+ return (sendCommand (&packetCfg, maxWait) != SFE_UBLOX_STATUS_COMMAND_NACK);
2603+ }
2604+ else
2605+ {
2606+ sendCommand (&packetCfg, maxWait);
2607+ return false ; // can't tell if command not acknowledged if maxWait = 0
2608+ }
25992609}
26002610
26012611// Powers off the GPS device for a given duration to reduce power consumption.
26022612// While powered off it can be woken up by creating a falling or rising voltage edge on the specified pin.
2603- // WARNING: The GPS seems to detect small voltage edges on the interrupt pin. Works best when Microcontroller is in deepsleep.
2604- // WARNING: Querying the device before the duration is complete, for example by "getLatitude()" will wake it up!
2613+ // NOTE: The GPS seems to detect small voltage edges on the interrupt pin. Works best when Microcontroller is in deepsleep.
2614+ // NOTE: Querying the device before the duration is complete, for example by "getLatitude()" will wake it up!
2615+ // returns true if command has not failed
2616+ // returns false if command has not been acknowledged or maxWait = 0
26052617boolean SFE_UBLOX_GPS::powerOffWithInterrupt (uint32_t durationInMs, uint8_t wakeupPin, boolean forceWhileUsb, uint16_t maxWait)
26062618{
26072619 // use durationInMs = 0 for infinite duration
@@ -2673,8 +2685,16 @@ boolean SFE_UBLOX_GPS::powerOffWithInterrupt(uint32_t durationInMs, uint8_t wake
26732685
26742686 payloadCfg[15 ] = terminatingByte;
26752687
2676- // check for "not acknowledged" command
2677- return (sendCommand (&packetCfg, maxWait) != SFE_UBLOX_STATUS_COMMAND_NACK);
2688+ if (maxWait != 0 )
2689+ {
2690+ // check for "not acknowledged" command
2691+ return (sendCommand (&packetCfg, maxWait) != SFE_UBLOX_STATUS_COMMAND_NACK);
2692+ }
2693+ else
2694+ {
2695+ sendCommand (&packetCfg, maxWait);
2696+ return false ; // can't tell if command not acknowledged if maxWait = 0
2697+ }
26782698}
26792699
26802700// Change the dynamic platform model using UBX-CFG-NAV5
0 commit comments