From 07603ceb07ab5e178f599bd3fa726d32256c4b97 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 27 May 2026 05:19:42 +0000 Subject: [PATCH] docs: document sleep hours config and fix two README inaccuracies - Add led.sleep_start / sleep_end to the config.json example and add a dedicated "LED sleep hours" section explaining the midnight-wrap behaviour and the -1 disable sentinel - Correct the stated curl timeout from 10 s to 15 s (matches CURLOPT_TIMEOUT in weather.cpp) - Correct brightness in the config example to 0.05 (matches the actual default and config.json on disk) https://claude.ai/code/session_0166Zd59EUgWgYd3FrphQAio --- README.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7173989..f1b50f6 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ One C++ binary (`weather_display`) running a 1 Hz event loop: | LED ring | `ring.cpp` | every minute | | LCD weather | `lcd.cpp` | every `UPDATE_INTERVAL` seconds (default 600) | -All three subsystems share the main thread. Weather fetches use libcurl with a 10s total timeout so a hung HTTP call cannot stall the OLED tick. +All three subsystems share the main thread. Weather fetches use libcurl with a 15s total timeout so a hung HTTP call cannot stall the OLED tick. Sunrise/sunset/moon math is computed locally (NOAA Solar Calculator algorithm + synodic-month moon phase). No external service is called for celestial data. @@ -136,9 +136,11 @@ Two layers, in order of precedence: "led": { "spi_device": "/dev/spidev0.0", "count": 16, - "brightness": 0.4, + "brightness": 0.05, "offset": 0, - "clockwise": false + "clockwise": false, + "sleep_start": 22, + "sleep_end": 7 }, "oled": { "format": "II:MM AP", @@ -205,6 +207,19 @@ If any of these are absent the alerter is silently disabled — the rest of the `offset` is the physical pixel that should be treated as "logical 0" (useful for putting noon at the top regardless of how the ring is mounted). `clockwise: false` reverses the direction of increasing indices around the ring. Tune these two values together until the sun's position visually matches the time of day (rising on the left, peaking at top, setting on the right). +### LED sleep hours + +`sleep_start` and `sleep_end` define a local-time window (0–23, 24-hour clock) during which the ring is turned off completely. The window wraps midnight correctly, so `sleep_start: 22` / `sleep_end: 7` means off from 10 pm through 7 am. + +```json +"led": { + "sleep_start": 22, + "sleep_end": 7 +} +``` + +Set either value to `-1` to disable the feature (ring stays on at all hours). When active, the startup log shows `LED sleep hours: 22:00 - 7:00 (ring off)`. + --- ## Run as a systemd service