allow single sensor detection, get rid of sensor disabled hardware state == nomessage
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::config::PlantControllerConfig;
|
||||
use crate::fat_error::FatResult;
|
||||
use crate::hal::esp_set_time;
|
||||
use crate::hal::{esp_set_time, Detection, DetectionRequest};
|
||||
use crate::webserver::read_up_to_bytes_from_request;
|
||||
use crate::{do_secure_pump, BOARD_ACCESS};
|
||||
use alloc::string::{String, ToString};
|
||||
@@ -55,9 +55,16 @@ pub(crate) async fn board_test() -> FatResult<Option<String>> {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
pub(crate) async fn detect_sensors() -> FatResult<Option<String>> {
|
||||
pub(crate) async fn detect_sensors<T, const N: usize>(
|
||||
request: &mut Connection<'_, T, N>,
|
||||
) -> FatResult<Option<String>>
|
||||
where
|
||||
T: Read + Write,
|
||||
{
|
||||
let actual_data = read_up_to_bytes_from_request(request, None).await?;
|
||||
let detect: Detection = serde_json::from_slice(&actual_data)?;
|
||||
let mut board = BOARD_ACCESS.get().await.lock().await;
|
||||
let result = board.board_hal.detect_sensors().await?;
|
||||
let result = board.board_hal.detect_sensors(detect).await?;
|
||||
let json = serde_json::to_string(&result)?;
|
||||
Ok(Some(json))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user