use proper error handling
This commit is contained in:
@@ -123,6 +123,12 @@ 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::TankSensorDisabled => Some(TankError::SensorDisabled),
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user