mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Try to fix up multizone modes
- Write set+apply after each array in multizone - Remove misc bad logic - Use same code path as 0x1866 device to configure led support - Remove duplicate code - Set correct speeds for multizone
This commit is contained in:
@@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Changed
|
||||||
|
- Write set+apply after each array in multizone
|
||||||
|
- Remove misc bad logic
|
||||||
|
- Use same code path as 0x1866 device to configure led support
|
||||||
|
- Remove duplicate code
|
||||||
|
- Set correct speeds for multizone
|
||||||
|
|
||||||
# [2.2.2] - 2021-01-31
|
# [2.2.2] - 2021-01-31
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ impl PciBus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct GraphicsDevice {
|
pub struct GraphicsDevice {
|
||||||
id: String,
|
_id: String,
|
||||||
functions: Vec<PciDevice>,
|
functions: Vec<PciDevice>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GraphicsDevice {
|
impl GraphicsDevice {
|
||||||
pub fn new(id: String, functions: Vec<PciDevice>) -> GraphicsDevice {
|
pub fn new(id: String, functions: Vec<PciDevice>) -> GraphicsDevice {
|
||||||
GraphicsDevice { id, functions }
|
GraphicsDevice { _id: id, functions }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn exists(&self) -> bool {
|
pub fn exists(&self) -> bool {
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ impl GetSupported for CtrlKbdBacklight {
|
|||||||
.map(|x| *x)
|
.map(|x| *x)
|
||||||
.collect();
|
.collect();
|
||||||
stock_led_modes = Some(modes);
|
stock_led_modes = Some(modes);
|
||||||
|
} else {
|
||||||
|
stock_led_modes = Some(modes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,9 +113,14 @@ impl DbusKbdBacklight {
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if let Ok(json) = serde_json::to_string(&data) {
|
if let Ok(json) = serde_json::to_string(&data) {
|
||||||
ctrl.do_command(data, &mut cfg)
|
match ctrl.do_command(data, &mut cfg) {
|
||||||
.unwrap_or_else(|err| warn!("{}", err));
|
Ok(_) => {
|
||||||
self.notify_led(&json).ok();
|
self.notify_led(&json).ok();
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
warn!("{}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,29 +288,29 @@ impl CtrlKbdBacklight {
|
|||||||
config: Arc<Mutex<Config>>,
|
config: Arc<Mutex<Config>>,
|
||||||
) -> Result<Self, RogError> {
|
) -> Result<Self, RogError> {
|
||||||
// TODO: return error if *all* nodes are None
|
// TODO: return error if *all* nodes are None
|
||||||
let led_node = Self::get_node_failover(
|
let led_node = Self::get_node_failover(id_product, None, Self::scan_led_node).map_or_else(
|
||||||
id_product,
|
|err| {
|
||||||
None,
|
warn!("led_node: {}", err);
|
||||||
Self::scan_led_node,
|
None
|
||||||
).map_or_else(|err| {
|
},
|
||||||
warn!("led_node: {}", err);
|
|node| Some(node),
|
||||||
None
|
);
|
||||||
}, |node| Some(node));
|
|
||||||
|
|
||||||
let kbd_node = Self::get_node_failover(
|
let kbd_node = Self::get_node_failover(id_product, condev_iface, Self::scan_kbd_node)
|
||||||
id_product,
|
.map_or_else(
|
||||||
condev_iface,
|
|err| {
|
||||||
Self::scan_kbd_node,
|
warn!("kbd_node: {}", err);
|
||||||
).map_or_else(|err| {
|
None
|
||||||
warn!("kbd_node: {}", err);
|
},
|
||||||
None
|
|node| Some(node),
|
||||||
}, |node| Some(node));
|
);
|
||||||
|
|
||||||
let bright_node = Self::get_kbd_bright_path();
|
let bright_node = Self::get_kbd_bright_path();
|
||||||
|
|
||||||
if led_node.is_none() && kbd_node.is_none() && Self::get_kbd_bright_path().is_err() {
|
if led_node.is_none() && kbd_node.is_none() && Self::get_kbd_bright_path().is_err() {
|
||||||
return Err(RogError::MissingFunction(
|
return Err(RogError::MissingFunction(
|
||||||
"All keyboard features missing, you may require a v5.11 series kernel or newer".into(),
|
"All keyboard features missing, you may require a v5.11 series kernel or newer"
|
||||||
|
.into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,6 +445,7 @@ impl CtrlKbdBacklight {
|
|||||||
fn write_bytes(&self, message: &[u8]) -> Result<(), RogError> {
|
fn write_bytes(&self, message: &[u8]) -> Result<(), RogError> {
|
||||||
if let Some(led_node) = &self.led_node {
|
if let Some(led_node) = &self.led_node {
|
||||||
if let Ok(mut file) = OpenOptions::new().write(true).open(led_node) {
|
if let Ok(mut file) = OpenOptions::new().write(true).open(led_node) {
|
||||||
|
// println!("write: {:02x?}", &message);
|
||||||
return file
|
return file
|
||||||
.write_all(message)
|
.write_all(message)
|
||||||
.map_err(|err| RogError::Write("write_bytes".into(), err));
|
.map_err(|err| RogError::Write("write_bytes".into(), err));
|
||||||
@@ -529,6 +537,10 @@ impl CtrlKbdBacklight {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn write_mode(&mut self, mode: &AuraModes) -> Result<(), RogError> {
|
fn write_mode(&mut self, mode: &AuraModes) -> Result<(), RogError> {
|
||||||
|
let mode_num: u8 = u8::from(mode);
|
||||||
|
if !self.supported_modes.contains(&mode_num) {
|
||||||
|
return Err(RogError::NotSupported);
|
||||||
|
}
|
||||||
match mode {
|
match mode {
|
||||||
AuraModes::PerKey(v) => {
|
AuraModes::PerKey(v) => {
|
||||||
if v.is_empty() || v[0].is_empty() {
|
if v.is_empty() || v[0].is_empty() {
|
||||||
@@ -538,27 +550,22 @@ impl CtrlKbdBacklight {
|
|||||||
self.write_effect(v)?;
|
self.write_effect(v)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
AuraModes::MultiStatic(_) | AuraModes::MultiBreathe(_) => {
|
||||||
let mode_num: u8 = u8::from(mode);
|
let bytes: [[u8; LED_MSG_LEN]; 4] = mode.into();
|
||||||
match mode {
|
for array in bytes.iter() {
|
||||||
AuraModes::MultiStatic(_) => {
|
self.write_bytes(array)?;
|
||||||
if self.supported_modes.contains(&mode_num) {
|
|
||||||
let bytes: [[u8; LED_MSG_LEN]; 4] = mode.into();
|
|
||||||
for array in bytes.iter() {
|
|
||||||
self.write_bytes(array)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
if self.supported_modes.contains(&mode_num) {
|
|
||||||
let bytes: [u8; LED_MSG_LEN] = mode.into();
|
|
||||||
self.write_bytes(&bytes)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
self.write_bytes(&LED_SET)?;
|
self.write_bytes(&LED_SET)?;
|
||||||
// Changes won't persist unless apply is set
|
// Changes won't persist unless apply is set
|
||||||
self.write_bytes(&LED_APPLY)?;
|
self.write_bytes(&LED_APPLY)?;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
let bytes: [u8; LED_MSG_LEN] = mode.into();
|
||||||
|
self.write_bytes(&bytes)?;
|
||||||
|
self.write_bytes(&LED_SET)?;
|
||||||
|
// Changes won't persist unless apply is set
|
||||||
|
self.write_bytes(&LED_APPLY)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ static ASUS_POST_LOGO_SOUND: &str =
|
|||||||
"/sys/firmware/efi/efivars/AsusPostLogoSound-607005d5-3f75-4b2e-98f0-85ba66797a3e";
|
"/sys/firmware/efi/efivars/AsusPostLogoSound-607005d5-3f75-4b2e-98f0-85ba66797a3e";
|
||||||
|
|
||||||
pub struct CtrlRogBios {
|
pub struct CtrlRogBios {
|
||||||
config: Arc<Mutex<Config>>,
|
_config: Arc<Mutex<Config>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
@@ -138,7 +138,7 @@ impl CtrlRogBios {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(CtrlRogBios { config })
|
Ok(CtrlRogBios { _config: config })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_path_mutable(path: &str) -> Result<(), RogError> {
|
fn set_path_mutable(path: &str) -> Result<(), RogError> {
|
||||||
|
|||||||
@@ -178,13 +178,15 @@ fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
object_server.with(&"/org/asuslinux/Charge".try_into()?, |obj: &CtrlCharge| {
|
object_server
|
||||||
let x = obj.limit();
|
.with(&"/org/asuslinux/Charge".try_into()?, |obj: &CtrlCharge| {
|
||||||
obj.notify_charge(x as u8)
|
let x = obj.limit();
|
||||||
}).map_err(|err| {
|
obj.notify_charge(x as u8)
|
||||||
warn!("object_server notify_charge error: {}", err);
|
})
|
||||||
})
|
.map_err(|err| {
|
||||||
.ok();
|
warn!("object_server notify_charge error: {}", err);
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if let Err(err) = object_server.try_handle_next() {
|
if let Err(err) = object_server.try_handle_next() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use asus_nb::aura_modes::{AuraModes, BREATHING, STATIC, STROBE};
|
use asus_nb::aura_modes::{AuraModes, BREATHING, STATIC};
|
||||||
use log::{info, warn};
|
use log::{info, warn};
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
@@ -8,6 +8,9 @@ pub static LEDMODE_CONFIG_PATH: &str = "/etc/asusd/asusd-ledmodes.toml";
|
|||||||
|
|
||||||
pub static HELP_ADDRESS: &str = "https://gitlab.com/asus-linux/asus-nb-ctrl";
|
pub static HELP_ADDRESS: &str = "https://gitlab.com/asus-linux/asus-nb-ctrl";
|
||||||
|
|
||||||
|
static LAPTOP_DEVICES: [u16; 3] = [0x1866, 0x1869, 0x1854];
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct LaptopBase {
|
pub struct LaptopBase {
|
||||||
usb_product: String,
|
usb_product: String,
|
||||||
condev_iface: Option<String>, // required for finding the Consumer Device interface
|
condev_iface: Option<String>, // required for finding the Consumer Device interface
|
||||||
@@ -27,24 +30,22 @@ impl LaptopBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn match_laptop() -> Option<LaptopBase> {
|
pub fn match_laptop() -> Option<LaptopBase> {
|
||||||
for device in rusb::devices().expect("Failed here").iter() {
|
for device in rusb::devices().expect("Couldn't get device").iter() {
|
||||||
let device_desc = device.device_descriptor().expect("Failed there");
|
let device_desc = device.device_descriptor().expect("Couldn't get device descriptor");
|
||||||
if device_desc.vendor_id() == 0x0b05 {
|
if device_desc.vendor_id() == 0x0b05 {
|
||||||
match device_desc.product_id() {
|
if LAPTOP_DEVICES.contains(&device_desc.product_id()) {
|
||||||
0x1866 => {
|
let prod_str = format!("{:x?}", device_desc.product_id());
|
||||||
let laptop = select_1866_device("1866".to_owned());
|
|
||||||
|
if device_desc.product_id() == 0x1854 {
|
||||||
|
let mut laptop = laptop(prod_str, None);
|
||||||
|
if laptop.supported_modes.is_empty() {
|
||||||
|
laptop.supported_modes = vec![STATIC, BREATHING];
|
||||||
|
}
|
||||||
return Some(laptop);
|
return Some(laptop);
|
||||||
}
|
}
|
||||||
0x1869 => return Some(select_1866_device("1869".to_owned())),
|
|
||||||
0x1854 => {
|
let laptop = laptop(prod_str, Some("02".to_owned()));
|
||||||
info!("Found GL753 or similar");
|
return Some(laptop);
|
||||||
return Some(LaptopBase {
|
|
||||||
usb_product: "1854".to_string(),
|
|
||||||
condev_iface: None,
|
|
||||||
supported_modes: vec![STATIC, BREATHING, STROBE],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,14 +57,14 @@ pub fn match_laptop() -> Option<LaptopBase> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_1866_device(prod: String) -> LaptopBase {
|
fn laptop(prod: String, condev_iface: Option<String>) -> LaptopBase {
|
||||||
let dmi = sysfs_class::DmiId::default();
|
let dmi = sysfs_class::DmiId::default();
|
||||||
let board_name = dmi.board_name().expect("Could not get board_name");
|
let board_name = dmi.board_name().expect("Could not get board_name");
|
||||||
let prod_family = dmi.product_family().expect("Could not get product_family");
|
let prod_family = dmi.product_family().expect("Could not get product_family");
|
||||||
|
|
||||||
let mut laptop = LaptopBase {
|
let mut laptop = LaptopBase {
|
||||||
usb_product: prod,
|
usb_product: prod,
|
||||||
condev_iface: Some("02".to_owned()),
|
condev_iface,
|
||||||
supported_modes: vec![],
|
supported_modes: vec![],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
if let Some(lst) = mode.self_command_list() {
|
if let Some(lst) = mode.self_command_list() {
|
||||||
println!("\n{}", lst);
|
println!("\n{}", lst);
|
||||||
}
|
}
|
||||||
|
println!("\nHelp can also be requested on modes, e.g: static --help");
|
||||||
}
|
}
|
||||||
if mode.next_mode && mode.prev_mode {
|
if mode.next_mode && mode.prev_mode {
|
||||||
println!("Please specify either next or previous")
|
println!("Please specify either next or previous")
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
use crate::cli_options;
|
|
||||||
use crate::cli_options::SetAuraBuiltin;
|
use crate::cli_options::SetAuraBuiltin;
|
||||||
|
use crate::error::AuraError;
|
||||||
|
use gumdrop::Options;
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
pub const STATIC: u8 = 0x00;
|
pub const STATIC: u8 = 0x00;
|
||||||
pub const BREATHING: u8 = 0x01;
|
pub const BREATHING: u8 = 0x01;
|
||||||
@@ -15,41 +17,56 @@ pub const PULSE: u8 = 0x0a;
|
|||||||
pub const COMET: u8 = 0x0b;
|
pub const COMET: u8 = 0x0b;
|
||||||
pub const FLASH: u8 = 0x0c;
|
pub const FLASH: u8 = 0x0c;
|
||||||
pub const MULTISTATIC: u8 = 0x0d;
|
pub const MULTISTATIC: u8 = 0x0d;
|
||||||
|
pub const MULTIBREATHE: u8 = 0x0e;
|
||||||
pub const PER_KEY: u8 = 0xff;
|
pub const PER_KEY: u8 = 0xff;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
pub struct Colour(pub u8, pub u8, pub u8);
|
pub struct Colour(pub u8, pub u8, pub u8);
|
||||||
impl From<cli_options::Colour> for Colour {
|
|
||||||
fn from(c: cli_options::Colour) -> Self {
|
|
||||||
Colour(c.0, c.1, c.2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Default for Colour {
|
impl Default for Colour {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Colour(128, 0, 0)
|
Colour(128, 0, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl FromStr for Colour {
|
||||||
|
type Err = AuraError;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
if s.len() < 6 {
|
||||||
|
return Err(AuraError::ParseColour);
|
||||||
|
}
|
||||||
|
let r = u8::from_str_radix(&s[0..2], 16).or(Err(AuraError::ParseColour))?;
|
||||||
|
let g = u8::from_str_radix(&s[2..4], 16).or(Err(AuraError::ParseColour))?;
|
||||||
|
let b = u8::from_str_radix(&s[4..6], 16).or(Err(AuraError::ParseColour))?;
|
||||||
|
Ok(Colour(r, g, b))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Copy, Clone, Deserialize, Serialize)]
|
||||||
pub enum Speed {
|
pub enum Speed {
|
||||||
Low = 0xe1,
|
Low = 0xe1,
|
||||||
Med = 0xeb,
|
Med = 0xeb,
|
||||||
High = 0xf5,
|
High = 0xf5,
|
||||||
}
|
}
|
||||||
impl From<cli_options::Speed> for Speed {
|
|
||||||
fn from(s: cli_options::Speed) -> Self {
|
|
||||||
match s {
|
|
||||||
cli_options::Speed::Low => Speed::Low,
|
|
||||||
cli_options::Speed::Med => Speed::Med,
|
|
||||||
cli_options::Speed::High => Speed::High,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Default for Speed {
|
impl Default for Speed {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Speed::Med
|
Speed::Med
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl FromStr for Speed {
|
||||||
|
type Err = AuraError;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
let s = s.to_lowercase();
|
||||||
|
match s.as_str() {
|
||||||
|
"low" => Ok(Speed::Low),
|
||||||
|
"med" => Ok(Speed::Med),
|
||||||
|
"high" => Ok(Speed::High),
|
||||||
|
_ => Err(AuraError::ParseSpeed),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Used for Rainbow mode.
|
/// Used for Rainbow mode.
|
||||||
///
|
///
|
||||||
@@ -61,107 +78,108 @@ pub enum Direction {
|
|||||||
Up,
|
Up,
|
||||||
Down,
|
Down,
|
||||||
}
|
}
|
||||||
impl From<cli_options::Direction> for Direction {
|
|
||||||
fn from(s: cli_options::Direction) -> Self {
|
|
||||||
match s {
|
|
||||||
cli_options::Direction::Right => Direction::Right,
|
|
||||||
cli_options::Direction::Left => Direction::Left,
|
|
||||||
cli_options::Direction::Up => Direction::Up,
|
|
||||||
cli_options::Direction::Down => Direction::Down,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Default for Direction {
|
impl Default for Direction {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Direction::Right
|
Direction::Right
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl FromStr for Direction {
|
||||||
|
type Err = AuraError;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
pub struct TwoColourSpeed {
|
let s = s.to_lowercase();
|
||||||
pub colour: Colour,
|
match s.as_str() {
|
||||||
pub colour2: Colour,
|
"right" => Ok(Direction::Right),
|
||||||
pub speed: Speed,
|
"up" => Ok(Direction::Up),
|
||||||
}
|
"down" => Ok(Direction::Down),
|
||||||
impl From<cli_options::TwoColourSpeed> for TwoColourSpeed {
|
"left" => Ok(Direction::Left),
|
||||||
fn from(mode: cli_options::TwoColourSpeed) -> Self {
|
_ => Err(AuraError::ParseDirection),
|
||||||
TwoColourSpeed {
|
|
||||||
colour: mode.colour.into(),
|
|
||||||
colour2: mode.colour2.into(),
|
|
||||||
speed: mode.speed.into(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Options, Default, Deserialize, Serialize)]
|
||||||
pub struct SingleSpeed {
|
pub struct SingleSpeed {
|
||||||
|
#[serde(skip)]
|
||||||
|
#[options(help = "print help message")]
|
||||||
|
help: bool,
|
||||||
|
#[options(no_long, meta = "WORD", help = "set the speed: low, med, high")]
|
||||||
pub speed: Speed,
|
pub speed: Speed,
|
||||||
}
|
}
|
||||||
impl From<cli_options::SingleSpeed> for SingleSpeed {
|
#[derive(Debug, Clone, Options, Default, Deserialize, Serialize)]
|
||||||
fn from(mode: cli_options::SingleSpeed) -> Self {
|
pub struct SingleSpeedDirection {
|
||||||
SingleSpeed {
|
#[serde(skip)]
|
||||||
speed: mode.speed.into(),
|
#[options(help = "print help message")]
|
||||||
}
|
help: bool,
|
||||||
}
|
#[options(no_long, meta = "", help = "set the direction: up, down, left, right")]
|
||||||
|
pub direction: Direction,
|
||||||
|
#[options(no_long, meta = "", help = "set the speed: low, med, high")]
|
||||||
|
pub speed: Speed,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Default, Options, Deserialize, Serialize)]
|
||||||
pub struct SingleColour {
|
pub struct SingleColour {
|
||||||
|
#[serde(skip)]
|
||||||
|
#[options(help = "print help message")]
|
||||||
|
help: bool,
|
||||||
|
#[options(no_long, meta = "", help = "set the RGB value e.g, ff00ff")]
|
||||||
pub colour: Colour,
|
pub colour: Colour,
|
||||||
}
|
}
|
||||||
impl From<cli_options::SingleColour> for SingleColour {
|
|
||||||
fn from(mode: cli_options::SingleColour) -> Self {
|
#[derive(Debug, Clone, Default, Options, Deserialize, Serialize)]
|
||||||
SingleColour {
|
pub struct SingleColourSpeed {
|
||||||
colour: mode.colour.into(),
|
#[serde(skip)]
|
||||||
}
|
#[options(help = "print help message")]
|
||||||
}
|
help: bool,
|
||||||
|
#[options(no_long, meta = "", help = "set the RGB value e.g, ff00ff")]
|
||||||
|
pub colour: Colour,
|
||||||
|
#[options(no_long, meta = "", help = "set the speed: low, med, high")]
|
||||||
|
pub speed: Speed,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Options, Default, Deserialize, Serialize)]
|
||||||
pub struct MultiColour {
|
pub struct TwoColourSpeed {
|
||||||
pub colour1: Colour,
|
#[serde(skip)]
|
||||||
|
#[options(help = "print help message")]
|
||||||
|
help: bool,
|
||||||
|
#[options(no_long, meta = "", help = "set the first RGB value e.g, ff00ff")]
|
||||||
|
pub colour: Colour,
|
||||||
|
#[options(no_long, meta = "", help = "set the second RGB value e.g, ff00ff")]
|
||||||
pub colour2: Colour,
|
pub colour2: Colour,
|
||||||
|
#[options(no_long, meta = "", help = "set the speed: low, med, high")]
|
||||||
|
pub speed: Speed,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Default, Options, Deserialize, Serialize)]
|
||||||
|
pub struct MultiColour {
|
||||||
|
#[serde(skip)]
|
||||||
|
#[options(help = "print help message")]
|
||||||
|
help: bool,
|
||||||
|
#[options(short = "a", meta = "", help = "set the RGB value e.g, ff00ff")]
|
||||||
|
pub colour1: Colour,
|
||||||
|
#[options(short = "b", meta = "", help = "set the RGB value e.g, ff00ff")]
|
||||||
|
pub colour2: Colour,
|
||||||
|
#[options(short = "c", meta = "", help = "set the RGB value e.g, ff00ff")]
|
||||||
pub colour3: Colour,
|
pub colour3: Colour,
|
||||||
|
#[options(short = "d", meta = "", help = "set the RGB value e.g, ff00ff")]
|
||||||
pub colour4: Colour,
|
pub colour4: Colour,
|
||||||
}
|
}
|
||||||
impl From<cli_options::MultiColour> for MultiColour {
|
|
||||||
fn from(mode: cli_options::MultiColour) -> Self {
|
|
||||||
MultiColour {
|
|
||||||
colour1: mode.colour1.into(),
|
|
||||||
colour2: mode.colour2.into(),
|
|
||||||
colour3: mode.colour3.into(),
|
|
||||||
colour4: mode.colour4.into(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Default, Options, Deserialize, Serialize)]
|
||||||
pub struct SingleSpeedDirection {
|
pub struct MultiColourSpeed {
|
||||||
pub direction: Direction,
|
#[options(help = "print help message")]
|
||||||
|
help: bool,
|
||||||
|
#[options(short = "a", meta = "", help = "set the RGB value e.g, ff00ff")]
|
||||||
|
pub colour1: Colour,
|
||||||
|
#[options(short = "b", meta = "", help = "set the RGB value e.g, ff00ff")]
|
||||||
|
pub colour2: Colour,
|
||||||
|
#[options(short = "c", meta = "", help = "set the RGB value e.g, ff00ff")]
|
||||||
|
pub colour3: Colour,
|
||||||
|
#[options(short = "d", meta = "", help = "set the RGB value e.g, ff00ff")]
|
||||||
|
pub colour4: Colour,
|
||||||
|
#[options(no_long, meta = "", help = "set the speed: low, med, high")]
|
||||||
pub speed: Speed,
|
pub speed: Speed,
|
||||||
}
|
}
|
||||||
impl From<cli_options::SingleSpeedDirection> for SingleSpeedDirection {
|
|
||||||
fn from(mode: cli_options::SingleSpeedDirection) -> Self {
|
|
||||||
SingleSpeedDirection {
|
|
||||||
direction: mode.direction.into(),
|
|
||||||
speed: mode.speed.into(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
|
||||||
pub struct SingleColourSpeed {
|
|
||||||
pub colour: Colour,
|
|
||||||
pub speed: Speed,
|
|
||||||
}
|
|
||||||
impl From<cli_options::SingleColourSpeed> for SingleColourSpeed {
|
|
||||||
fn from(mode: cli_options::SingleColourSpeed) -> Self {
|
|
||||||
SingleColourSpeed {
|
|
||||||
colour: mode.colour.into(),
|
|
||||||
speed: mode.speed.into(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
pub enum AuraModes {
|
pub enum AuraModes {
|
||||||
@@ -178,8 +196,10 @@ pub enum AuraModes {
|
|||||||
Comet(SingleColour),
|
Comet(SingleColour),
|
||||||
Flash(SingleColour),
|
Flash(SingleColour),
|
||||||
MultiStatic(MultiColour),
|
MultiStatic(MultiColour),
|
||||||
|
MultiBreathe(MultiColourSpeed),
|
||||||
LedBrightness(u8),
|
LedBrightness(u8),
|
||||||
// TODO: use a serializable structure for this (KeyColourArray)
|
// TODO: use a serializable structure for this (KeyColourArray)
|
||||||
|
#[serde(skip)]
|
||||||
PerKey(Vec<Vec<u8>>),
|
PerKey(Vec<Vec<u8>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,6 +219,7 @@ impl From<SetAuraBuiltin> for AuraModes {
|
|||||||
SetAuraBuiltin::Comet(x) => AuraModes::Comet(x.into()),
|
SetAuraBuiltin::Comet(x) => AuraModes::Comet(x.into()),
|
||||||
SetAuraBuiltin::Flash(x) => AuraModes::Flash(x.into()),
|
SetAuraBuiltin::Flash(x) => AuraModes::Flash(x.into()),
|
||||||
SetAuraBuiltin::MultiStatic(x) => AuraModes::MultiStatic(x.into()),
|
SetAuraBuiltin::MultiStatic(x) => AuraModes::MultiStatic(x.into()),
|
||||||
|
SetAuraBuiltin::MultiBreathe(x) => AuraModes::MultiBreathe(x.into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -234,6 +255,7 @@ impl From<&AuraModes> for u8 {
|
|||||||
AuraModes::Comet(_) => COMET,
|
AuraModes::Comet(_) => COMET,
|
||||||
AuraModes::Flash(_) => FLASH,
|
AuraModes::Flash(_) => FLASH,
|
||||||
AuraModes::MultiStatic(_) => MULTISTATIC,
|
AuraModes::MultiStatic(_) => MULTISTATIC,
|
||||||
|
AuraModes::MultiBreathe(_) => MULTIBREATHE,
|
||||||
AuraModes::PerKey(_) => PER_KEY,
|
AuraModes::PerKey(_) => PER_KEY,
|
||||||
_ => panic!("Invalid mode"),
|
_ => panic!("Invalid mode"),
|
||||||
}
|
}
|
||||||
@@ -256,6 +278,7 @@ impl From<&AuraModes> for &str {
|
|||||||
AuraModes::Comet(_) => "Comet",
|
AuraModes::Comet(_) => "Comet",
|
||||||
AuraModes::Flash(_) => "Flash",
|
AuraModes::Flash(_) => "Flash",
|
||||||
AuraModes::MultiStatic(_) => "4-Zone Static Colours",
|
AuraModes::MultiStatic(_) => "4-Zone Static Colours",
|
||||||
|
AuraModes::MultiBreathe(_) => "4-Zone Breathing Colours",
|
||||||
AuraModes::PerKey(_) => "RGB per-key",
|
AuraModes::PerKey(_) => "RGB per-key",
|
||||||
_ => panic!("Invalid mode"),
|
_ => panic!("Invalid mode"),
|
||||||
}
|
}
|
||||||
@@ -280,6 +303,7 @@ impl From<u8> for AuraModes {
|
|||||||
COMET => AuraModes::Comet(SingleColour::default()),
|
COMET => AuraModes::Comet(SingleColour::default()),
|
||||||
FLASH => AuraModes::Flash(SingleColour::default()),
|
FLASH => AuraModes::Flash(SingleColour::default()),
|
||||||
MULTISTATIC => AuraModes::MultiStatic(MultiColour::default()),
|
MULTISTATIC => AuraModes::MultiStatic(MultiColour::default()),
|
||||||
|
MULTIBREATHE => AuraModes::MultiBreathe(MultiColourSpeed::default()),
|
||||||
PER_KEY => AuraModes::PerKey(vec![]),
|
PER_KEY => AuraModes::PerKey(vec![]),
|
||||||
_ => panic!("Invalid mode byte"),
|
_ => panic!("Invalid mode byte"),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
use crate::error::AuraError;
|
use crate::{
|
||||||
|
aura_modes::{
|
||||||
|
MultiColour, MultiColourSpeed, SingleColour, SingleColourSpeed, SingleSpeed,
|
||||||
|
SingleSpeedDirection, TwoColourSpeed,
|
||||||
|
},
|
||||||
|
error::AuraError,
|
||||||
|
};
|
||||||
use gumdrop::Options;
|
use gumdrop::Options;
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
@@ -48,148 +54,6 @@ impl ToString for LedBrightness {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct Colour(pub u8, pub u8, pub u8);
|
|
||||||
impl Default for Colour {
|
|
||||||
fn default() -> Self {
|
|
||||||
Colour(255, 0, 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl FromStr for Colour {
|
|
||||||
type Err = AuraError;
|
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
||||||
if s.len() < 6 {
|
|
||||||
return Err(AuraError::ParseColour);
|
|
||||||
}
|
|
||||||
let r = u8::from_str_radix(&s[0..2], 16).or(Err(AuraError::ParseColour))?;
|
|
||||||
let g = u8::from_str_radix(&s[2..4], 16).or(Err(AuraError::ParseColour))?;
|
|
||||||
let b = u8::from_str_radix(&s[4..6], 16).or(Err(AuraError::ParseColour))?;
|
|
||||||
Ok(Colour(r, g, b))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub enum Speed {
|
|
||||||
Low = 0xe1,
|
|
||||||
Med = 0xeb,
|
|
||||||
High = 0xf5,
|
|
||||||
}
|
|
||||||
impl Default for Speed {
|
|
||||||
fn default() -> Self {
|
|
||||||
Speed::Med
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl FromStr for Speed {
|
|
||||||
type Err = AuraError;
|
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
||||||
let s = s.to_lowercase();
|
|
||||||
match s.as_str() {
|
|
||||||
"low" => Ok(Speed::Low),
|
|
||||||
"med" => Ok(Speed::Med),
|
|
||||||
"high" => Ok(Speed::High),
|
|
||||||
_ => Err(AuraError::ParseSpeed),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Used for Rainbow mode.
|
|
||||||
///
|
|
||||||
/// Enum corresponds to the required integer value
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub enum Direction {
|
|
||||||
Right,
|
|
||||||
Left,
|
|
||||||
Up,
|
|
||||||
Down,
|
|
||||||
}
|
|
||||||
impl Default for Direction {
|
|
||||||
fn default() -> Self {
|
|
||||||
Direction::Right
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl FromStr for Direction {
|
|
||||||
type Err = AuraError;
|
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
||||||
let s = s.to_lowercase();
|
|
||||||
match s.as_str() {
|
|
||||||
"right" => Ok(Direction::Right),
|
|
||||||
"up" => Ok(Direction::Up),
|
|
||||||
"down" => Ok(Direction::Down),
|
|
||||||
"left" => Ok(Direction::Left),
|
|
||||||
_ => Err(AuraError::ParseDirection),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Options, Deserialize, Serialize)]
|
|
||||||
pub struct TwoColourSpeed {
|
|
||||||
#[options(help = "print help message")]
|
|
||||||
help: bool,
|
|
||||||
#[options(no_long, meta = "HEX", help = "set the first RGB value e.g, ff00ff")]
|
|
||||||
pub colour: Colour,
|
|
||||||
#[options(no_long, meta = "HEX", help = "set the second RGB value e.g, ff00ff")]
|
|
||||||
pub colour2: Colour,
|
|
||||||
#[options(no_long, help = "set the speed: low, med, high")]
|
|
||||||
pub speed: Speed,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Options, Deserialize, Serialize)]
|
|
||||||
pub struct SingleSpeed {
|
|
||||||
#[options(help = "print help message")]
|
|
||||||
help: bool,
|
|
||||||
#[options(no_long, meta = "WORD", help = "set the speed: low, med, high")]
|
|
||||||
pub speed: Speed,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Options, Deserialize, Serialize)]
|
|
||||||
pub struct SingleColour {
|
|
||||||
#[options(help = "print help message")]
|
|
||||||
help: bool,
|
|
||||||
#[options(no_long, meta = "HEX", help = "set the RGB value e.g, ff00ff")]
|
|
||||||
pub colour: Colour,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Options, Deserialize, Serialize)]
|
|
||||||
pub struct MultiColour {
|
|
||||||
#[options(help = "print help message")]
|
|
||||||
help: bool,
|
|
||||||
#[options(meta = "HEX", help = "set the RGB value e.g, ff00ff")]
|
|
||||||
pub colour1: Colour,
|
|
||||||
#[options(meta = "HEX", help = "set the RGB value e.g, ff00ff")]
|
|
||||||
pub colour2: Colour,
|
|
||||||
#[options(meta = "HEX", help = "set the RGB value e.g, ff00ff")]
|
|
||||||
pub colour3: Colour,
|
|
||||||
#[options(meta = "HEX", help = "set the RGB value e.g, ff00ff")]
|
|
||||||
pub colour4: Colour,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Options, Deserialize, Serialize)]
|
|
||||||
pub struct SingleSpeedDirection {
|
|
||||||
#[options(help = "print help message")]
|
|
||||||
help: bool,
|
|
||||||
#[options(
|
|
||||||
no_long,
|
|
||||||
meta = "DIR",
|
|
||||||
help = "set the direction: up, down, left, right"
|
|
||||||
)]
|
|
||||||
pub direction: Direction,
|
|
||||||
#[options(no_long, help = "set the speed: low, med, high")]
|
|
||||||
pub speed: Speed,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Options, Deserialize, Serialize)]
|
|
||||||
pub struct SingleColourSpeed {
|
|
||||||
#[options(help = "print help message")]
|
|
||||||
help: bool,
|
|
||||||
#[options(no_long, meta = "HEX", help = "set the RGB value e.g, ff00ff")]
|
|
||||||
pub colour: Colour,
|
|
||||||
#[options(no_long, help = "set the speed: low, med, high")]
|
|
||||||
pub speed: Speed,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Byte value for setting the built-in mode.
|
/// Byte value for setting the built-in mode.
|
||||||
///
|
///
|
||||||
/// Enum corresponds to the required integer value
|
/// Enum corresponds to the required integer value
|
||||||
@@ -221,14 +85,13 @@ pub enum SetAuraBuiltin {
|
|||||||
Flash(SingleColour),
|
Flash(SingleColour),
|
||||||
#[options(help = "4-zone multi-colour")]
|
#[options(help = "4-zone multi-colour")]
|
||||||
MultiStatic(MultiColour),
|
MultiStatic(MultiColour),
|
||||||
|
#[options(help = "4-zone multi-colour breathing")]
|
||||||
|
MultiBreathe(MultiColourSpeed),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SetAuraBuiltin {
|
impl Default for SetAuraBuiltin {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
SetAuraBuiltin::Static(SingleColour {
|
SetAuraBuiltin::Static(SingleColour::default())
|
||||||
help: false,
|
|
||||||
colour: Colour(255, 0, 0),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +132,7 @@ pub struct AniMeLeds {
|
|||||||
no_long,
|
no_long,
|
||||||
required,
|
required,
|
||||||
short = "b",
|
short = "b",
|
||||||
meta = "BYTE",
|
meta = "",
|
||||||
help = "set all leds brightness value"
|
help = "set all leds brightness value"
|
||||||
)]
|
)]
|
||||||
led_brightness: u8,
|
led_brightness: u8,
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ impl From<&AuraModes> for [u8; LED_MSG_LEN] {
|
|||||||
let mut msg = [0u8; LED_MSG_LEN];
|
let mut msg = [0u8; LED_MSG_LEN];
|
||||||
msg[0] = 0x5d;
|
msg[0] = 0x5d;
|
||||||
msg[1] = 0xb3;
|
msg[1] = 0xb3;
|
||||||
|
msg[7] = 0xeb;
|
||||||
match mode {
|
match mode {
|
||||||
AuraModes::LedBrightness(n) => return aura_brightness_bytes(*n),
|
AuraModes::LedBrightness(n) => return aura_brightness_bytes(*n),
|
||||||
AuraModes::Static(_) => msg[3] = 0x00,
|
AuraModes::Static(_) => msg[3] = 0x00,
|
||||||
@@ -234,14 +235,15 @@ impl From<&AuraModes> for [[u8; LED_MSG_LEN]; 4] {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn from(mode: &AuraModes) -> Self {
|
fn from(mode: &AuraModes) -> Self {
|
||||||
let mut msg = [[0u8; LED_MSG_LEN]; 4];
|
let mut msg = [[0u8; LED_MSG_LEN]; 4];
|
||||||
for (i, row) in msg.iter_mut().enumerate() {
|
|
||||||
row[0] = 0x5d;
|
|
||||||
row[1] = 0xb3;
|
|
||||||
row[2] = i as u8 + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
match mode {
|
match mode {
|
||||||
AuraModes::MultiStatic(settings) => {
|
AuraModes::MultiStatic(settings) => {
|
||||||
|
for (i, row) in msg.iter_mut().enumerate() {
|
||||||
|
row[0] = 0x5d;
|
||||||
|
row[1] = 0xb3;
|
||||||
|
row[2] = i as u8 + 1; // zone
|
||||||
|
row[3] = 0x00; // mode
|
||||||
|
row[7] = 0xeb; // static needs speed?
|
||||||
|
}
|
||||||
msg[0][4] = settings.colour1.0;
|
msg[0][4] = settings.colour1.0;
|
||||||
msg[0][5] = settings.colour1.1;
|
msg[0][5] = settings.colour1.1;
|
||||||
msg[0][6] = settings.colour1.2;
|
msg[0][6] = settings.colour1.2;
|
||||||
@@ -255,6 +257,35 @@ impl From<&AuraModes> for [[u8; LED_MSG_LEN]; 4] {
|
|||||||
msg[3][5] = settings.colour4.1;
|
msg[3][5] = settings.colour4.1;
|
||||||
msg[3][6] = settings.colour4.2;
|
msg[3][6] = settings.colour4.2;
|
||||||
}
|
}
|
||||||
|
AuraModes::MultiBreathe(settings) => {
|
||||||
|
for (i, row) in msg.iter_mut().enumerate() {
|
||||||
|
row[0] = 0x5d;
|
||||||
|
row[1] = 0xb3;
|
||||||
|
row[2] = i as u8 + 1; // zone
|
||||||
|
row[3] = 0x01; // mode
|
||||||
|
}
|
||||||
|
let speed = match settings.speed {
|
||||||
|
aura_modes::Speed::Low => 0xfd,
|
||||||
|
aura_modes::Speed::Med => 0xfe,
|
||||||
|
aura_modes::Speed::High => 0xff,
|
||||||
|
};
|
||||||
|
msg[0][4] = settings.colour1.0;
|
||||||
|
msg[0][5] = settings.colour1.1;
|
||||||
|
msg[0][6] = settings.colour1.2;
|
||||||
|
msg[0][7] = speed; // fd, fe, ff
|
||||||
|
msg[1][4] = settings.colour2.0;
|
||||||
|
msg[1][5] = settings.colour2.1;
|
||||||
|
msg[1][6] = settings.colour2.2;
|
||||||
|
msg[1][7] = speed;
|
||||||
|
msg[2][4] = settings.colour3.0;
|
||||||
|
msg[2][5] = settings.colour3.1;
|
||||||
|
msg[2][6] = settings.colour3.2;
|
||||||
|
msg[2][7] = speed;
|
||||||
|
msg[3][4] = settings.colour4.0;
|
||||||
|
msg[3][5] = settings.colour4.1;
|
||||||
|
msg[3][6] = settings.colour4.2;
|
||||||
|
msg[3][7] = speed;
|
||||||
|
}
|
||||||
_ => panic!("Mode not convertable to 2D array: {}", <&str>::from(mode)),
|
_ => panic!("Mode not convertable to 2D array: {}", <&str>::from(mode)),
|
||||||
}
|
}
|
||||||
msg
|
msg
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ led_modes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 255]
|
|||||||
[[led_modes]]
|
[[led_modes]]
|
||||||
prod_family = "ROG Strix"
|
prod_family = "ROG Strix"
|
||||||
board_names = ["GX531", "G512LV", "G712LV"]
|
board_names = ["GX531", "G512LV", "G712LV"]
|
||||||
led_modes = [0, 1, 2, 3, 10, 13]
|
led_modes = [0, 1, 2, 3, 10, 13, 14]
|
||||||
|
|
||||||
[[led_modes]]
|
[[led_modes]]
|
||||||
prod_family = "ROG Strix"
|
prod_family = "ROG Strix"
|
||||||
@@ -36,7 +36,7 @@ led_modes = [0, 1, 2, 3, 10]
|
|||||||
[[led_modes]]
|
[[led_modes]]
|
||||||
prod_family = "Strix"
|
prod_family = "Strix"
|
||||||
board_names = ["G731GV", "G731GW", "G531GV"]
|
board_names = ["G731GV", "G731GW", "G531GV"]
|
||||||
led_modes = [0, 1, 2, 3, 13]
|
led_modes = [0, 1, 2, 3, 13, 14]
|
||||||
|
|
||||||
[[led_modes]]
|
[[led_modes]]
|
||||||
prod_family = "Strix"
|
prod_family = "Strix"
|
||||||
@@ -46,4 +46,9 @@ led_modes = [0, 1, 2, 3]
|
|||||||
[[led_modes]]
|
[[led_modes]]
|
||||||
prod_family = "Strix Scar"
|
prod_family = "Strix Scar"
|
||||||
board_names = ["G531", "G731"]
|
board_names = ["G531", "G731"]
|
||||||
led_modes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 255]
|
led_modes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 255]
|
||||||
|
|
||||||
|
[[led_modes]]
|
||||||
|
prod_family = "ROG"
|
||||||
|
board_names = ["GL553VE"]
|
||||||
|
led_modes = [0, 1, 2, 13, 14]
|
||||||
Reference in New Issue
Block a user