Skip to content

Fix alert ring pulse stuck at near-static brightness#105

Merged
GageLawton merged 1 commit into
mainfrom
claude/fix-ring-pulse-71
May 27, 2026
Merged

Fix alert ring pulse stuck at near-static brightness#105
GageLawton merged 1 commit into
mainfrom
claude/fix-ring-pulse-71

Conversation

@GageLawton
Copy link
Copy Markdown
Owner

Summary

Closes #71

The alert pulse was intended to cycle visibly, but the modulo window (PERIOD_SEC * 100 = 200 s) combined with a 60-second ring update rate meant consecutive updates landed only 30% of the cosine apart — making the ring appear as a near-static dim glow during severe weather.

The fix uses a 150-second phase window (gcd(60, 150) = 30), giving 5 distinct, evenly-spread brightness levels per full cosine ramp (~5 minutes total cycle). The pulse is now visibly animated on every per-minute ring update.

Changes

  • src/ring.cpp: replace 2-second PERIOD_SEC modulo with a 150-second PHASE_WINDOW chosen to avoid phase lock against the 60-second update cadence

Test plan

  • Trigger a weather alert and observe ring brightness visibly changes between consecutive 1-minute updates
  • Confirm the ring does not strobe or flicker

now % 2 yields only {0, 1}. Since the ring updates every 60 s and
gcd(60, 2)=2, the parity of now never changes between updates, so
phase was permanently locked at a single value and the ring showed
constant brightness with no visible pulse.

Replace with a 150-second integer window: gcd(60, 150)=30, giving
5 distinct phase values on consecutive per-minute updates so the
cosine brightness ramp is actually traversable. Also removes the
static_cast<std::time_t>(double) truncation footgun.

https://claude.ai/code/session_01Lq2gNbRv9voqav7jsmQMnD
@GageLawton GageLawton merged commit 30045a3 into main May 27, 2026
2 checks passed
@GageLawton GageLawton deleted the claude/fix-ring-pulse-71 branch May 27, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: alert ring pulse period is 200 seconds, not the ~2 seconds the comment implies

2 participants