diff --git a/rog-core/src/laptops.rs b/rog-core/src/laptops.rs index 99ad8019..81678ee1 100644 --- a/rog-core/src/laptops.rs +++ b/rog-core/src/laptops.rs @@ -56,6 +56,15 @@ fn choose_1866_device(prod: u16) -> LaptopBase { //backlight: Backlight::new("intel_backlight").unwrap(), }; match &board_name.as_str()[..5] { + "GA401" => { + // Has no RGB control + info!("Found GA401 series"); + laptop.support_animatrix = true; + } + "GA502" => { + // Has no RGB control + info!("Found GA502 series"); + } "GX502" => { info!("Found GX502 series"); laptop.supported_modes = vec![ @@ -82,15 +91,6 @@ fn choose_1866_device(prod: u16) -> LaptopBase { BuiltInModeByte::Rainbow, ]; } - "GA502" => { - // Has no RGB control - info!("Found GA502 series"); - } - "GA401" => { - // Has no RGB control - info!("Found GA401 series"); - laptop.support_animatrix = true; - } _ => panic!("Unsupported laptop: {}, please request support at\nhttps://github.com/flukejones/rog-core", board_name), } laptop diff --git a/rog-core/src/led_control.rs b/rog-core/src/led_control.rs index 1b6dee65..6781bb17 100644 --- a/rog-core/src/led_control.rs +++ b/rog-core/src/led_control.rs @@ -221,18 +221,23 @@ where #[inline] async fn reload_last_builtin(&self, config: &Config) -> Result<(), AuraError> { - let mode_curr = config.current_mode[3]; - let mode = config - .builtin_modes - .get_field_from(mode_curr) - .ok_or(AuraError::NotSupported)? - .to_owned(); - self.write_bytes(&mode).await?; - // Reload brightness too + // set current mode (if any) + if self.supported_modes.len() > 1 { + let mode_curr = config.current_mode[3]; + let mode = config + .builtin_modes + .get_field_from(mode_curr) + .ok_or(AuraError::NotSupported)? + .to_owned(); + self.write_bytes(&mode).await?; + info!("Reloaded last used mode"); + } + + // Reload brightness let bright = config.brightness; let bytes = aura_brightness_bytes(bright); self.write_bytes(&bytes).await?; - info!("Reloaded last used mode and brightness"); + info!("Reloaded last used brightness"); Ok(()) }