tasks: ui: use embassy-futures instead of futures crate
This commit is contained in:
@@ -69,11 +69,11 @@ embassy-embedded-hal = "0.5.0"
|
||||
embedded-hal-async = "1.0.0"
|
||||
nalgebra = { version = "0.33.2", default-features = false, features = ["alloc", "libm"] }
|
||||
xtensa-lx-rt = { version = "*", features = ["float-save-restore"] }
|
||||
futures = { version = "0.3.31", default-features = false, features = ["async-await"] }
|
||||
micromath = "2.1.0"
|
||||
enumset = "1.1.10"
|
||||
enum-map = "2.7.3"
|
||||
portable-atomic = { version = "1.11", features = ["critical-section"] }
|
||||
embassy-futures = { version = "0.1.2", features = ["log"] }
|
||||
|
||||
# Telemetry outputs
|
||||
esp-radio = { version = "*", optional = true, features = [
|
||||
|
||||
@@ -4,7 +4,6 @@ use figments::prelude::*;
|
||||
use figments_render::output::Brightness;
|
||||
use rgb::Rgba;
|
||||
use core::fmt::Debug;
|
||||
use futures::join;
|
||||
use log::*;
|
||||
|
||||
use crate::{animation::{AnimDisplay, AnimatedSurface, Animation}, events::{Personality, Prediction}, graphics::{display::{DisplayControls, SegmentSpace, Uniforms}, shaders::*}, tasks::ui::UiSurfacePool};
|
||||
@@ -84,10 +83,10 @@ impl<S: Debug + Surface<Uniforms = Uniforms, CoordinateSpace = SegmentSpace, Pix
|
||||
self.headlight.set_visible(true);
|
||||
self.brakelight.set_opacity(0);
|
||||
self.brakelight.set_visible(true);
|
||||
join!(
|
||||
embassy_futures::join::join(
|
||||
fade_in.apply(&mut self.headlight),
|
||||
fade_in.apply(&mut self.brakelight)
|
||||
);
|
||||
).await;
|
||||
|
||||
info!("Fade out overlay");
|
||||
TURN_OFF.apply(&mut self.overlay).await;
|
||||
@@ -100,17 +99,17 @@ impl<S: Debug + Surface<Uniforms = Uniforms, CoordinateSpace = SegmentSpace, Pix
|
||||
Personality::Active => {
|
||||
// FIXME: These should be a Off/Low/High enum, so the stopping brake looks different from the dayrunning brake.
|
||||
warn!("Active personality: Turning on safety lights");
|
||||
join!(
|
||||
embassy_futures::join::join(
|
||||
TURN_ON.apply(&mut self.brakelight),
|
||||
TURN_ON.apply(&mut self.headlight)
|
||||
);
|
||||
).await;
|
||||
},
|
||||
Personality::Parked => {
|
||||
warn!("Idle personality: Turning off safety lights");
|
||||
join!(
|
||||
embassy_futures::join::join(
|
||||
TURN_OFF.apply(&mut self.brakelight),
|
||||
TURN_OFF.apply(&mut self.headlight)
|
||||
);
|
||||
).await;
|
||||
},
|
||||
Personality::Sleeping => {
|
||||
warn!("Sleeping personality: Safety UI is going to sleep");
|
||||
|
||||
@@ -99,12 +99,12 @@ impl<S: Debug + Surface<Uniforms = Uniforms, CoordinateSpace = SegmentSpace, Pix
|
||||
let panels = Animation::default().duration(Duration::from_millis(300)).to(128);
|
||||
let bg = Animation::default().duration(Duration::from_millis(300)).to(32);
|
||||
let motion = Animation::default().duration(Duration::from_secs(1)).to(0);
|
||||
join!(
|
||||
embassy_futures::join::join4(
|
||||
tail.apply(&mut self.tail),
|
||||
panels.apply(&mut self.panels),
|
||||
bg.apply(&mut self.background),
|
||||
motion.apply(&mut self.motion)
|
||||
);
|
||||
).await;
|
||||
self.background.set_shader(Background::default());
|
||||
},
|
||||
Scene::Idle => {
|
||||
@@ -114,12 +114,12 @@ impl<S: Debug + Surface<Uniforms = Uniforms, CoordinateSpace = SegmentSpace, Pix
|
||||
let bg_fade = Animation::default().duration(Duration::from_millis(300)).to(128);
|
||||
|
||||
// FIXME: The scenes shouldn't be touching the brake/headlights at all here. In fact, they should be dealt with in a whole separate task from the main UI, maybe running on the motion prediction executor
|
||||
join!(
|
||||
embassy_futures::join::join4(
|
||||
fg_fade.apply(&mut self.tail),
|
||||
fg_fade.apply(&mut self.panels),
|
||||
bg_fade.apply(&mut self.background),
|
||||
fg_fade.apply(&mut self.motion)
|
||||
);
|
||||
).await;
|
||||
},
|
||||
Scene::Accelerating => {
|
||||
self.motion.set_shader(Movement::default());
|
||||
|
||||
Reference in New Issue
Block a user