From 349509ed330f12ace87aeea7a5429b39e1b5280a Mon Sep 17 00:00:00 2001 From: David Gomes <10091092+davidgomesdev@users.noreply.github.com> Date: Sun, 24 Dec 2023 15:41:05 +0000 Subject: [PATCH] chore: temp dbg --- server/src/ps_move/controller.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/server/src/ps_move/controller.rs b/server/src/ps_move/controller.rs index 15b314e..9ff7cbb 100644 --- a/server/src/ps_move/controller.rs +++ b/server/src/ps_move/controller.rs @@ -240,7 +240,7 @@ impl PsMoveController { self.setting.rumble = rumble_effect.kind.get_updated_rumble(current_rumble); } - fn update_hsv_and_rumble(&self) -> Result<(), ()> { + fn update_hsv_and_rumble(&mut self) -> Result<(), ()> { // temp logs if !self.has_changed_since_last_update { if SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() % 1000 == 0 { @@ -248,14 +248,19 @@ impl PsMoveController { } return Ok(()); } - debug!("Has changed! Sending {} (with {:?})", self.led_effect.kind, self.setting.led); + if SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() % 1000 == 0 { + debug!("Has changed! Sending {} (with {:?})", self.led_effect.kind, self.setting.led); + } let request = build_set_led_and_rumble_request(self.setting.led, self.setting.rumble); let res = self.device.write(&request); match res { - Ok(_) => Ok(()), + Ok(_) => { + self.has_changed_since_last_update = false; + Ok(()) + } Err(err) => { let err = &err;