Chore: complete the switch back to stable

This commit is contained in:
Denis Benato
2025-10-23 14:50:40 +02:00
parent 180566e5f1
commit 132a2f3665
8 changed files with 646 additions and 668 deletions

939
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -21,11 +21,14 @@ fn main() {
let brightness = args[2].parse::<f32>().unwrap(); let brightness = args[2].parse::<f32>().unwrap();
let anime_type = get_anime_type(); let anime_type = get_anime_type();
let mut seq = Sequences::new(anime_type); let mut seq = Sequences::new(anime_type);
seq.insert(0, &ActionLoader::AsusAnimation { seq.insert(
0,
&ActionLoader::AsusAnimation {
file: path.into(), file: path.into(),
time: rog_anime::AnimTime::Infinite, time: rog_anime::AnimTime::Infinite,
brightness, brightness,
}) },
)
.unwrap(); .unwrap();
loop { loop {

View File

@@ -1173,7 +1173,7 @@ fn handle_armoury_command(cmd: &ArmouryCommand) -> Result<(), Box<dyn std::error
{ {
if cmd.free.is_empty() || !cmd.free.len().is_multiple_of(2) || cmd.help { if cmd.free.is_empty() || !cmd.free.len().is_multiple_of(2) || cmd.help {
const USAGE: &str = "Usage: asusctl platform panel_overdrive 1 nv_dynamic_boost 5"; const USAGE: &str = "Usage: asusctl platform panel_overdrive 1 nv_dynamic_boost 5";
if !cmd.free.len().is_multiple_of(2) { if !(cmd.free.len() % 2 == 0) {
println!( println!(
"Incorrect number of args, each attribute label must be paired with a setting:" "Incorrect number of args, each attribute label must be paired with a setting:"
); );

View File

@@ -309,26 +309,38 @@ mod tests {
let res = config.multizone.unwrap(); let res = config.multizone.unwrap();
let sta = res.get(&AuraModeNum::Static).unwrap(); let sta = res.get(&AuraModeNum::Static).unwrap();
assert_eq!(sta.len(), 4); assert_eq!(sta.len(), 4);
assert_eq!(sta[0].colour1, Colour { assert_eq!(
sta[0].colour1,
Colour {
r: 0xff, r: 0xff,
g: 0x00, g: 0x00,
b: 0xff b: 0xff
}); }
assert_eq!(sta[1].colour1, Colour { );
assert_eq!(
sta[1].colour1,
Colour {
r: 0x00, r: 0x00,
g: 0xff, g: 0xff,
b: 0xff b: 0xff
}); }
assert_eq!(sta[2].colour1, Colour { );
assert_eq!(
sta[2].colour1,
Colour {
r: 0xff, r: 0xff,
g: 0xff, g: 0xff,
b: 0x00 b: 0x00
}); }
assert_eq!(sta[3].colour1, Colour { );
assert_eq!(
sta[3].colour1,
Colour {
r: 0x00, r: 0x00,
g: 0xff, g: 0xff,
b: 0x00 b: 0x00
}); }
);
} }
#[test] #[test]
@@ -388,22 +400,28 @@ mod tests {
assert_eq!(config.brightness, LedBrightness::Med); assert_eq!(config.brightness, LedBrightness::Med);
assert_eq!(config.builtins.len(), 5); assert_eq!(config.builtins.len(), 5);
assert_eq!(config.builtins.first_entry().unwrap().get(), &AuraEffect { assert_eq!(
config.builtins.first_entry().unwrap().get(),
&AuraEffect {
mode: AuraModeNum::Static, mode: AuraModeNum::Static,
zone: AuraZone::None, zone: AuraZone::None,
colour1: Colour { r: 166, g: 0, b: 0 }, colour1: Colour { r: 166, g: 0, b: 0 },
colour2: Colour { r: 0, g: 0, b: 0 }, colour2: Colour { r: 0, g: 0, b: 0 },
speed: Speed::Med, speed: Speed::Med,
direction: Direction::Right direction: Direction::Right
}); }
);
assert_eq!(config.enabled.states.len(), 1); assert_eq!(config.enabled.states.len(), 1);
assert_eq!(config.enabled.states[0], AuraPowerState { assert_eq!(
config.enabled.states[0],
AuraPowerState {
zone: PowerZones::KeyboardAndLightbar, zone: PowerZones::KeyboardAndLightbar,
boot: true, boot: true,
awake: true, awake: true,
sleep: true, sleep: true,
shutdown: true shutdown: true
}); }
);
} }
#[test] #[test]
@@ -414,21 +432,27 @@ mod tests {
assert_eq!(config.brightness, LedBrightness::Med); assert_eq!(config.brightness, LedBrightness::Med);
assert_eq!(config.builtins.len(), 12); assert_eq!(config.builtins.len(), 12);
assert_eq!(config.builtins.first_entry().unwrap().get(), &AuraEffect { assert_eq!(
config.builtins.first_entry().unwrap().get(),
&AuraEffect {
mode: AuraModeNum::Static, mode: AuraModeNum::Static,
zone: AuraZone::None, zone: AuraZone::None,
colour1: Colour { r: 166, g: 0, b: 0 }, colour1: Colour { r: 166, g: 0, b: 0 },
colour2: Colour { r: 0, g: 0, b: 0 }, colour2: Colour { r: 0, g: 0, b: 0 },
speed: Speed::Med, speed: Speed::Med,
direction: Direction::Right direction: Direction::Right
}); }
);
assert_eq!(config.enabled.states.len(), 4); assert_eq!(config.enabled.states.len(), 4);
assert_eq!(config.enabled.states[0], AuraPowerState { assert_eq!(
config.enabled.states[0],
AuraPowerState {
zone: PowerZones::Keyboard, zone: PowerZones::Keyboard,
boot: true, boot: true,
awake: true, awake: true,
sleep: true, sleep: true,
shutdown: true shutdown: true
}); }
);
} }
} }

View File

@@ -207,12 +207,14 @@ mod tests {
fn single_key_next_state_then_create() { fn single_key_next_state_then_create() {
let layout = KeyLayout::default_layout(); let layout = KeyLayout::default_layout();
let mut seq = AdvancedEffects::new(false); let mut seq = AdvancedEffects::new(false);
seq.effects seq.effects.push(Effect::Static(Static::new(
.push(Effect::Static(Static::new(LedCode::F, Colour { LedCode::F,
Colour {
r: 255, r: 255,
g: 127, g: 127,
b: 0, b: 0,
}))); },
)));
seq.next_state(&layout); seq.next_state(&layout);
let packets = seq.create_packets(); let packets = seq.create_packets();

View File

@@ -335,7 +335,10 @@ impl KeyLayout {
KeyShape::new_led(1.0, 1.0, 0.1, 0.1, 0.1, 0.1), KeyShape::new_led(1.0, 1.0, 0.1, 0.1, 0.1, 0.1),
)]), )]),
key_rows: vec![ key_rows: vec![
KeyRow::new(0.1, 0.1, vec![ KeyRow::new(
0.1,
0.1,
vec![
(LedCode::Esc, "regular".to_owned()), (LedCode::Esc, "regular".to_owned()),
(LedCode::F1, "regular".to_owned()), (LedCode::F1, "regular".to_owned()),
(LedCode::F2, "regular".to_owned()), (LedCode::F2, "regular".to_owned()),
@@ -350,8 +353,12 @@ impl KeyLayout {
(LedCode::F10, "regular".to_owned()), (LedCode::F10, "regular".to_owned()),
(LedCode::F11, "regular".to_owned()), (LedCode::F11, "regular".to_owned()),
(LedCode::F12, "regular".to_owned()), (LedCode::F12, "regular".to_owned()),
]), ],
KeyRow::new(0.1, 0.1, vec![ ),
KeyRow::new(
0.1,
0.1,
vec![
(LedCode::Tilde, "regular".to_owned()), (LedCode::Tilde, "regular".to_owned()),
(LedCode::N1, "regular".to_owned()), (LedCode::N1, "regular".to_owned()),
(LedCode::N2, "regular".to_owned()), (LedCode::N2, "regular".to_owned()),
@@ -366,8 +373,12 @@ impl KeyLayout {
(LedCode::Hyphen, "regular".to_owned()), (LedCode::Hyphen, "regular".to_owned()),
(LedCode::Equals, "regular".to_owned()), (LedCode::Equals, "regular".to_owned()),
(LedCode::Backspace, "regular".to_owned()), (LedCode::Backspace, "regular".to_owned()),
]), ],
KeyRow::new(0.1, 0.1, vec![ ),
KeyRow::new(
0.1,
0.1,
vec![
(LedCode::Tab, "regular".to_owned()), (LedCode::Tab, "regular".to_owned()),
(LedCode::Q, "regular".to_owned()), (LedCode::Q, "regular".to_owned()),
(LedCode::W, "regular".to_owned()), (LedCode::W, "regular".to_owned()),
@@ -382,8 +393,12 @@ impl KeyLayout {
(LedCode::LBracket, "regular".to_owned()), (LedCode::LBracket, "regular".to_owned()),
(LedCode::RBracket, "regular".to_owned()), (LedCode::RBracket, "regular".to_owned()),
(LedCode::BackSlash, "regular".to_owned()), (LedCode::BackSlash, "regular".to_owned()),
]), ],
KeyRow::new(0.1, 0.1, vec![ ),
KeyRow::new(
0.1,
0.1,
vec![
(LedCode::Caps, "regular".to_owned()), (LedCode::Caps, "regular".to_owned()),
(LedCode::A, "regular".to_owned()), (LedCode::A, "regular".to_owned()),
(LedCode::S, "regular".to_owned()), (LedCode::S, "regular".to_owned()),
@@ -397,8 +412,12 @@ impl KeyLayout {
(LedCode::SemiColon, "regular".to_owned()), (LedCode::SemiColon, "regular".to_owned()),
(LedCode::Quote, "regular".to_owned()), (LedCode::Quote, "regular".to_owned()),
(LedCode::Return, "regular".to_owned()), (LedCode::Return, "regular".to_owned()),
]), ],
KeyRow::new(0.1, 0.1, vec![ ),
KeyRow::new(
0.1,
0.1,
vec![
(LedCode::LShift, "regular".to_owned()), (LedCode::LShift, "regular".to_owned()),
(LedCode::Z, "regular".to_owned()), (LedCode::Z, "regular".to_owned()),
(LedCode::X, "regular".to_owned()), (LedCode::X, "regular".to_owned()),
@@ -411,8 +430,12 @@ impl KeyLayout {
(LedCode::Period, "regular".to_owned()), (LedCode::Period, "regular".to_owned()),
(LedCode::FwdSlash, "regular".to_owned()), (LedCode::FwdSlash, "regular".to_owned()),
(LedCode::Rshift, "regular".to_owned()), (LedCode::Rshift, "regular".to_owned()),
]), ],
KeyRow::new(0.1, 0.1, vec![ ),
KeyRow::new(
0.1,
0.1,
vec![
(LedCode::LCtrl, "regular".to_owned()), (LedCode::LCtrl, "regular".to_owned()),
(LedCode::LFn, "regular".to_owned()), (LedCode::LFn, "regular".to_owned()),
(LedCode::Meta, "regular".to_owned()), (LedCode::Meta, "regular".to_owned()),
@@ -421,7 +444,8 @@ impl KeyLayout {
(LedCode::RAlt, "regular".to_owned()), (LedCode::RAlt, "regular".to_owned()),
(LedCode::PrtSc, "regular".to_owned()), (LedCode::PrtSc, "regular".to_owned()),
(LedCode::RCtrl, "regular".to_owned()), (LedCode::RCtrl, "regular".to_owned()),
]), ],
),
], ],
} }
} }

View File

@@ -267,18 +267,24 @@ mod tests {
fn check_cpu() { fn check_cpu() {
let cpu = CPUControl::new().unwrap(); let cpu = CPUControl::new().unwrap();
assert_eq!(cpu.get_governor().unwrap(), CPUGovernor::Powersave); assert_eq!(cpu.get_governor().unwrap(), CPUGovernor::Powersave);
assert_eq!(cpu.get_available_governors().unwrap(), vec![ assert_eq!(
cpu.get_available_governors().unwrap(),
vec![
CPUGovernor::Performance, CPUGovernor::Performance,
CPUGovernor::Powersave CPUGovernor::Powersave
]); ]
);
assert_eq!(cpu.get_epp().unwrap(), CPUEPP::BalancePower); assert_eq!(cpu.get_epp().unwrap(), CPUEPP::BalancePower);
assert_eq!(cpu.get_available_epp().unwrap(), vec![ assert_eq!(
cpu.get_available_epp().unwrap(),
vec![
CPUEPP::Default, CPUEPP::Default,
CPUEPP::Performance, CPUEPP::Performance,
CPUEPP::BalancePerformance, CPUEPP::BalancePerformance,
CPUEPP::BalancePower, CPUEPP::BalancePower,
CPUEPP::Power, CPUEPP::Power,
]); ]
);
} }
} }

View File

@@ -158,7 +158,7 @@ fn main() -> Result<(), Box<dyn Error>> {
canvas.set_draw_color(Color::RGB(*b, *b, *b)); canvas.set_draw_color(Color::RGB(*b, *b, *b));
let x: i32 = w + x_count as i32 * w let x: i32 = w + x_count as i32 * w
- if !(y_count + y_offset as usize).is_multiple_of(2) { - if !((y_count + y_offset as usize) % 2 == 0) {
0 0
} else { } else {
w / 2 w / 2