Instead of using millis()
as the offset, I’d rather use Time.local()
and calculate the difference between that and the desired wake time each time anew.
Look here
Waking the photon from deep sleep at designated times
Especially with the Electron you may also need to consider the potentially long reconnection time in case of poor signal.
BTW, if you want to stick with millis()
start_time
should always be 0 since that is the time millis()
starts off to count after a reset cutting out all the delay imposed by factors like the reconnection period before setup()
is actually called.