Update deps

This commit is contained in:
Luke D. Jones
2023-08-14 13:20:40 +12:00
parent 93edd1b632
commit e42fd10404
9 changed files with 141 additions and 132 deletions

View File

@@ -21,6 +21,12 @@ pub enum AuraPowerConfig {
AuraDevRog2(AuraPower),
}
impl Default for AuraPowerConfig {
fn default() -> Self {
Self::AuraDevRog2(AuraPower::default())
}
}
impl AuraPowerConfig {
/// Invalid for TUF laptops
pub fn to_bytes(control: &Self) -> [u8; 4] {
@@ -104,7 +110,7 @@ impl From<&AuraPowerConfig> for AuraPowerDev {
}
}
#[derive(Deserialize, Serialize, Debug, Clone)]
#[derive(Deserialize, Serialize, Debug, Clone, Default)]
// #[serde(default)]
pub struct AuraConfig {
pub brightness: LedBrightness,
@@ -125,7 +131,7 @@ impl StdConfig for AuraConfig {
break;
}
}
Self::create_default(prod_id, &LaptopLedData::get_data())
Self::from_default_support(prod_id, &LaptopLedData::get_data())
}
fn config_dir() -> std::path::PathBuf {
@@ -140,7 +146,7 @@ impl StdConfig for AuraConfig {
impl StdConfigLoad for AuraConfig {}
impl AuraConfig {
pub fn create_default(prod_id: AuraDevice, support_data: &LaptopLedData) -> Self {
pub fn from_default_support(prod_id: AuraDevice, support_data: &LaptopLedData) -> Self {
// create a default config here
let enabled = if prod_id == AuraDevice::X19b6 {
AuraPowerConfig::AuraDevRog2(AuraPower::new_all_on())
@@ -247,7 +253,8 @@ mod tests {
#[test]
fn set_multizone_4key_config() {
let mut config = AuraConfig::create_default(AuraDevice::X19b6, &LaptopLedData::default());
let mut config =
AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default());
let effect = AuraEffect {
colour1: Colour {
@@ -337,7 +344,8 @@ mod tests {
#[test]
fn set_multizone_multimode_config() {
let mut config = AuraConfig::create_default(AuraDevice::X19b6, &LaptopLedData::default());
let mut config =
AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default());
let effect = AuraEffect {
zone: AuraZone::Key1,

View File

@@ -112,7 +112,7 @@ impl CtrlKbdLed {
LEDNode::None
};
let mut config_init = AuraConfig::create_default(led_prod, &supported_modes);
let mut config_init = AuraConfig::default();
let mut config_loaded = config_init.clone().load();
for mode in &mut config_init.builtins {
@@ -414,7 +414,7 @@ mod tests {
// #[ignore = "Must be manually run due to detection stage"]
fn check_set_mode_errors() {
// Checking to ensure set_mode errors when unsupported modes are tried
let config = AuraConfig::create_default(AuraDevice::X19b6, &LaptopLedData::default());
let config = AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default());
let supported_modes = LaptopLedData {
board_name: String::new(),
layout_name: "ga401".to_owned(),
@@ -482,7 +482,7 @@ mod tests {
#[test]
fn create_multizone_if_no_config() {
// Checking to ensure set_mode errors when unsupported modes are tried
let config = AuraConfig::create_default(AuraDevice::X19b6, &LaptopLedData::default());
let config = AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default());
let supported_modes = LaptopLedData {
board_name: String::new(),
layout_name: "ga401".to_owned(),
@@ -521,7 +521,7 @@ mod tests {
#[test]
fn next_mode_create_multizone_if_no_config() {
// Checking to ensure set_mode errors when unsupported modes are tried
let config = AuraConfig::create_default(AuraDevice::X19b6, &LaptopLedData::default());
let config = AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default());
let supported_modes = LaptopLedData {
board_name: String::new(),
layout_name: "ga401".to_owned(),