mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 09:23:19 +01:00
Merge branch 'as/issue_176_1' into 'main'
Fix for fan_curve related integer divison bug Closes #176 See merge request asus-linux/asusctl!102
This commit is contained in:
@@ -216,7 +216,7 @@ pub enum AuraZone {
|
||||
|
||||
/// Default factory modes structure. This easily converts to an USB HID packet with:
|
||||
/// ```rust
|
||||
/// let bytes: [u8; LED_MSG_LEN] = mode.into();
|
||||
/// // let bytes: [u8; LED_MSG_LEN] = mode.into();
|
||||
/// ```
|
||||
#[cfg_attr(feature = "dbus", derive(Type))]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
|
||||
@@ -71,10 +71,10 @@ impl std::str::FromStr for CurveData {
|
||||
} else {
|
||||
let mut p = r;
|
||||
if percentages {
|
||||
p *= 255 / 100;
|
||||
if r > 100 {
|
||||
return Err(ProfileError::ParseFanCurvePercentOver100(r));
|
||||
}
|
||||
p = (p as f32 * 2.55).round() as u8;
|
||||
}
|
||||
if pwm_prev > p {
|
||||
return Err(ProfileError::ParseFanCurvePrevHigher(
|
||||
@@ -222,7 +222,7 @@ mod tests {
|
||||
.unwrap();
|
||||
assert_eq!(curve.fan, FanCurvePU::CPU);
|
||||
assert_eq!(curve.temp, [30, 49, 59, 69, 79, 89, 99, 109]);
|
||||
assert_eq!(curve.pwm, [1, 2, 3, 4, 31, 49, 56, 58]);
|
||||
assert_eq!(curve.pwm, [3, 5, 8, 10, 79, 125, 143, 148]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user