Add configurable sleep hours to blank ring light at night#108
Merged
Conversation
Adds led.sleep_start and led.sleep_end (0-23 local hour) to config.json and the led block. When the current local time falls within the window the ring is blanked entirely so it won't disturb sleep. The window wraps midnight (e.g. sleep_start=22, sleep_end=7 covers 10 pm - 7 am). Set either value to -1 to disable the feature. Closes #102 https://claude.ai/code/session_0166Zd59EUgWgYd3FrphQAio
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Closes #102
The ring light stays on overnight, which is bright enough to disrupt sleep. This PR adds
led.sleep_startandled.sleep_endtoconfig.json— a local-time window (0–23 hours) during which the ring is completely blanked.Default ships as 10 pm – 7 am (
sleep_start: 22,sleep_end: 7). The window correctly wraps midnight. Setting either value to-1disables the feature.Changes
config.json: addedled.sleep_start: 22andled.sleep_end: 7include/config.h: addedledSleepStartandledSleepEndfieldssrc/config.cpp: parse and validate the new fields; warn and disable if out of rangeinclude/ring.h: addedsetSleepHours(int, int)methodsrc/ring.cpp: blank ring and return early when current local hour is inside the sleep windowsrc/main.cpp: callsetSleepHours()at startup; log whether sleep hours are activeTest plan
sleep_start: 23,sleep_end: 1)-1and confirm the feature is disabled