X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=src%2Ftests.rs;h=b49081eb987fd3998f431ee8c425c49dd8f69233;hb=HEAD;hp=09c75e4ffd5538bfd1d61b899a36f8b96def2341;hpb=9789f56d04a0a45fdb0495ca4fab6b01ba3d4f3e;p=temp2RGB.git diff --git a/src/tests.rs b/src/tests.rs index 09c75e4..b49081e 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -3,8 +3,8 @@ use std::collections::HashMap; use wmi::{COMLibrary, Variant, WMIConnection}; use crate::{ - a770, asus_aura_usb, corsair_lighting_pro, corsair_vengeance, cpu_temperature, machine, - rgb::RGB, winring0, wrapper_winring0, + a770, asus_aura_usb, corsair_lighting_pro, corsair_vengeance, cpu_temperature, + lian_li_sl_infinity, machine, rgb::RGB, winring0, wrapper_winring0, }; pub fn tests() { @@ -12,15 +12,17 @@ pub fn tests() { winring0::init(); - test_asus_aura_usb(asus_aura_usb::Motherboard::AsusCrosshairVIIIHero); + // test_asus_aura_usb(asus_aura_usb::Motherboard::Asus650e); // test_corsair_lighting_pro(); + test_lianli_sl_infinity(); // list_usb_devices(); // test_roccat(); // test_wmi(); // test_corsair(); // test_a770(); + // test_3080ti(); // test_read_temperature_cpu(); - // test_read_temperature_a770() + // test_read_temperature_a770(); // test_read_temperature_3080(); winring0::deinit(); @@ -85,11 +87,11 @@ fn list_usb_devices() { fn test_asus_aura_usb(motherboard: asus_aura_usb::Motherboard) { let api = hidapi::HidApi::new().unwrap(); - let device = asus_aura_usb::Device::new(&api, motherboard); + let device = asus_aura_usb::Device::new(&api, motherboard).unwrap(); - println!("Firmware: {}", device.get_firmware_string()); + println!("Firmware: {}", device.get_firmware_string().unwrap()); - let configuration = device.get_configuration_table(); + let configuration = device.get_configuration_table().unwrap(); println!("Configuration:"); for i in 0..60 { print!("{:02X} ", configuration[i]); @@ -101,13 +103,15 @@ fn test_asus_aura_usb(motherboard: asus_aura_usb::Motherboard) { println!("Number of leds: {}", configuration[0x1B]); println!("Number of RGB headers: {}", configuration[0x1D]); - device.set_color(&RGB { - red: 0, - green: 0, - blue: 255, - }); + device + .set_color(&RGB { + red: 0, + green: 0, + blue: 255, + }) + .unwrap(); - device.save_current_color(); + device.save_current_color().unwrap(); } fn test_corsair_lighting_pro() { @@ -133,6 +137,17 @@ fn test_corsair_lighting_pro() { } } +fn test_lianli_sl_infinity() { + let api = hidapi::HidApi::new().unwrap(); + let device = lian_li_sl_infinity::Device::new(&api); + + device.set_color(&RGB { + red: 0, + green: 0, + blue: 255, + }); +} + fn test_corsair() { let corsair_controllers = [ corsair_vengeance::Controller::new(0x19), @@ -150,8 +165,18 @@ fn test_corsair() { fn test_a770() { // a770::set_rgb(255, 0, 0); - let mut a770 = a770::A770::new(); - a770.set_color(255, 0, 0); + let mut a770 = a770::A770::new().unwrap(); + a770.set_color(255, 0, 0).unwrap(); +} + +fn test_3080ti() { + let machine: &mut dyn machine::Machine = &mut machine::MachineLyssMetal::new().unwrap(); + + machine.set_color(&RGB { + red: 255, + green: 0, + blue: 0, + }); } const F17H_M01H_THM_TCON_CUR_TMP: u32 = 0x00059800; @@ -163,7 +188,7 @@ fn test_read_temperature_cpu() { } fn test_read_temperature_a770() { - let jiji: &dyn machine::Machine = &machine::MachineJiji::new(); + let jiji: &dyn machine::Machine = &machine::MachineJiji::new().unwrap(); println!("temp gpu: {}", jiji.get_gpu_tmp()); }