X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=src%2Fmachine.rs;h=1d7bb2e0a08184f656066b659ce453141d760c4f;hb=HEAD;hp=ac60e7208f9ef5f083acd66b1942fc8d82ec2c00;hpb=0c50e4418792d9f5b78ef1c96d66514058beec26;p=temp2RGB.git diff --git a/src/machine.rs b/src/machine.rs index ac60e72..1d7bb2e 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -3,7 +3,7 @@ use nvapi::sys::i2c; use crate::{ /*a770,*/ asus_aura_usb, corsair_lighting_pro, corsair_vengeance, cpu_temperature, - intel_arc, rgb, + intel_arc, lian_li_sl_infinity, rgb, }; const RGB_FUSION2_GPU_REG_COLOR: u8 = 0x40; @@ -12,7 +12,12 @@ const RGB_FUSION2_GPU_REG_MODE: u8 = 0x88; const GIGABYTE_RTX3080TI_VISION_OC_ADDR: u8 = 0x63; pub trait Machine { - fn set_color(&mut self, color: &rgb::RGB); + fn set_color(&mut self, color: &rgb::RGB) { + self.set_color_1(&color); + self.set_color_2(&color); + } + fn set_color_1(&mut self, color: &rgb::RGB); + fn set_color_2(&mut self, color: &rgb::RGB); fn get_gpu_tmp(&self) -> f32; fn get_cpu_tmp(&self) -> f32; } @@ -42,16 +47,15 @@ impl MachineJiji { } impl Machine for MachineJiji { - fn set_color(&mut self, color: &rgb::RGB) { + fn set_color_1(&mut self, color: &rgb::RGB) { for controller in &self.ram { controller.set_color(&color); } - self.b650e_device.set_color(&color); - // if let Err(error) = self.a770.set_color(color.red, color.green, color.blue) { - // error!("Unable to set color: {:?}", error); - // } + self.b650e_device.set_color(&color).unwrap(); } + fn set_color_2(&mut self, color: &rgb::RGB) {} // No color 2. + fn get_gpu_tmp(&self) -> f32 { // unsafe { intel_arc::GetTemperature(self.gpu_devices, 0) as f32 } self.gpus[0].thermal_settings(None).unwrap()[0] @@ -75,6 +79,7 @@ impl Machine for MachineJiji { pub struct MachineLyssMetal { crosshair_device: asus_aura_usb::Device, corsair_lignting_pro: corsair_lighting_pro::Device, + lian_li_sl_infinity: lian_li_sl_infinity::Device, gpus: Vec, } @@ -97,6 +102,7 @@ impl MachineLyssMetal { blue: 40, }, ), + lian_li_sl_infinity: lian_li_sl_infinity::Device::new(&api), gpus: nvapi::PhysicalGpu::enumerate()?, }; @@ -158,12 +164,16 @@ impl MachineLyssMetal { } impl Machine for MachineLyssMetal { - fn set_color(&mut self, color: &rgb::RGB) { - self.crosshair_device.set_color(&color); + fn set_color_1(&mut self, color: &rgb::RGB) { + self.crosshair_device.set_color(&color).unwrap(); self.corsair_lignting_pro.set_color(&color); // self.set_color_3080ti(&color); // TODO. } + fn set_color_2(&mut self, color: &rgb::RGB) { + self.lian_li_sl_infinity.set_color(&color); + } + fn get_gpu_tmp(&self) -> f32 { self.gpus[0].thermal_settings(None).unwrap()[0] .current_temperature