mirror of
https://github.com/RGBCube/superfreq
synced 2025-07-27 17:07:44 +00:00
engine: reduce sysfs writes
This commit is contained in:
parent
aaa46e9223
commit
9db1a028bf
1 changed files with 33 additions and 14 deletions
|
@ -420,22 +420,41 @@ fn manage_auto_turbo(
|
||||||
hysteresis.update_state(enable_turbo);
|
hysteresis.update_state(enable_turbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the turbo setting
|
// Only apply the setting if the state has changed
|
||||||
let turbo_setting = if enable_turbo {
|
let changed = previous_turbo_enabled != enable_turbo;
|
||||||
TurboSetting::Always
|
if changed {
|
||||||
} else {
|
let turbo_setting = if enable_turbo {
|
||||||
TurboSetting::Never
|
TurboSetting::Always
|
||||||
};
|
} else {
|
||||||
|
TurboSetting::Never
|
||||||
|
};
|
||||||
|
|
||||||
match cpu::set_turbo(turbo_setting) {
|
info!(
|
||||||
Ok(()) => {
|
"Auto Turbo: Applying turbo change from {} to {}",
|
||||||
debug!(
|
if previous_turbo_enabled {
|
||||||
"Auto Turbo: Successfully set turbo to {}",
|
"enabled"
|
||||||
if enable_turbo { "enabled" } else { "disabled" }
|
} else {
|
||||||
);
|
"disabled"
|
||||||
Ok(())
|
},
|
||||||
|
if enable_turbo { "enabled" } else { "disabled" }
|
||||||
|
);
|
||||||
|
|
||||||
|
match cpu::set_turbo(turbo_setting) {
|
||||||
|
Ok(()) => {
|
||||||
|
debug!(
|
||||||
|
"Auto Turbo: Successfully set turbo to {}",
|
||||||
|
if enable_turbo { "enabled" } else { "disabled" }
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
Err(e) => Err(EngineError::ControlError(e)),
|
||||||
}
|
}
|
||||||
Err(e) => Err(EngineError::ControlError(e)),
|
} else {
|
||||||
|
debug!(
|
||||||
|
"Auto Turbo: Maintaining turbo state ({}) - no change needed",
|
||||||
|
if enable_turbo { "enabled" } else { "disabled" }
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue