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

alarmOnce(H,M,S,Handler) and others won't fire at midnight #36

Open
gritnix opened this issue Mar 31, 2018 · 3 comments
Open

alarmOnce(H,M,S,Handler) and others won't fire at midnight #36

gritnix opened this issue Mar 31, 2018 · 3 comments

Comments

@gritnix
Copy link

gritnix commented Mar 31, 2018

Description

alarmOnce and presumably alarmRepeat where HMS is given does not fire at midnight.

Steps To Reproduce Problem

set alarmOnce(0,0,0,myHandler);

This will not fire. It's easy to see why and if I get a chance I'll update .h and do a pull request. Certain functions, most notably

AlarmID_t alarmRepeat(const timeDayOfWeek_t DOW, const int H, const int M, const int S, OnTick_t onTickHandler)

and

AlarmID_t alarmOnce(const timeDayOfWeek_t DOW, const int H, const int M, const int S, OnTick_t onTickHandler)

and

AlarmID_t alarmOnce(const int H, const int M, const int S, OnTick_t onTickHandler)

all call AlarmHMS() and then call their time_t variant with the result. The time_t variant does this check

if (value <= 0) return invalid alarm.

Passing in midnight, 0,0,0, gives a value of 0 which is perfectly ok. This needs to be changed to < 0, not <=.

Thanks.

@Gerry33
Copy link

Gerry33 commented Jun 5, 2018

@gritnix : Same problem here.
But your suggested solution wonn't fix the problem. With your suggested patch the timer is accepted, but never executed. Problem is somewhere deeper in the logic.

This is never executed:
Alarm.timerOnce (0, OnceOnly);

But I see no real reason why this shouldn't. It simply means, 'immediately'.

Thanks anyhow
Gerry

@countrysideboy
Copy link

Try a temporary way to fix it:
Set the alarm from 00:00:00 to 00:00:01

@countrysideboy
Copy link

The AlarmHMS() macro does not deal with the 00:00:00。If the hour/min/sec is all zero, it should return the seconds of (00:00:00-now_time),instead of zero.

And the timealarm.ccp deal with the overnight condition.

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

3 participants