Adjust timeouts and constants for improved moisture sensor and backup management accuracy
- Increased CAN measurement timeout to 5000ms for reliability. - Updated `SAVEGAME_SLOT_SIZE` usage in backup handling for consistency. - Refined moisture sensor frequency thresholds for better sensor calibration (400Hz-70kHz).
This commit is contained in:
@@ -391,7 +391,7 @@ impl<'a> BoardInteraction<'a> for V4<'a> {
|
||||
|
||||
let mut moistures = Moistures::default();
|
||||
let _ = wait_for_can_measurements(&mut twai, &mut moistures)
|
||||
.with_timeout(Duration::from_millis(1000))
|
||||
.with_timeout(Duration::from_millis(5000))
|
||||
.await;
|
||||
Ok(moistures)
|
||||
})
|
||||
|
||||
@@ -220,7 +220,7 @@ impl<'t, T: Deref<Target = str> + 't, L: Publishable + 't, const S: usize>
|
||||
username: self.username,
|
||||
password: self.password,
|
||||
subscriptions: self.subscriptions,
|
||||
keep_alive
|
||||
keep_alive,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ use chrono::{DateTime, TimeDelta, Utc};
|
||||
use chrono_tz::Tz;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
const MOIST_SENSOR_MAX_FREQUENCY: f32 = 7500.; // 60kHz (500Hz margin)
|
||||
const MOIST_SENSOR_MIN_FREQUENCY: f32 = 150.; // this is really, really dry, think like cactus levels
|
||||
const MOIST_SENSOR_MAX_FREQUENCY: f32 = 70000.; // 70kHz
|
||||
const MOIST_SENSOR_MIN_FREQUENCY: f32 = 400.; // this is really, really dry, think like cactus levels
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize)]
|
||||
pub enum MoistureSensorError {
|
||||
@@ -312,7 +312,7 @@ impl PlantState {
|
||||
},
|
||||
sensor_a_firmware_build_minutes: self.sensor_a_firmware_build_minutes,
|
||||
sensor_b_firmware_build_minutes: self.sensor_b_firmware_build_minutes,
|
||||
last_fertilizer_time: self.last_fertilizer_time
|
||||
last_fertilizer_time: self.last_fertilizer_time,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use crate::fat_error::{FatError, FatResult};
|
||||
use crate::hal::savegame_manager::SAVEGAME_SLOT_SIZE;
|
||||
use crate::webserver::read_up_to_bytes_from_request;
|
||||
use crate::BOARD_ACCESS;
|
||||
use alloc::borrow::ToOwned;
|
||||
@@ -46,7 +47,7 @@ pub(crate) async fn backup_config<T, const N: usize>(
|
||||
where
|
||||
T: Read + Write,
|
||||
{
|
||||
let input = read_up_to_bytes_from_request(conn, Some(4096)).await?;
|
||||
let input = read_up_to_bytes_from_request(conn, Some(SAVEGAME_SLOT_SIZE)).await?;
|
||||
info!("Read input with length {}", input.len());
|
||||
let mut board = BOARD_ACCESS.get().await.lock().await;
|
||||
let config_to_backup = serde_json::from_slice(&input)?;
|
||||
|
||||
Reference in New Issue
Block a user