fix: sleep-animation

This commit is contained in:
Armas Spann
2023-04-04 01:20:25 +02:00
parent 3bdb03b1d8
commit 5c70fec29a

View File

@@ -38,7 +38,7 @@ impl From<AnimeConfigV341> for AnimeConfig {
} else {
vec![]
},
sleep: if let Some(ani) = c.shutdown {
sleep: if let Some(ani) = c.shutdown.clone() {
vec![ani]
} else {
vec![]
@@ -79,6 +79,7 @@ pub struct AnimeConfigV460 {
pub system: Vec<ActionLoader>,
pub boot: Vec<ActionLoader>,
pub wake: Vec<ActionLoader>,
pub sleep: Vec<ActionLoader>,
pub shutdown: Vec<ActionLoader>,
pub brightness: f32,
}
@@ -89,7 +90,7 @@ impl From<AnimeConfigV460> for AnimeConfig {
system: c.system,
boot: c.boot,
wake: c.wake,
sleep: c.shutdown.clone(),
sleep: c.sleep,
shutdown: c.shutdown,
brightness: 1.0,
awake_enabled: true,
@@ -131,6 +132,12 @@ impl AnimeConfigCached {
}
self.wake = wake;
let mut sleep = Vec::with_capacity(config.sleep.len());
for ani in &config.sleep {
sleep.push(ActionData::from_anime_action(anime_type, ani)?);
}
self.sleep = sleep;
let mut shutdown = Vec::with_capacity(config.shutdown.len());
for ani in &config.shutdown {
shutdown.push(ActionData::from_anime_action(anime_type, ani)?);