Schedule the lamp: wind down in the evening, wake up around the alarm #5

Merged
paudrow merged 1 commit from claude/focused-cray-fkkb2j into main 2026-09-30 14:05:02 -05:00
paudrow commented 2026-09-30 08:02:30 -05:00 (Migrated from github.com)

The Lamp page gets two routines in place of the single sunrise setting.

Wind down (Lamp › Wind down)

  • On at a chosen brightness from a start time, then fades out over the last 15 minutes (or half the window, if it's shorter) to off at Lights out.
  • Defaults: off, 9:30 PM to 10:30 PM at 40%. Times step by 15 minutes, and the window can cross midnight.
  • While it runs, the clock face's status line says "Lights out 10:30 PM".

Wake up (Lamp › Wake up)

  • Brightens from off over Before alarm minutes, reaching its brightness at the alarm, then stays on for After alarm minutes (0–60 each).
  • Defaults: off, 30 min before, 20 min after, 100%.
  • It follows the alarm, so moving, skipping or turning off the alarm moves, skips or stops the light. The Lamp page shows "Alarm is off" when that's why it won't run.

The switch still wins

  • The lamp shows the brighter of the switch and a running routine.
  • Turning the lamp off (icon, button, switch) puts a running routine out until it next starts.

Commands and simulator

  • New serial commands: winddown on|off|HH:MM HH:MM, wake on|off|<before> <after> and go winddown.
  • The viewer gets a Wind down jump button and says why the lamp is on.

Settings

  • Settings are now version 3 (40 bytes).
  • Version 2's sunrise becomes the wake-up light with its old 30-minute hold after the alarm.
  • Versions 1 and 2 both upgrade on boot.

Tests

  • Unit tests: the ramp and fade curves, including across midnight, short windows, and only-brightens / only-dims checks; parsing the new commands; and upgrading from version 2.
  • Firmware tests:
    • setting both routines through the new pages;
    • a full evening at 21:15–22:45, where the lamp comes on, fades partway at the midpoint and goes out;
    • the button putting a routine out until lights out;
    • the wake-up light before and after the alarm, and with the alarm off or skipped;
    • the switch and a routine together;
    • a version 2 settings upgrade on boot.
  • Deliberately removing the fade makes the firmware tests fail.
  • Screens: new pictures for both pages at all three sizes; test/screens/*-lamp.png changed.
  • Simulator: node sim/smoke_test.js passes, and the viewer runs in Chromium without errors.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vwf5rMAYG2NAUB8GMWbq2u


Generated by Claude Code

The Lamp page gets two routines in place of the single sunrise setting. **Wind down** (Lamp › Wind down) - On at a chosen brightness from a start time, then fades out over the last 15 minutes (or half the window, if it's shorter) to off at **Lights out**. - Defaults: off, 9:30 PM to 10:30 PM at 40%. Times step by 15 minutes, and the window can cross midnight. - While it runs, the clock face's status line says "Lights out 10:30 PM". **Wake up** (Lamp › Wake up) - Brightens from off over *Before alarm* minutes, reaching its brightness at the alarm, then stays on for *After alarm* minutes (0–60 each). - Defaults: off, 30 min before, 20 min after, 100%. - It follows the alarm, so moving, skipping or turning off the alarm moves, skips or stops the light. The Lamp page shows "Alarm is off" when that's why it won't run. **The switch still wins** - The lamp shows the brighter of the switch and a running routine. - Turning the lamp off (icon, button, switch) puts a running routine out until it next starts. **Commands and simulator** - New serial commands: `winddown on|off|HH:MM HH:MM`, `wake on|off|<before> <after>` and `go winddown`. - The viewer gets a **Wind down** jump button and says why the lamp is on. **Settings** - Settings are now version 3 (40 bytes). - Version 2's sunrise becomes the wake-up light with its old 30-minute hold after the alarm. - Versions 1 and 2 both upgrade on boot. ## Tests - **Unit tests:** the ramp and fade curves, including across midnight, short windows, and only-brightens / only-dims checks; parsing the new commands; and upgrading from version 2. - **Firmware tests:** - setting both routines through the new pages; - a full evening at 21:15–22:45, where the lamp comes on, fades partway at the midpoint and goes out; - the button putting a routine out until lights out; - the wake-up light before and after the alarm, and with the alarm off or skipped; - the switch and a routine together; - a version 2 settings upgrade on boot. - Deliberately removing the fade makes the firmware tests fail. - **Screens:** new pictures for both pages at all three sizes; `test/screens/*-lamp.png` changed. - **Simulator:** `node sim/smoke_test.js` passes, and the viewer runs in Chromium without errors. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Vwf5rMAYG2NAUB8GMWbq2u --- _Generated by [Claude Code](https://claude.ai/code/session_01Vwf5rMAYG2NAUB8GMWbq2u)_
Sign in to join this conversation.
No description provided.