Add help and reset to UI for ppt values

This commit is contained in:
Luke D. Jones
2025-01-19 15:34:58 +13:00
parent 2d6d669c22
commit f11aea02a8
7 changed files with 333 additions and 100 deletions

View File

@@ -181,6 +181,27 @@ impl AsusArmouryAttribute {
async fn restore_default(&self) -> fdo::Result<()> {
self.attr.restore_default()?;
if self.name().is_ppt() {
let profile: ThrottlePolicy =
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
let power_plugged = self
.power
.get_online()
.map_err(|e| {
error!("Could not get power status: {e:?}");
e
})
.unwrap_or_default();
let mut config = self.config.lock().await;
let tunings = config.select_tunings(power_plugged == 1, profile);
if let Some(tune) = tunings.get_mut(&self.name()) {
if let AttrValue::Integer(i) = self.attr.default_value() {
*tune = *i;
}
}
config.write();
}
Ok(())
}