From 500d14a308a2f58ea70b4a4e75c5603cd66d629f Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 6 Jan 2020 06:12:51 -0800 Subject: qhy mono cameras report channels and debayer unexpectedly --- src/qhyccd/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/qhyccd/mod.rs b/src/qhyccd/mod.rs index 5300fe1..1f7bcb2 100644 --- a/src/qhyccd/mod.rs +++ b/src/qhyccd/mod.rs @@ -395,11 +395,14 @@ impl Camera { // TODO: handle mono cameras correctly if mono { unsafe { - check(QHYCCDCam::SetQHYCCDDebayerOnOff(self.handle, 0))?; + // well, this can fail if debayering just isn't supported. so let's... not + QHYCCDCam::SetQHYCCDDebayerOnOff(self.handle, 0); } + /* self.set_control(Control::CONTROL_WBR, 1000.0)?; self.set_control(Control::CONTROL_WBG, 1000.0)?; self.set_control(Control::CONTROL_WBB, 1000.0)?; + */ self.settings.channels = 1; } else { unsafe { @@ -420,6 +423,10 @@ impl Camera { 1 | 2 | 3 | 4 => { self.set_color_mode(false)?; }, + 0 => { + // no, the color control is not available. mono it is! + self.set_color_mode(true)?; + } a @ _ => { println!("unexpected response when querying color setting: {}", a); return Err(CameraError::QHYError) @@ -432,6 +439,9 @@ impl Camera { self.settings.bpp = 16; } println!("roi set to {} x {} ???", imagew, imageh); + println!("gain limits: {:?}", self.get_control_limits(Control::Gain)?); + println!("exposure limits: {:?}", self.get_control_limits(Control::Exposure)?); +// panic!("hi"); Ok(()) } } -- cgit v1.1