shared flash test

This commit is contained in:
2025-11-02 02:30:21 +01:00
parent 0519ca3efe
commit 8cd9e08e93
6 changed files with 117 additions and 28 deletions

View File

@@ -101,8 +101,9 @@ impl SensorInteraction for SensorImpl {
Timer::after_millis(10).await;
let mut moistures = Moistures::default();
let _ = Self::wait_for_can_measurements(&mut twai, &mut moistures).with_timeout(Duration::from_millis(5000)).await;
let _ = Self::wait_for_can_measurements(&mut twai, &mut moistures)
.with_timeout(Duration::from_millis(5000))
.await;
can_power.set_low();
@@ -170,7 +171,7 @@ impl SensorImpl {
can_power.set_low();
twai_config.replace(config);
let result= moistures.into();
let result = moistures.into();
info!("Autodetection result: {result:?}");
Ok(result)
@@ -182,7 +183,6 @@ impl SensorImpl {
as_async: &mut Twai<'_, Async>,
moistures: &mut Moistures,
) -> FatResult<()> {
loop {
match as_async.receive_async().await {
Ok(can_frame) => match can_frame.id() {
@@ -200,7 +200,7 @@ impl SensorImpl {
let plant = msg.1 as usize;
let sensor = msg.2;
let data = can_frame.data();
match sensor {
SensorSlot::A => {
moistures.sensor_a_hz[plant] = data[0] as f32;
@@ -319,4 +319,4 @@ impl From<Moistures> for DetectionResult {
}
result
}
}
}