From d5f525a15e4139e1c5b95cad5ae2aa2f1a61db18 Mon Sep 17 00:00:00 2001 From: David Gomes <10091092+davidgomesdev@users.noreply.github.com> Date: Sat, 11 May 2024 15:45:25 +0100 Subject: [PATCH] fix: fix overload of ticks on effect --- server/src/ps_move/controller.rs | 4 ++-- server/src/tasks/effects_update.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/ps_move/controller.rs b/server/src/ps_move/controller.rs index 6a95a6c6..11d32567 100644 --- a/server/src/ps_move/controller.rs +++ b/server/src/ps_move/controller.rs @@ -122,10 +122,10 @@ impl PsMoveController { self.last_led_effect = self.led_effect; self.setting.last_led = self.setting.led; - let mut kind = effect.kind; + let kind = effect.kind; self.led_effect = effect; - self.setting.led = kind.get_updated_hsv(self.setting.led); + self.setting.led = kind.get_initial_hsv(); } pub fn set_led_effect_with_hsv(&mut self, effect: LedEffect, hsv: Hsv) { diff --git a/server/src/tasks/effects_update.rs b/server/src/tasks/effects_update.rs index 68aa4d16..50af0f46 100644 --- a/server/src/tasks/effects_update.rs +++ b/server/src/tasks/effects_update.rs @@ -1,5 +1,5 @@ use std::sync::Arc; -use std::time::Duration; +use std::time::{Duration, Instant}; use tokio::sync::Mutex; use tokio::task::JoinHandle; @@ -17,7 +17,7 @@ pub async fn run( ) -> JoinHandle<()> { let mut interval = time::interval(INTERVAL_DURATION); - interval.set_missed_tick_behavior(MissedTickBehavior::Burst); + interval.set_missed_tick_behavior(MissedTickBehavior::Skip); loop { interval.tick().await;