mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
fix: normalize fan speed values by taking min speed into account
This commit is contained in:
parent
7e579f8fc9
commit
945cfd23e6
@ -63,8 +63,8 @@ impl FanCurve {
|
|||||||
.0
|
.0
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(temp, ratio)| {
|
.map(|(temp, ratio)| {
|
||||||
let custom_pwm = (max_pwm * ratio) as u8;
|
let custom_pwm = (max_pwm * ratio) - (f32::from(min_pwm) * (1.0 - ratio));
|
||||||
let pwm = cmp::max(min_pwm, custom_pwm);
|
let pwm = cmp::max(min_pwm, custom_pwm as u8);
|
||||||
(temp, pwm)
|
(temp, pwm)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
@ -203,7 +203,8 @@ mod tests {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
let pmfw_curve = curve.into_pmfw_curve(current_pmfw_curve).unwrap();
|
let pmfw_curve = curve.into_pmfw_curve(current_pmfw_curve).unwrap();
|
||||||
let expected_points = [(40, 20), (50, 35), (60, 50), (70, 75), (80, 100)];
|
// Normalized values
|
||||||
|
let expected_points = [(40, 20), (50, 22), (60, 40), (70, 70), (80, 100)];
|
||||||
assert_eq!(&expected_points, pmfw_curve.points.as_ref());
|
assert_eq!(&expected_points, pmfw_curve.points.as_ref());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,9 +341,11 @@ impl GpuController {
|
|||||||
let min_temperature = allowed_ranges.temperature_range.start();
|
let min_temperature = allowed_ranges.temperature_range.start();
|
||||||
let max_temperature = allowed_ranges.temperature_range.end();
|
let max_temperature = allowed_ranges.temperature_range.end();
|
||||||
|
|
||||||
#[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
|
let min_pwm = f64::from(*allowed_ranges.speed_range.start());
|
||||||
let custom_pwm = (f64::from(*allowed_ranges.speed_range.end()) * static_speed) as u8;
|
let max_pwm = f64::from(*allowed_ranges.speed_range.end());
|
||||||
let static_pwm = cmp::max(*allowed_ranges.speed_range.start(), custom_pwm);
|
let custom_pwm = (max_pwm * static_speed) - (min_pwm * (1.0 - static_speed));
|
||||||
|
#[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)]
|
||||||
|
let static_pwm = cmp::max(*allowed_ranges.speed_range.start(), custom_pwm as u8);
|
||||||
|
|
||||||
let mut points = vec![(*min_temperature, static_pwm)];
|
let mut points = vec![(*min_temperature, static_pwm)];
|
||||||
for _ in 1..current_curve.points.len() {
|
for _ in 1..current_curve.points.len() {
|
||||||
|
Loading…
Reference in New Issue
Block a user