void loop()
{
Tracker::instance().loop();
bluetooth_loop();
PublishQueuePosix::instance().loop();
if (countdown_before_going_to_sleep < 0){
Log.info("==============GOING TO SLEEP==============!");
countdown_before_going_to_sleep = time_out_before_going_to_sleep;
SystemSleepConfiguration config;
if (number_of_successful_connections)
config.mode(SystemSleepMode::HIBERNATE)
.duration(3600000);
else
config.mode(SystemSleepMode::HIBERNATE)
.duration(1200000);
System.sleep(config);
}
}
In about a minute the device is promptly awake. The cloud asset tracker settings are all disabled on the sleep and location side (0, 0 for both max and min publishing).
We are just simply looking for the device to comply with the instructions and go to sleep for a specified time triggered by the code without any speculations on whether it is a good idea to go to sleep.
Does this problem also occur when using ULTRA_LOW_POWER?
The reason I ask is that in ULP mode, wake is controlled by the nRF52840 MCU. In hibernate mode, it’s woken by the AM1805 RTC, so this could help narrow down the possibilities.
I think that’s happening because the Device OS sleep API does not disable the Tracker AM1805 watchdog timer, which is firing and resetting the device. You can either use the Tracker sleep API instead of the Device OS sleep API, or manually disable the watchdog before sleep.