|
@ -1,8 +1,9 @@ |
|
|
use std::{path::Path, time::Duration}; |
|
|
use std::{path::Path, time::Duration}; |
|
|
|
|
|
|
|
|
use crate::{ |
|
|
use crate::{ |
|
|
|
|
|
actuators, |
|
|
error::GenericResult, |
|
|
error::GenericResult, |
|
|
io, |
|
|
|
|
|
|
|
|
io::{self, RelaySwitchState}, |
|
|
state::{lock_state, ProgramStateShared}, |
|
|
state::{lock_state, ProgramStateShared}, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -18,7 +19,18 @@ pub async fn save_latest_image(program_state: ProgramStateShared) -> GenericResu |
|
|
.clone() |
|
|
.clone() |
|
|
}) |
|
|
}) |
|
|
.unwrap_or(io::ImageResolution::R360p); |
|
|
.unwrap_or(io::ImageResolution::R360p); |
|
|
|
|
|
|
|
|
|
|
|
let light_state: RelaySwitchState; |
|
|
|
|
|
{ |
|
|
|
|
|
let mut program_state = lock_state(&program_state)?; |
|
|
|
|
|
light_state = actuators::get_light_state(&mut program_state)?; |
|
|
|
|
|
actuators::switch_lights(RelaySwitchState::On, &mut program_state)?; |
|
|
|
|
|
} |
|
|
io::capture_image(&resolution, get_image_path()).await?; |
|
|
io::capture_image(&resolution, get_image_path()).await?; |
|
|
|
|
|
{ |
|
|
|
|
|
let mut program_state = lock_state(&program_state)?; |
|
|
|
|
|
actuators::switch_lights(light_state, &mut program_state)?; |
|
|
|
|
|
} |
|
|
Ok(()) |
|
|
Ok(()) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|