Skip to content

Commit

Permalink
Better fix for hue wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmay committed Aug 10, 2024
1 parent f19d546 commit e5cd059
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions brian-backend/src/lights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ fn rainbow_entity(name: impl Into<String>) -> stateful::Receiver<PowerColor> {
let colors: Vec<HSBK> = (0..num_per_cycle)
.map(|j| {
let mut hue = f32::from(i + j) * 360.0 / f32::from(num_per_cycle);
#[allow(clippy::while_float)]
while hue >= 360.0 {
hue -= 360.0;
}
hue = hue.rem_euclid(360.0);
HSBK {
hue,
saturation: 100.0,
Expand Down

0 comments on commit e5cd059

Please sign in to comment.