camera_merge_main #7

Merged
lkoester merged 9 commits from camera_merge_main into main 2024-04-19 11:45:25 +02:00
Showing only changes of commit 22584c3f9c - Show all commits

View File

@ -38,6 +38,46 @@ use std::io::Error;
use std::process::Command;
use std::sync::mpsc;
const DEFAULT_SINGLE_CAM_PARAMS: CameraPictureParameters = CameraPictureParameters {
R: 8,
G: 8,
B: 8,
N: 1,
P: true,
E: 2,
W: 1000,
};
const BALANCED_SINGLE_CAM_PARAMS: CameraPictureParameters = CameraPictureParameters {
R: 13,
G: 7,
B: 8,
N: 1,
P: true,
E: 2,
W: 1000,
};
const DEFAULT_SINGLE_FLATSAT_CAM_PARAMS: CameraPictureParameters = CameraPictureParameters {
R: 8,
G: 8,
B: 8,
N: 1,
P: true,
E: 200,
W: 1000,
};
const BALANCED_SINGLE_FLATSAT_CAM_PARAMS: CameraPictureParameters = CameraPictureParameters {
R: 13,
G: 7,
B: 8,
N: 1,
P: true,
E: 200,
W: 1000,
};
#[derive(Debug)]
pub enum CameraActionIds {
DefaultSingle = 1,
@ -85,57 +125,6 @@ pub struct CameraPictureParameters {
pub W: u32, // wait time between pictures in ms, max: 40000
}
#[allow(dead_code)]
impl CameraPictureParameters {
pub fn default_single() -> Self {
Self {
R: 8,
G: 8,
B: 8,
N: 1,
P: true,
E: 2,
W: 1000,
}
}
pub fn balanced_single() -> Self {
Self {
R: 13,
G: 7,
B: 8,
N: 1,
P: true,
E: 2,
W: 1000,
}
}
pub fn default_single_flatsat() -> Self {
Self {
R: 8,
G: 8,
B: 8,
N: 1,
P: true,
E: 200,
W: 1000,
}
}
pub fn balanced_single_flatsat() -> Self {
Self {
R: 13,
G: 7,
B: 8,
N: 1,
P: true,
E: 200,
W: 1000,
}
}
}
#[allow(dead_code)]
#[derive(new)]
pub struct IMS100BatchHandler {
@ -187,14 +176,10 @@ impl IMS100BatchHandler {
action_request: &ActionRequest,
) -> std::io::Result<()> {
let param = match CameraActionIds::try_from(action_request.action_id).unwrap() {
CameraActionIds::DefaultSingle => CameraPictureParameters::default_single(),
CameraActionIds::BalancedSingle => CameraPictureParameters::balanced_single(),
CameraActionIds::DefaultSingleFlatSat => {
CameraPictureParameters::default_single_flatsat()
}
CameraActionIds::BalancedSingleFlatSat => {
CameraPictureParameters::balanced_single_flatsat()
}
CameraActionIds::DefaultSingle => DEFAULT_SINGLE_CAM_PARAMS,
CameraActionIds::BalancedSingle => BALANCED_SINGLE_CAM_PARAMS,
CameraActionIds::DefaultSingleFlatSat => DEFAULT_SINGLE_FLATSAT_CAM_PARAMS,
CameraActionIds::BalancedSingleFlatSat => BALANCED_SINGLE_FLATSAT_CAM_PARAMS,
CameraActionIds::CustomParameters => match &action_request.variant {
ActionRequestVariant::NoData => return Err(Error::other("No Data sent!")),
ActionRequestVariant::StoreData(_) => {