diff --git a/src/activity.cpp b/src/activity.cpp index a07fd24..2a2838a 100644 --- a/src/activity.cpp +++ b/src/activity.cpp @@ -81,7 +81,7 @@ void runActivities(void *params) Serial.printf("[ACTIVITY] starting activity: %d\n", activityNext); bool doQuickSleep = activityNext == GuestWifi || activityNext == Info; -#ifdef sleepSchedule +#ifdef CONFIG_CPP TimeInfo time = { .dow = getDayOfWeek(true), .hour = getHour(), diff --git a/src/config_example.cpp b/src/config_example.cpp index e69c8a1..d2e8834 100644 --- a/src/config_example.cpp +++ b/src/config_example.cpp @@ -1,7 +1,9 @@ -// NOTE: THIS FILE IS ONLY NEEDED WHEN CONFIGURING A CUSTOM SLEEP -// SCHEDULE. -// IF USING A SINGLE/STATIC SLEEP DURATION THEN THIS FILE CAN BE OMITTED -// #include "config.h" +// Note: +// This file is only needed when configuring a custom sleep schedule. +// If using a single/static sleep duration then this file can be omitted +/* REMOVE THIS LINE TO ENABLE THE SLEEP SCHEDULE +#include "config.h" +#define CONFIG_CPP // How long to sleep between image refreshes // - there is no validation of any kind, make sure your slots are continuous @@ -9,7 +11,7 @@ // - a schedule slot is configured per day, i.e. cronjob style // - dow = DayOfWeek, starts at 1 = Monday to 7 = Sunday // SleepScheduleSlot sleepSchedule[] = { - /* EXAMPLE BLOCKS + // EXAMPLE BLOCKS { // On each workday from 00:00 to 08:30 sleep for 1 hour .start_dow = 1, .start_hour = 0, @@ -55,7 +57,7 @@ .end_minute = 0, .sleep_in_seconds = 300, }, - */ -// }; +}; -//const size_t sleepScheduleSize = sizeof(sleepSchedule) / sizeof(sleepSchedule[0]); +const size_t sleepScheduleSize = sizeof(sleepSchedule) / sizeof(sleepSchedule[0]); +/**/ diff --git a/src/time.cpp b/src/time.cpp index ff70890..76c85d4 100644 --- a/src/time.cpp +++ b/src/time.cpp @@ -130,7 +130,13 @@ int getDayOfWeek(bool weekStartsOnMonday) { // return -1 as long as rtc is not set return -1; } - return rtc.getDayofWeek() + (weekStartsOnMonday ? 1 : 0); + + int dow = rtc.getDayofWeek(); + if (dow == 0) { + return dow + 1; + } else { + return dow; + } } int getHour() {