Skip to content

Commit

Permalink
chore: temp dbg
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgomesdev committed Dec 24, 2023
1 parent e78c9bd commit c1ffc34
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions server/src/ps_move/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ impl PsMoveController {
}

pub fn set_led_effect(&mut self, effect: LedEffect) {
let mut kind = effect.kind;
let kind = effect.kind;

self.setting.led = kind.get_initial_hsv().unwrap();
self.setting.led = kind.get_initial_hsv();
self.led_effect = effect;
self.has_changed_since_last_update = true;
}
Expand Down Expand Up @@ -244,7 +244,7 @@ impl PsMoveController {
// temp logs
if !self.has_changed_since_last_update {
if SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() % 1000 == 0 {
debug!("Has not changed. ({})". self.led_effect.kind);
debug!("Has not changed. ({})", self.led_effect.kind);
}
return Ok(());
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/ps_move/effects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl LedEffectKind {
/// Returns Some when the Hsv has changed (note: some effects always change, such as Breathing, others never change like static)
pub fn get_updated_hsv(&mut self, current_hsv: Hsv) -> Option<Hsv> {
Some(match *self {
LedEffectKind::Off | LedEffectKind::Static => { return None },
LedEffectKind::Off | LedEffectKind::Static { hsv: _ } => { return None },
LedEffectKind::Breathing {
initial_hsv,
time_to_peak,
Expand Down
4 changes: 3 additions & 1 deletion server/src/tasks/effects_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pub async fn run(
let current_hsv = initial_state.hsv;
let effect = &mut initial_state.effect;

initial_state.hsv = effect.kind.get_updated_hsv(current_hsv);
if let Some(hsv) = effect.kind.get_updated_hsv(current_hsv) {
initial_state.hsv = hsv
}
}
}

0 comments on commit c1ffc34

Please sign in to comment.