Ascom 2x2 binning causes exception

any question related to our SDK and driver

Moderators: yang, chad, ray

Post Reply
mikebj
Posts: 3
Joined: Fri Oct 04, 2019 7:14 am

Ascom 2x2 binning causes exception

Post by mikebj » Tue Oct 08, 2019 2:52 am

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

User avatar
chad
Posts: 611
Joined: Thu Feb 09, 2017 4:58 am

Re: Ascom 2x2 binning causes exception

Post by chad » Tue Oct 08, 2019 5:42 am

Hi Mike,
Just for these codes, it should be fine.
So can you offer me the complete code?
Thanks
Chad
ZWO Driver Engineer
Location:lon=120.6 lat=31.3
SuZhou China

mikebj
Posts: 3
Joined: Fri Oct 04, 2019 7:14 am

Re: Ascom 2x2 binning causes exception

Post by mikebj » Tue Oct 08, 2019 8:02 am

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;
}
}
}
}

User avatar
chad
Posts: 611
Joined: Thu Feb 09, 2017 4:58 am

Re: Ascom 2x2 binning causes exception

Post by chad » Wed Oct 09, 2019 3:56 am

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
ZWO Driver Engineer
Location:lon=120.6 lat=31.3
SuZhou China

mikebj
Posts: 3
Joined: Fri Oct 04, 2019 7:14 am

Re: Ascom 2x2 binning causes exception

Post by mikebj » Wed Oct 09, 2019 5:50 am

Many thanks for looking into this Chad. I've sent you an email.
Best regards,
Mike

User avatar
chad
Posts: 611
Joined: Thu Feb 09, 2017 4:58 am

Re: Ascom 2x2 binning causes exception

Post by chad » Sat Oct 12, 2019 7:41 am

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
ZWO Driver Engineer
Location:lon=120.6 lat=31.3
SuZhou China

Post Reply