Conversation
jplexer
approved these changes
Sep 17, 2026
gmarull
force-pushed
the
day-night-backlight
branch
from
September 17, 2026 10:01
589a10c to
df6f007
Compare
Member
Author
|
@sjp4 please check the mobile side, otherwise this feature can't be used in practice |
Watches with an RGB backlight can now switch between a day and a night color automatically. Four new syncable prefs back the feature: an enable flag, the night color, and the sunrise/sunset minute of day. Sunrise and sunset default to 06:00/18:00; the phone can supply location-based times. The light service picks the system color from the schedule whenever it would otherwise drive the user's default color, and registers a daily cron job for each of sunrise and sunset so a backlight that is already on re-tints at the transition. Cron is wall-clock based, so the jobs follow DST, time zone and clock adjustments on their own; the clock change hook only re-applies the color in case the backlight is lit while the time jumps across a boundary. Pref changes (local or phone-synced) rebuild the jobs. Signed-off-by: Nick Ludwig <nick.b.ludwig@gmail.com> Co-Authored-By: GPT-5.5-xhigh Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
cron_service_deinit() only stopped the timer, so a test that also resets the new_timer fake between cases left the service holding a stale TimerID that the next cron_service_init() would not recreate. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Build test_light with CONFIG_BACKLIGHT_HAS_COLOR and the fake RTC so the schedule logic is exercised: color selection around sunrise/sunset, schedules that wrap midnight, the degenerate equal-times case, timer arming for the next boundary, and re-tinting a lit backlight when the timer fires. Signed-off-by: Nick Ludwig <nick.b.ludwig@gmail.com> Co-Authored-By: GPT-5.5-xhigh Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`backlight daynight start` sets green as the day color and red as the night color, with sunset one minute from now, so the switch can be observed without waiting for a real sunset. `status` prints the current schedule and `off` disables it again. Signed-off-by: Nick Ludwig <nick.b.ludwig@gmail.com> Co-Authored-By: GPT-5.5-xhigh Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
gmarull
force-pushed
the
day-night-backlight
branch
from
September 17, 2026 14:04
df6f007 to
d0690d1
Compare
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.
Revives #1596 by @nick1udwig (closed by the stale bot) on top of current
main. Original authorship is preserved on all commits.Problem
Watches with an RGB backlight should be able to switch automatically between a day and a night backlight color.
Resolves #1139.
Solution
Four new syncable prefs:
lightColorDayNightEnabled,lightColorNight,lightColorSunriseMinute,lightColorSunsetMinute(defaults 06:00/18:00; the phone can supply location-based times). The light service picks the system color from the schedule wherever it would otherwise use the user's default color, and arms a timer for the next sunrise/sunset boundary so a backlight that is already on re-tints at the transition.A
backlight daynight <start|status|off>console command arms a green→red switch one minute out for quick manual testing.Changes vs. #1596
light_commands.cfolded intoservices/light/console.c, no longer QEMU-only.time_util_get_seconds_until_daily_time(),light_handle_clock_change()from the event loop onPEBBLE_SET_TIME_EVENT, andlight_handle_color_prefs_changed()from the pref handlers (covers both local sets and phone sync), instead of subscribing to events inside the service.settings_blob_db.c, "Rejecting non-whitelisted setting"), and every other recently added pref, includinglightColoritself, ships without one. Day/night backlight color mobileapp#265 should dropSupportsBacklightColorScheduleand gate the UI on the watch model (RGB backlight hardware), or not gate at all likelightColor.CONFIG_BACKLIGHT_HAS_COLOR, which the test build never defined, so they never ran.test_lightnow builds with it and the fake RTC, covering color selection around sunrise/sunset, midnight-wrapping schedules, the equal-times case, timer arming, and re-tinting a lit backlight when the timer fires.Testing
pbl test -R test_lightpasses (19 cases, 6 new).backlight daynight start→ green backlight; at the sunset minute the timer switched it to red while lit;offrestores.🤖 Generated with Claude Code