Page 1 of 1

Ascom 2x2 binning causes exception

Posted: Tue Oct 08, 2019 2:52 am
by mikebj
Using ASI1600MM, ASCOM 6 and Visual Studio C#, the following code works fine:

MyCamera.BinX = 1;
MyCamera.BinY = 1;
MyCamera.StartExposure(0.1, true);

Conversely, with

MyCamera.BinX = 2;
MyCamera.BinY = 2;
MyCamera.StartExposure(0.1, true);

the StartExposure line throws an exception:


ASCOM.DriverAccessCOMException
HResult=0x8004040B
Message=The requested operation is not permitted at this time
Source=ASCOM.DriverAccess

What do I need to do to set up 2x2 binning?

Best regards,
Mike

Re: Ascom 2x2 binning causes exception

Posted: Tue Oct 08, 2019 5:42 am
by chad
Hi Mike,
Just for these codes, it should be fine.
So can you offer me the complete code?
Thanks
Chad

Re: Ascom 2x2 binning causes exception

Posted: Tue Oct 08, 2019 8:02 am
by mikebj
Thanks, Chad. Here is full code sufficient to demonstrate the problem on my machine. I am using Windows 10 64 bit professional. The problem occurs regardless of whether I build 64 bit, 32 bit, or Any CPU.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ASCOM.DriverAccess;

namespace WindowsFormsApp3
{
public partial class Form1 : Form
{
Camera MyCamera;
bool exposing = false;
bool CameraOk = false;
public Form1()
{
InitializeComponent();
}

private void ConnectFastGuideCamera()
{
MyCamera = new Camera("ASCOM.ASICamera2.Camera");
try
{
MyCamera.Connected = true;
MyCamera.FastReadout = true;
CameraOk = true;
}
catch (System.Exception)
{
MessageBox.Show("Camera not connected");
}
if (CameraOk)
{
timer1.Interval = 50;
timer1.Enabled = true;
}
}

private void connectButton_Click(object sender, EventArgs e)
{
ConnectFastGuideCamera();
connectButton.BackColor = CameraOk ? Color.Yellow : Color.Red; // Show we have successfully connected
}

private void exposeButton_Click(object sender, EventArgs e)
{
if (!CameraOk)
{
MessageBox.Show("No camera");
}
else if (exposing)
{
MessageBox.Show("Already exposing");
}
else
{
MyCamera.BinX = 2;
MyCamera.BinY = 2;
MyCamera.StartExposure(0.1, true); // This fails if binning = 2, succeeds if binning = 1
exposing = true;
exposeButton.BackColor = Color.Yellow; // Show we have started the exposure
}
}

private void timer1_Tick(object sender, EventArgs e)
{
// See if an exposure has begun but is now complete
if (exposing && MyCamera.ImageReady)
{
exposeButton.BackColor = Color.Blue; // Show the exposure has completed
exposing = false;
}
}
}
}

Re: Ascom 2x2 binning causes exception

Posted: Wed Oct 09, 2019 3:56 am
by chad
Hi Mike,
For your current code, it looks like normal.
And we checked this part of code, we did throw this exception.
So I think maybe we can try to catch the log of it, and then try to find out what happened.
So Please send an email to me: chad.cao(at)zwoptical.com. I will email you how to catch the log.
Thanks
Chad

Re: Ascom 2x2 binning causes exception

Posted: Wed Oct 09, 2019 5:50 am
by mikebj
Many thanks for looking into this Chad. I've sent you an email.
Best regards,
Mike

Re: Ascom 2x2 binning causes exception

Posted: Sat Oct 12, 2019 7:41 am
by chad
As the camera parameters increase, there are many parameters that are associated. After initializing the camera, try to set all the parameters once. This will prevent many unnecessary strange errors.
Thanks
Chad