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,13 +420,25 @@ fn manage_auto_turbo(
|
|||
hysteresis.update_state(enable_turbo);
|
||||
}
|
||||
|
||||
// Apply the turbo setting
|
||||
// Only apply the setting if the state has changed
|
||||
let changed = previous_turbo_enabled != enable_turbo;
|
||||
if changed {
|
||||
let turbo_setting = if enable_turbo {
|
||||
TurboSetting::Always
|
||||
} else {
|
||||
TurboSetting::Never
|
||||
};
|
||||
|
||||
info!(
|
||||
"Auto Turbo: Applying turbo change from {} to {}",
|
||||
if previous_turbo_enabled {
|
||||
"enabled"
|
||||
} else {
|
||||
"disabled"
|
||||
},
|
||||
if enable_turbo { "enabled" } else { "disabled" }
|
||||
);
|
||||
|
||||
match cpu::set_turbo(turbo_setting) {
|
||||
Ok(()) => {
|
||||
debug!(
|
||||
|
@ -437,6 +449,13 @@ fn manage_auto_turbo(
|
|||
}
|
||||
Err(e) => Err(EngineError::ControlError(e)),
|
||||
}
|
||||
} else {
|
||||
debug!(
|
||||
"Auto Turbo: Maintaining turbo state ({}) - no change needed",
|
||||
if enable_turbo { "enabled" } else { "disabled" }
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_turbo_auto_settings(settings: &TurboAutoSettings) -> Result<(), EngineError> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue