Fix alert ring pulse stuck at near-static brightness#105
Merged
Conversation
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
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 #71
The alert pulse was intended to cycle visibly, but the modulo window (
PERIOD_SEC * 100 = 200s) 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-secondPERIOD_SECmodulo with a 150-secondPHASE_WINDOWchosen to avoid phase lock against the 60-second update cadenceTest plan