Fan curve enablement

- Add CtrlProfileTask
- Add method to reset active profile curve to platform default
- Wrap the zbus methods for profiles + fan curves
- Enable CLI args for fan curves
- CLI mod and save curves
This commit is contained in:
Luke D. Jones
2021-09-13 11:46:22 +12:00
parent 7041d77256
commit ab195e1d84
22 changed files with 783 additions and 328 deletions

View File

@@ -8,7 +8,11 @@ pub enum ProfileError {
NotSupported,
NotFound(String),
Io(std::io::Error),
//Zbus(zbus::Error),
ParseProfileName,
ParseFanCurveDigit(std::num::ParseIntError),
/// (pwm/temp, prev, next)
ParseFanCurvePrevHigher(&'static str, u8, u8),
// Zbus(zbus::Error),
}
impl fmt::Display for ProfileError {
@@ -21,7 +25,16 @@ impl fmt::Display for ProfileError {
ProfileError::NotSupported => write!(f, "Not supported"),
ProfileError::NotFound(deets) => write!(f, "Not found: {}", deets),
ProfileError::Io(detail) => write!(f, "std::io error: {}", detail),
//Error::Zbus(detail) => write!(f, "Zbus error: {}", detail),
ProfileError::ParseProfileName => write!(f, "Invalid profile name"),
ProfileError::ParseFanCurveDigit(e) => {
write!(f, "Could not parse number to 0-255: {}", e)
}
ProfileError::ParseFanCurvePrevHigher(part, prev, next) => write!(
f,
"Invalid {}, previous value {} is higher than next value {}",
part, prev, next
),
// Error::Zbus(detail) => write!(f, "Zbus error: {}", detail),
}
}
}