Compare commits
1 Commits
5722fc18b2
...
267578ef0b
Author | SHA1 | Date | |
---|---|---|---|
267578ef0b |
@ -113,6 +113,14 @@ impl TankState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn got_error(&self, config: &TankConfig) -> Option<TankError> {
|
||||||
|
match self {
|
||||||
|
TankState::TankSensorPresent(raw_value_mv) => raw_voltage_to_tank_fill_percent(*raw_value_mv, config).err(),
|
||||||
|
TankState::TankSensorError(err) => Some(err.clone()),
|
||||||
|
TankState::TankSensorDisabled => Some(TankError::SensorDisabled),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn as_mqtt_info(&self, config: &TankConfig, water_temp: Result<f32, anyhow::Error>) -> TankInfo {
|
pub fn as_mqtt_info(&self, config: &TankConfig, water_temp: Result<f32, anyhow::Error>) -> TankInfo {
|
||||||
let mut tank_err: Option<TankError> = None;
|
let mut tank_err: Option<TankError> = None;
|
||||||
let left_ml = match self.left_ml(config) {
|
let left_ml = match self.left_ml(config) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user