Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sleep one extra second? #52

Open
ravelab opened this issue Aug 14, 2019 · 3 comments
Open

sleep one extra second? #52

ravelab opened this issue Aug 14, 2019 · 3 comments

Comments

@ravelab
Copy link

ravelab commented Aug 14, 2019

I set it up like this:

setup() {
rtc.begin();
rtc.setAlarmSeconds(59);
rtc.enableAlarm(rtc.MATCH_SS);
Watchdog.enable()
}

loop() {
Watchdog.reset();
LED OFF
rtc.setSeconds(58);
rtc.standbyMode();
LED ON
}

I'm expecting it to sleep 1 second, but it actually sleeps 2 seconds. I'm also using Adafruit_SleepyDog for watchdog. Don't know if that matters.

Thanks

@moeskerv
Copy link

moeskerv commented Feb 4, 2020

I can confirm this. Basically sleeping for some seconds only seems to always add 1s extra:

rtc.setSeconds(0);
rtc.setAlarmSeconds(0);
rtc.enableAlarm(rtc.MATCH_SS);
rtc.standbyMode();

-> Above results in a sleep for 1s.

rtc.setSeconds(0);
rtc.setAlarmSeconds(1);
rtc.enableAlarm(rtc.MATCH_SS);
rtc.standbyMode();

-> Above results in a sleep for 2 seconds.
And so on.
I'm using version RTCZero 1.6.0 on an Adafruit Feather M0. No SleepyDog in use.

@moeskerv
Copy link

moeskerv commented Feb 4, 2020

Interestingly the ArduinoLowPower (which uses the RTC too) lib does the same on my Feather M0

LowPower.sleep(0); -> sleeps for 1s
LowPower.sleep(1000); -> sleeps for 2s

I tested with the TimedWakeup example: https://www.arduino.cc/en/Tutorial/LowPowerTimedWakeup

@moeskerv
Copy link

moeskerv commented Feb 4, 2020

Might be a special behavior of the Adafruit M0 based Feathers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants