refactor: concurrent brightness and colour transitions - #14
Merged
Conversation
retsimx
commented
Mar 22, 2026
Owner
- Replace monolithic old/current/new LightState triple with three independent Transition structs (brightness, CW, WW), each with their own timeline
- Brightness and colour channels now transition concurrently instead of serially
- Extract ease-in-out function as a free function (removed unused self receiver)
- Remove overloaded timestamp field from LightState; semantics are now clear via explicit start/end Instants on each Transition
- Add same-target guard in Transition::begin() so receiving the same state back mid-transition (e.g. controller echo on boot) no longer resets the timer, fixing a bug where startup transitions could take up to 2x longer than intended
- light_onoff_hw() now only modifies the brightness channel, leaving colour transitions undisturbed
- get_current_light_state() returns by value, ending the borrow of app() earlier
- Expand test coverage to 100% lines/functions on the light management module, covering all flash retrieve paths, recover-status branches, and channel independence invariants
- Fix unused-mut warning in unrelated test helper
- Apply rustfmt
📊 Coverage Report
|
- Replace monolithic old/current/new LightState triple with three independent Transition structs (brightness, CW, WW), each with their own timeline - Brightness and colour channels now transition concurrently instead of serially - Extract ease-in-out function as a free function (removed unused self receiver) - Remove overloaded timestamp field from LightState; semantics are now clear via explicit start/end Instants on each Transition - Add same-target guard in Transition::begin() so receiving the same state back mid-transition (e.g. controller echo on boot) no longer resets the timer, fixing a bug where startup transitions could take up to 2x longer than intended - light_onoff_hw() now only modifies the brightness channel, leaving colour transitions undisturbed - get_current_light_state() returns by value, ending the borrow of app() earlier - Expand test coverage to 100% lines/functions on the light management module, covering all flash retrieve paths, recover-status branches, and channel independence invariants - Fix unused-mut warning in unrelated test helper - Apply rustfmt
- Rename begin() to begin_at(start, to) and step() to step_at(now) so callers own the timestamp - begin_transition() captures a single Instant before calling begin_at on all three channels, ensuring brightness/CW/WW share an identical start and end time rather than diverging by the cost of repeated now() calls - transition_step() captures now once and passes it to each step_at, removing per-channel skew on every timer tick and reducing syscall overhead inside the IRQ handler
retsimx
force-pushed
the
refactor/concurrent-light-transitions
branch
from
March 23, 2026 02:20
549acfb to
efb7666
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.