fix: apply panel overdrive and other properties on asusd startup

This commit is contained in:
Denis Benato
2025-10-05 23:13:41 +02:00
parent 3c023be57d
commit 1014f97b6f

View File

@@ -110,6 +110,9 @@ impl AsusArmouryAttribute {
impl crate::Reloadable for AsusArmouryAttribute { impl crate::Reloadable for AsusArmouryAttribute {
async fn reload(&mut self) -> Result<(), RogError> { async fn reload(&mut self) -> Result<(), RogError> {
info!("Reloading {}", self.attr.name()); info!("Reloading {}", self.attr.name());
let name: FirmwareAttribute = self.attr.name().into();
if name.is_ppt() {
let profile: PlatformProfile = self.platform.get_platform_profile()?.into(); let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
let power_plugged = self let power_plugged = self
.power .power
@@ -138,6 +141,19 @@ impl crate::Reloadable for AsusArmouryAttribute {
} }
} }
} }
} else {
// Handle non-PPT attributes (boolean and other settings)
if let Some(saved_value) = self.config.lock().await.armoury_settings.get(&name) {
self.attr
.set_current_value(&AttrValue::Integer(*saved_value))
.map_err(|e| {
error!("Could not set {} value: {e:?}", self.attr.name());
self.attr.base_path_exists();
e
})?;
info!("Restored armoury setting {} to {:?}", self.attr.name(), saved_value);
}
}
Ok(()) Ok(())
} }
@@ -420,6 +436,20 @@ pub async fn set_config_or_default(
// config.write(); // config.write();
} }
} }
} else {
// Handle non-PPT attributes (boolean and other settings)
if let Some(saved_value) = config.armoury_settings.get(&name) {
attr.set_current_value(&AttrValue::Integer(*saved_value))
.map_err(|e| {
error!("Failed to set {}: {e}", <&str>::from(name));
})
.ok();
info!(
"Restored armoury setting for {} = {:?}",
<&str>::from(name),
saved_value
);
}
} }
} }
} }