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