Rebase to flake parts #2
This commit is contained in:
@@ -0,0 +1 @@
|
||||
_untracked/
|
||||
@@ -49,7 +49,7 @@
|
||||
# Upstream averages 50 samples (~5s); peak tracks spikes so fans hit sysfs max sooner
|
||||
# under bursty browser/GPU load (see patches/t2fanrd-use-peak-temperature.patch).
|
||||
package = inputs.t2fanrd.packages.x86_64-linux.default.overrideAttrs (old: {
|
||||
patches = (old.patches or [ ]) ++ [ ../../../patches/t2fanrd-use-peak-temperature.patch ];
|
||||
patches = (old.patches or [ ]) ++ [ ../../../patches/t2fanrd-use-peak-temperature.patch ]; #TODO[epic=Moderate] Move patch file to host's directory.
|
||||
});
|
||||
config = {
|
||||
Fan1 = {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--- a/src/main.rs
|
||||
+++ b/src/main.rs
|
||||
@@ -174,19 +174,20 @@ fn start_temp_loop(
|
||||
}
|
||||
}
|
||||
|
||||
- let sum_temp: u16 = temps.iter().map(|t| *t as u16).sum();
|
||||
- let mean_temp = sum_temp / (temps.len() as u16);
|
||||
- if mean_temp == last_temp {
|
||||
+ // Max over the rolling window tracks spikes; the upstream mean can lag several
|
||||
+ // seconds behind bursty GPU/CPU load.
|
||||
+ let control_temp = temps.iter().copied().max().expect("non-empty after push_back");
|
||||
+ if control_temp == last_temp {
|
||||
std::thread::sleep(std::time::Duration::from_secs(1));
|
||||
was_long_sleep = true;
|
||||
} else {
|
||||
- last_temp = mean_temp;
|
||||
+ last_temp = control_temp;
|
||||
for fan in fans {
|
||||
- fan.set_speed(fan.calc_speed(mean_temp as u8))?;
|
||||
+ fan.set_speed(fan.calc_speed(control_temp))?;
|
||||
}
|
||||
|
||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||
was_long_sleep = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user