Return error if a pixel-gif is larger than the anime-display dimensions

This commit is contained in:
Luke D. Jones
2022-07-20 20:52:03 +12:00
parent a71a40b509
commit 7a8bede92f
5 changed files with 36 additions and 2 deletions

View File

@@ -16,6 +16,8 @@ pub struct AnimeCommand {
pub boot_enable: Option<bool>,
#[options(meta = "", help = "set global AniMe brightness value")]
pub brightness: Option<f32>,
#[options(help = "clear the display")]
pub clear: bool,
#[options(command)]
pub command: Option<AnimeActions>,
}

View File

@@ -230,6 +230,13 @@ fn handle_anime(
verify_brightness(bright);
dbus.proxies().anime().set_brightness(bright)?
}
if cmd.clear {
let anime_type = get_anime_type()?;
let data = vec![0u8; anime_type.data_length()];
let tmp = AnimeDataBuffer::from_vec(anime_type, data)?;
dbus.proxies().anime().write(tmp)?;
}
if let Some(action) = cmd.command.as_ref() {
let anime_type = get_anime_type()?;
match action {