SpellFoundry / SleepyPi2

Power Management board for Raspberry Pi
http://spellfoundry.com/sleepypi2
GNU General Public License v2.0
17 stars 15 forks source link

Wrong WakeUp/Bedtime login in WakePiPeriodicallyDuringDay #8

Open daghemo opened 6 years ago

daghemo commented 6 years ago

Maybe I'm wrong, but I think that the following code from the WakePiPeriodicallyDuringDay example is not good:

if((now.hour() >= WakeUp_StartHour) && now.minute() >= WakeUp_StartMinute) {
    if((now.hour() <= Bedtime_StartHour) && now.minute() <= Bedtime_StartMinute)

Just try with WakeUp set to 7:00 and Bedtime set to 20:00. Both conditions will match only if now.minute() is 00, that is only in the first minute of every hour, not every minute of every hour in the WakeUp/Bedtime time range.

mcgrailk3 commented 5 years ago

I agree with @daghemo, I tried using this example code and could not get it working until I looked at these if statements.