From f417032ed971830cbccf59ddbf530f7387af6709 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Tue, 6 Dec 2022 09:45:42 +1300 Subject: [PATCH] Fix: ROGCC: apply changes to correct fan curve profile The fan curve profile changes were applying to the currently *active* profile and not the GUI selected profile being changed. Fixed. Also clarify the buttons for fan curve apply. --- CHANGELOG.md | 1 + rog-control-center/src/widgets/fan_graph.rs | 25 +++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 230cf057..b6a2ade5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed - Adjust how fan graph in ROGCC works, deny incorrect graphs +- Fix to apply the fan curve change in ROGCC to the correct profile - Support for G713RS LED modes (Author: Peter Ivanov) - Support for G713RM LED modes (Author: maxbachmann) - Fix VivoBook detection diff --git a/rog-control-center/src/widgets/fan_graph.rs b/rog-control-center/src/widgets/fan_graph.rs index 7c062d83..d54b3f17 100644 --- a/rog-control-center/src/widgets/fan_graph.rs +++ b/rog-control-center/src/widgets/fan_graph.rs @@ -137,26 +137,43 @@ pub fn fan_graphs( }); let mut set = false; + let mut clear = false; let mut reset = false; ui.with_layout(egui::Layout::right_to_left(egui::Align::TOP), |ui| { - set = ui.add(egui::Button::new("Apply Fan-curve")).clicked(); - reset = ui.add(egui::Button::new("Reset Profile")).clicked(); + set = ui.add(egui::Button::new("Apply Profile")).clicked(); + clear = ui.add(egui::Button::new("Clear Profile Changes")).clicked(); + reset = ui.add(egui::Button::new("Factory Reset Profile")).clicked(); }); if set { dbus.proxies() .profile() - .set_fan_curve(profiles.current, data.clone()) + .set_fan_curve(curves.show_curve, data.clone()) .map_err(|err| { *do_error = Some(err.to_string()); }) .ok(); } + if clear { + if let Ok(curve) = dbus + .proxies() + .profile() + .fan_curve_data(curves.show_curve) + .map_err(|err| { + *do_error = Some(err.to_string()); + }) + { + if let Some(value) = curves.curves.get_mut(&curves.show_curve) { + *value = curve; + } + } + } + if reset { dbus.proxies() .profile() - .reset_profile_curves(profiles.current) + .reset_profile_curves(curves.show_curve) .map_err(|err| { *do_error = Some(err.to_string()); })