-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
A reimplementation of time-controlled presets (scalable). (I suck at HTML/JavaScript, so I need help) #4789
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
Draft
Cloveian
wants to merge
5
commits into
wled:main
Choose a base branch
from
Cloveian:better-time-controlled-presets
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+814
−166
Draft
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9319702
Make time-controlled presets scalable and partially integrated into t…
Cloveian bc19e3a
Merge branch 'wled:main' into better-time-controlled-presets
Cloveian 63b4e72
add sunrise/sunset to ui and other nitpicks
Cloveian 32a2d67
Fix Sunday bit loss in sunrise/sunset timer parsing
Cloveian 81848f7
refactoring sunrise timer processing and Fix timer-add condition to h…
Cloveian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -318,6 +318,46 @@ void setCountdown(); | |
| byte weekdayMondayFirst(); | ||
| void checkTimers(); | ||
| void calculateSunriseAndSunset(); | ||
|
|
||
| // Timer management functions | ||
| void addTimer(uint8_t preset, uint8_t hour, int8_t minute, uint8_t weekdays, uint8_t monthStart, uint8_t monthEnd, uint8_t dayStart, uint8_t dayEnd); | ||
| void clearTimers(); | ||
| void syncTimersToArrays(); | ||
| uint8_t getTimerCount(); | ||
| uint8_t getRegularTimerCount(); | ||
| bool hasSunriseTimer(); | ||
| bool hasSunsetTimer(); | ||
|
|
||
| // Timer constants | ||
| const uint8_t maxTimePresets = 16; | ||
|
|
||
| // Timer special hour values | ||
| const uint8_t TIMER_HOUR_SUNRISE = 255; // Special value for sunrise timer | ||
| const uint8_t TIMER_HOUR_SUNSET = 254; // Special value for sunset timer | ||
|
|
||
| // External timer declarations | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These should go into |
||
| struct Timer { | ||
| uint8_t preset; | ||
| uint8_t hour; | ||
| int8_t minute; | ||
| uint8_t weekdays; | ||
| uint8_t monthStart, monthEnd; | ||
| uint8_t dayStart, dayEnd; | ||
|
|
||
| // Constructor | ||
| Timer(uint8_t p = 0, uint8_t h = 0, int8_t m = 0, uint8_t w = 0, | ||
| uint8_t ms = 1, uint8_t me = 12, uint8_t ds = 1, uint8_t de = 31) | ||
| : preset(p), hour(h), minute(m), weekdays(w), | ||
| monthStart(ms), monthEnd(me), dayStart(ds), dayEnd(de) {} | ||
|
|
||
| bool isEnabled() const { return weekdays != 0; } // Timer is enabled if any weekday bit is set | ||
Cloveian marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| bool isSunrise() const { return hour == TIMER_HOUR_SUNRISE; } | ||
| bool isSunset() const { return hour == TIMER_HOUR_SUNSET; } | ||
| bool isRegular() const { return hour < TIMER_HOUR_SUNSET; } | ||
| }; | ||
|
|
||
| extern std::vector<Timer> timers; | ||
|
|
||
| void setTimeFromAPI(uint32_t timein); | ||
|
|
||
| //overlay.cpp | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do you handle legacy configuration? Consider upgrade path.