Skip to content

refactor: concurrent brightness and colour transitions - #14

Merged
retsimx merged 2 commits into
mainfrom
refactor/concurrent-light-transitions
Mar 23, 2026
Merged

refactor: concurrent brightness and colour transitions#14
retsimx merged 2 commits into
mainfrom
refactor/concurrent-light-transitions

Conversation

@retsimx

@retsimx retsimx commented Mar 22, 2026

Copy link
Copy Markdown
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

@github-actions

github-actions Bot commented Mar 22, 2026

Copy link
Copy Markdown

📊 Coverage Report

Metric Coverage
Lines 99.84%
Functions 100.00%
Regions 99.75%
Branches 93.93%

This comment was marked as outdated.

retsimx added 2 commits March 23, 2026 13:07
- 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
retsimx force-pushed the refactor/concurrent-light-transitions branch from 549acfb to efb7666 Compare March 23, 2026 02:20
@retsimx
retsimx merged commit 3259b5e into main Mar 23, 2026
5 checks passed
@retsimx
retsimx deleted the refactor/concurrent-light-transitions branch March 23, 2026 02:24
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.

2 participants