@@ -2570,7 +2570,9 @@ uint8_t SFE_UBLOX_GPS::getPowerSaveMode(uint16_t maxWait)
2570
2570
}
2571
2571
2572
2572
// 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
2574
2576
boolean SFE_UBLOX_GPS::powerOff (uint32_t durationInMs, uint16_t maxWait)
2575
2577
{
2576
2578
// use durationInMs = 0 for infinite duration
@@ -2594,14 +2596,24 @@ boolean SFE_UBLOX_GPS::powerOff(uint32_t durationInMs, uint16_t maxWait)
2594
2596
payloadCfg[2 ] = (durationInMs >> (8 *2 )) & 0xff ;
2595
2597
payloadCfg[3 ] = (durationInMs >> (8 *3 )) & 0xff ;
2596
2598
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
+ }
2599
2609
}
2600
2610
2601
2611
// Powers off the GPS device for a given duration to reduce power consumption.
2602
2612
// 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
2605
2617
boolean SFE_UBLOX_GPS::powerOffWithInterrupt (uint32_t durationInMs, uint8_t wakeupPin, boolean forceWhileUsb, uint16_t maxWait)
2606
2618
{
2607
2619
// use durationInMs = 0 for infinite duration
@@ -2673,8 +2685,16 @@ boolean SFE_UBLOX_GPS::powerOffWithInterrupt(uint32_t durationInMs, uint8_t wake
2673
2685
2674
2686
payloadCfg[15 ] = terminatingByte;
2675
2687
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
+ }
2678
2698
}
2679
2699
2680
2700
// Change the dynamic platform model using UBX-CFG-NAV5
0 commit comments