Fix: asusd should reload defualt fan-curves if the config file fails

Closes #385
This commit is contained in:
Luke D. Jones
2023-08-01 09:30:54 +12:00
parent 42b92f3b87
commit 2cce83d164
3 changed files with 12 additions and 5 deletions

View File

@@ -48,13 +48,13 @@ impl StdConfig for FanCurveConfig {
Self::default()
}
fn config_dir() -> std::path::PathBuf {
PathBuf::from(CONFIG_PATH_BASE)
}
fn file_name(&self) -> String {
CONFIG_FAN_FILE.to_owned()
}
fn config_dir() -> std::path::PathBuf {
PathBuf::from(CONFIG_PATH_BASE)
}
}
impl StdConfigLoad for FanCurveConfig {}

View File

@@ -87,7 +87,11 @@ impl CtrlPlatformProfile {
info!("{MOD_NAME}: Device has fan curves available");
let fan_config = FanCurveConfig::new();
// Only do defaults if the config doesn't already exist
if !fan_config.file_path().exists() {
if !fan_config.file_path().exists()
|| fan_config.balanced.is_empty()
|| fan_config.performance.is_empty()
|| fan_config.quiet.is_empty()
{
info!("{MOD_NAME}: Fetching default fan curves");
controller.fan_curves = Some(FanCurves {
config_file: fan_config,