I have some code which, if there’s nothing much going on, puts the Electron into deep sleep for a time by calling System.sleep(SLEEP_MODE_DEEP, sleepForSeconds)
. When the Electron board awakes from this function, in setup()
, I check the time and, if it’s in the last century, I connect to the network to establish time.
My problem is that when I call Time.now()
in setup()
it always returns 1970. Surely a wake-up from deep sleep should have no effect on the RTC (as it was clearly there to wake me up just microseconds earlier)? I really don’t want to have to register with the network each time I return from System.sleep(SLEEP_MODE_DEEP, sleepForSeconds)
, otherwise I’m burning the power I saved by switching the modem off in the first place. I am aware that I have the option of keeping the modem on by calling System.sleep(WKP, RISING, sleepForSeconds, SLEEP_NETWORK_STANDBY)
instead, but that burns 5 mA that I would rather save.
I’m running in semi-automatic mode.