Skip to content

Commit

Permalink
Fix issue with using day restrictions.
Browse files Browse the repository at this point in the history
Use IsRunToday from scheduler in core.cpp instead of duplicated function local to core.cpp which was missing the changes for implementing restrictions.
  • Loading branch information
nhorvath committed Jun 25, 2019
1 parent c0b4e6b commit 69c585f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
12 changes: 1 addition & 11 deletions core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,6 @@ static runStateClass::DurationAdjustments AdjustDurations(Schedule * sched)
return adj;
}

// return true if the schedule is enabled and runs today.
static inline bool IsRunToday(const Schedule & sched, time_t time_now)
{
if ((sched.IsEnabled())
&& (((sched.IsInterval()) && ((elapsedDays(time_now) % sched.interval) == 0))
|| (!(sched.IsInterval()) && (sched.day & (0x01 << (weekday(time_now) - 1))))))
return true;
return false;
}

// Load the on/off events for a specific schedule/time or the quick schedule
void LoadSchedTimeEvents(uint8_t sched_num, bool bQuickSchedule)
{
Expand Down Expand Up @@ -360,7 +350,7 @@ void ReloadEvents(bool bAllEvents)
{
Schedule sched;
LoadSchedule(i, &sched);
if (IsRunToday(sched, time_now))
if (sched.IsRunToday(time_now))
{
// now load up events for each of the start times.
for (uint8_t j = 0; j <= 3; j++)
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.2
1.5.3

0 comments on commit 69c585f

Please sign in to comment.