more async migration

This commit is contained in:
2025-09-12 16:30:35 +02:00
parent 0d495d0f56
commit 79087c9353
11 changed files with 347 additions and 308 deletions

View File

@@ -102,7 +102,7 @@ impl<'a> TankSensor<'a> {
self.get_flow_meter_value()
}
pub fn water_temperature_c(&mut self) -> anyhow::Result<f32> {
pub async fn water_temperature_c(&mut self) -> anyhow::Result<f32> {
//multisample should be moved to water_temperature_c
let mut attempt = 1;
let water_temp: Result<f32, anyhow::Error> = loop {
@@ -124,7 +124,7 @@ impl<'a> TankSensor<'a> {
water_temp
}
fn single_temperature_c(&mut self) -> anyhow::Result<f32> {
async fn single_temperature_c(&mut self) -> anyhow::Result<f32> {
self.one_wire_bus
.reset(&mut self.delay)
.map_err(|err| -> anyhow::Error { anyhow!("Missing attribute: {:?}", err) })?;
@@ -152,7 +152,7 @@ impl<'a> TankSensor<'a> {
anyhow::Ok(sensor_data.temperature / 10_f32)
}
pub fn tank_sensor_voltage(&mut self) -> anyhow::Result<f32> {
pub async fn tank_sensor_voltage(&mut self) -> anyhow::Result<f32> {
self.tank_power.set_high()?;
//let stabilize
self.delay.delay_ms(100);