diff options
author | Andy Wortman <ixineeringeverywhere@gmail.com> | 2019-10-06 01:26:07 -0700 |
---|---|---|
committer | Andy Wortman <ixineeringeverywhere@gmail.com> | 2019-10-06 01:26:07 -0700 |
commit | 56ff8b55d5b831ed068439ff60909ffbb2fb568a (patch) | |
tree | 5b143033ca8d1294d47a1eeb4b8a460d04da5862 /src/qhyccd/mod.rs | |
parent | 347333f2edd964e0dd258faa1549cb4d67471db9 (diff) |
write raw data in case it's more useful for postprocessing
add a notion of camera properties, write that alongside images
automatically fix colors if the image is in fact colors
Diffstat (limited to 'src/qhyccd/mod.rs')
-rw-r--r-- | src/qhyccd/mod.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/qhyccd/mod.rs b/src/qhyccd/mod.rs index 12630d6..becb698 100644 --- a/src/qhyccd/mod.rs +++ b/src/qhyccd/mod.rs @@ -20,6 +20,7 @@ use crossbeam_channel::select; use png::HasParameters; use crate::Dimensions; +use crate::Properties; // unsafe impl Send for Camera { } #[derive(Debug)] @@ -222,7 +223,18 @@ pub fn connect(camera_idx: i32) -> Result<(Receiver<QHYResponse>, Sender<QHYMess let (data, width, height, bpp, channels) = camera.read_frame(data).expect("can read frames from camera"); counter = camera.settings.exposure; camera.begin_exposure().expect("can begin exposures"); - response_sender.send(QHYResponse::Data(data, Dimensions::new(width, height, bpp, channels))).unwrap(); + response_sender.send(QHYResponse::Data( + data, + Dimensions::new(width, height, bpp, channels), + Properties { + device: "qhy376c", + exposure_ms: camera.settings.exposure as u32, + gain: camera.settings.gain as u16, + offset: camera.settings.offset as u16, + gamma: camera.settings.gamma as u16, + temp: (camera.settings.cur_temp * 10.0) as u16, + }, + )).unwrap(); } else { // no frame ready in the buffer! we can't actually read the image... counter = camera.settings.exposure; @@ -242,7 +254,7 @@ pub fn connect(camera_idx: i32) -> Result<(Receiver<QHYResponse>, Sender<QHYMess pub enum QHYResponse { InitializationError, - Data(Vec<u8>, Dimensions), + Data(Vec<u8>, Dimensions, Properties), DroppedFrame, Shutdown, UpdatedSettings(Settings), |