From 53bda4eb069d2de19e1869f28eb16a3eacf3f59d Mon Sep 17 00:00:00 2001 From: Andre Henriques Date: Mon, 10 Jul 2023 12:03:05 +0100 Subject: [PATCH] chore: change reload method --- src/animations.rs | 6 ------ src/main.rs | 12 ++++++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/animations.rs b/src/animations.rs index 096616b..2b5f616 100644 --- a/src/animations.rs +++ b/src/animations.rs @@ -407,8 +407,6 @@ pub fn get_animation(name: &str, db: &State) -> Result }) })?; - println!("got here 4"); - while let Some(key_frame_id) = map.next() { let mut key_frame_id = key_frame_id?; @@ -430,13 +428,9 @@ pub fn get_animation(name: &str, db: &State) -> Result key_frame_id.keyframe.settings.push(light_setting?); } - println!("loop stuff"); - animation.animation.key_frames.push(key_frame_id.keyframe); } - println!("got here 6"); - Ok(Some(animation.animation)) } diff --git a/src/main.rs b/src/main.rs index 9f73de3..a70aa00 100644 --- a/src/main.rs +++ b/src/main.rs @@ -110,7 +110,7 @@ fn ligth_controll( return; } - let mut render = render.ok().unwrap(); + let mut render = render.unwrap(); 'mainloop: loop { let action = action.try_recv(); @@ -118,10 +118,14 @@ fn ligth_controll( if let Ok(action) = action { match action { Action::Reload => { - let result = render.load_config(); - if result.is_err() || result.as_ref().ok().is_none() { - println!("Ehh failed to load config i guess: {:?}", result.err()); + let new_render = render::Render::new(pool.clone()); + + if new_render.is_err() || new_render.as_ref().ok().is_none() { + println!("something every wrong {:?}", new_render.err()); + continue; } + + render = new_render.unwrap(); } Action::Clear => { render.blank();