Parse percentages in fan curve only if '%' provided otherwise range is 0-255

This commit is contained in:
Luke D. Jones
2021-10-27 22:35:45 +13:00
parent 328ff0251b
commit 3f0df82f2d
4 changed files with 31 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ pub enum ProfileError {
ParseFanCurveDigit(std::num::ParseIntError),
/// (pwm/temp, prev, next)
ParseFanCurvePrevHigher(&'static str, u8, u8),
ParseFanCurvePercentOver100(u8),
// Zbus(zbus::Error),
}
@@ -34,6 +35,9 @@ impl fmt::Display for ProfileError {
"Invalid {}, previous value {} is higher than next value {}",
part, prev, next
),
ProfileError::ParseFanCurvePercentOver100(value) => {
write!(f, "Invalid percentage, {} is higher than 100", value)
}
// Error::Zbus(detail) => write!(f, "Zbus error: {}", detail),
}
}