mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Proper fix of laptop mode conversion bug
This commit is contained in:
@@ -234,6 +234,7 @@ impl From<&AuraModes> for u8 {
|
||||
AuraModes::Comet(_) => COMET,
|
||||
AuraModes::Flash(_) => FLASH,
|
||||
AuraModes::MultiStatic(_) => MULTISTATIC,
|
||||
AuraModes::RGB(_) => RGB,
|
||||
_ => panic!("Invalid mode"),
|
||||
}
|
||||
}
|
||||
@@ -279,6 +280,7 @@ impl From<u8> for AuraModes {
|
||||
COMET => AuraModes::Comet(SingleColour::default()),
|
||||
FLASH => AuraModes::Flash(SingleColour::default()),
|
||||
MULTISTATIC => AuraModes::MultiStatic(MultiColour::default()),
|
||||
RGB => AuraModes::RGB(vec![]),
|
||||
_ => panic!("Invalid mode byte"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,8 +151,7 @@ impl From<&AuraModes> for [u8; LED_MSG_LEN] {
|
||||
AuraModes::Pulse(_) => msg[3] = 0x0a,
|
||||
AuraModes::Comet(_) => msg[3] = 0x0b,
|
||||
AuraModes::Flash(_) => msg[3] = 0x0c,
|
||||
AuraModes::MultiStatic(_) => msg[3] = 0x0d,
|
||||
_ => print!("Mode not convertable to array: {}", <&str>::from(mode)),
|
||||
_ => panic!("Mode not convertable to 1D array: {}", <&str>::from(mode)),
|
||||
}
|
||||
|
||||
match mode {
|
||||
@@ -195,7 +194,7 @@ impl From<&AuraModes> for [u8; LED_MSG_LEN] {
|
||||
msg[5] = settings.colour.1;
|
||||
msg[6] = settings.colour.2;
|
||||
}
|
||||
_ => panic!("Mode not convertable to array"),
|
||||
_ => panic!("Mode not convertable to 1D array: {}", <&str>::from(mode)),
|
||||
}
|
||||
msg
|
||||
}
|
||||
@@ -240,7 +239,7 @@ impl From<&AuraModes> for [[u8; LED_MSG_LEN]; 4] {
|
||||
msg[3][5] = settings.colour4.1;
|
||||
msg[3][6] = settings.colour4.2;
|
||||
}
|
||||
_ => panic!("Mode not convertable to array"),
|
||||
_ => panic!("Mode not convertable to 2D array: {}", <&str>::from(mode)),
|
||||
}
|
||||
msg
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user