From 2b9daeb2202acd34b126fe9c97cbfccab60886d5 Mon Sep 17 00:00:00 2001 From: Fl1tzi Date: Tue, 5 Sep 2023 20:35:03 +0200 Subject: [PATCH] clear image instead of shutting down the device --- src/device.rs | 4 +++- src/helper.rs | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/helper.rs diff --git a/src/device.rs b/src/device.rs index f5f5a42..e2c7a0d 100644 --- a/src/device.rs +++ b/src/device.rs @@ -192,7 +192,9 @@ impl Device { self.selected_space = Some(name) } self.drop(); - self.device.reset().await.unwrap(); + for key in 0..self.device.kind().key_count() { + self.device.clear_button_image(key).await.unwrap(); + } self.init_modules().await; } diff --git a/src/helper.rs b/src/helper.rs new file mode 100644 index 0000000..bef6eb2 --- /dev/null +++ b/src/helper.rs @@ -0,0 +1,11 @@ +// various functions useful for internal parsing or other things + +/// Error for any kind of parsing +pub enum ParseError { + /// Generic error -> something is wrong + UnexpectedValue +} + +pub fn hex_to_rgb(hex: String) -> Result, ParseError> { + +}