×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Cooled Asi Cam

  • Posts: 20
  • Thank you received: 12

Cooled Asi Cam was created by Markus

Hi,

I received a new and shiny ASI174MM-COOL yesterday and couldn't wait to test it (at least at home as it was cloudy).
Unfortunately the cooler didn't start even after setting temperatures in Ekos. So I looked into the indi_asi_ccd source code and saw that you do not send the requested value to the Cam.
I added two lines to the SetTemperature function in the code (ASISetControlValue ASI_COOLER_ON to true and ASI_REQUEST_TEMP to the requested value)
Afterwards everything works like intended.
(Excuse me for only writing pseudo code, but I'm writing from the train without access to the source code on my RaspberryPi at home)

I'm not sure if that is the correct place in the code to send the values to the cam or if it should be in the NewNumbers section but it's working at the moment.

Some additional info:
I checked out the latest svn version
Maybe the cooler should be set to OFF at disconnect.

CS Markus
The following user(s) said Thank You: Jasem Mutlaq
8 years 2 months ago #6625

Please Log in or Create an account to join the conversation.

Replied by Jasem Mutlaq on topic Cooled Asi Cam

Thanks for the report! I made a few changes to support temperature setting and turning on/off cooler. Completely untested so please test it and report back.
The following user(s) said Thank You: Markus
8 years 2 months ago #6626

Please Log in or Create an account to join the conversation.

  • Posts: 20
  • Thank you received: 12

Replied by Markus on topic Cooled Asi Cam

Hi,

I tested the changes now and unfortunately it did not work out of the box. I made some changes again to get it to work. Hopefully in a way you intended it to be.
I initialized the CoolerS and CoolerSP variables you added in the header file and corrected the order of the variables in the ASISetControlValue function to activate the cooler.

Index: ../indi-asicam/asi_ccd.cpp
===================================================================
--- ../indi-asicam/asi_ccd.cpp  (revision 2660)
+++ ../indi-asicam/asi_ccd.cpp  (working copy)
@@ -227,6 +227,10 @@
   IUFillNumber(&CoolerN[0], "CCD_COOLER_VALUE", "Cooling Power (%)", "%+06.2f", 0., 1., .2, 0.0);
   IUFillNumberVector(&CoolerNP, CoolerN, 1, getDeviceName(), "CCD_COOLER_POWER", "Cooling Power", MAIN_CONTROL_TAB, IP_RO, 60, IPS_IDLE);
 
+  IUFillSwitch(&CoolerS[0], "CCD_COOLER_ON", "ON", ISS_OFF);
+  IUFillSwitch(&CoolerS[1], "CCD_COOLER_OFF", "OFF", ISS_ON);
+  IUFillSwitchVector(&CoolerSP, CoolerS, 2, getDeviceName(), "CCD_COOLER", "Cooler", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); 
+
   IUFillNumberVector(&ControlNP, NULL, 0, getDeviceName(), "CCD_CONTROLS", "Controls", CONTROL_TAB, IP_RW, 60, IPS_IDLE);
 
   IUFillSwitchVector(&ControlSP, NULL, 0, getDeviceName(), "CCD_CONTROLS_MODE", "Set Auto", CONTROL_TAB, IP_RW, ISR_NOFMANY, 60, IPS_IDLE);
@@ -637,8 +641,8 @@
          else
            rc = activateCooler(false);
 
-         CoolerSP.s = rc ? IPS_BUSY : IPS_ALERT;
-         IDSetSwitch(&CoolerSP, NULL);
+         //CoolerSP.s = rc ? IPS_BUSY : IPS_ALERT;
+         //IDSetSwitch(&CoolerSP, NULL);
 
          return true;
        }
@@ -755,7 +759,21 @@
 
 bool ASICCD::activateCooler(bool enable)
 {
-    return (ASISetControlValue(m_camInfo->CameraID, ASI_COOLER_ON, 0, enable ? ASI_TRUE : ASI_FALSE) == ASI_SUCCESS);
+    bool success;
+
+    success = (ASISetControlValue(m_camInfo->CameraID, ASI_COOLER_ON, enable ? ASI_TRUE : ASI_FALSE, ASI_FALSE) == ASI_SUCCESS);
+    if (enable) {
+       CoolerS[0].s = ISS_ON;
+       CoolerS[1].s = ISS_OFF;
+       CoolerSP.s = success ? IPS_BUSY : IPS_ALERT;
+    }
+    else {
+       CoolerS[1].s = ISS_ON;
+       CoolerS[0].s = ISS_OFF;
+       CoolerSP.s = success ? IPS_IDLE : IPS_ALERT;
+    }
+    IDSetSwitch(&CoolerSP, NULL);
+    return success;
 }

Feel free to use the code or change it in any way you want ;)

CS Markus

PS:
I do not exactly now how you determine if a camera has a cooler in the EKOS CCD Tab (to activate the temperature settings), but I think it would be nice to see the chip temperature also on ASI cameras without a cooler attached. Is it possible to show this number vector without cooler? I do not care if it is in the Ekos CCD Panel or in the Indi Control Panel of the camera.
The following user(s) said Thank You: Jasem Mutlaq
8 years 2 months ago #6630

Please Log in or Create an account to join the conversation.

Replied by Jasem Mutlaq on topic Cooled Asi Cam

So it looks like the problem was with setting the enable/disable, I thought it was the 4th argument where it is apparently the third. Anyway, I made the necessary changes. Your patch, as it is, won't work because on failure it will still change switch state. At any rate, a new version is up so please test!

Regarding temperature, have you tried querying temperature from a non-cooler ASI camera? Any valid data or bogus results?
8 years 2 months ago #6635

Please Log in or Create an account to join the conversation.

  • Posts: 20
  • Thank you received: 12

Replied by Markus on topic Cooled Asi Cam

Hi,

Yeah I wanted to show the requested state of the Cooler if an error occurs. But I'm also perfectly fine with showing the last successful value.

May I just propose to change line 766 of asi_ccd.cpp from
CoolerSP.s = IPS_BUSY;
to
CoolerSP.s = enable ? IPS_BUSY : IPS_IDLE;
so the light in Ekos shows the state of the Cooler.

I tried reading the temperature of an ASI120MC-S (the only other ASI I have at home) and got useful data out of it (didn't check the accuracy). It was only an ugly hack because I'm not sure what happens if I fill the data into the existing Temperature property and how to enable that property.
Otherwise I would set the TemperatureNP to RO if it detects a camera without cooler but with an ASI_CONTROL_CAP of the ASI_CONTROL_TYPE ASI_TEMPERATURE, to RW if it has a Cooler attached or to invisible without any of that controlcaps.

CS Markus
8 years 2 months ago #6644

Please Log in or Create an account to join the conversation.

  • Posts: 20
  • Thank you received: 12

Replied by Markus on topic Cooled Asi Cam

Hi,

I found another small bug yesterday evening.
ASI_TARGET_TEMP does not need the "*10" like ASI_TEMPERATURE. I still have to check if rounding to integers is needed, or if it can handle decimal numbers.

And a little inconvenience:
The reported temperature sometime oscillates around the target temperature quite a while. I tried target temperature 0°C yesterday and could observe reported temperatures to jump from -0.5 to 0.5 and back for 5 minutes. Maybe we could use a average of 4-10 readings to report back to Ekos?

CS Markus
8 years 2 months ago #6645

Please Log in or Create an account to join the conversation.

Replied by Jasem Mutlaq on topic Cooled Asi Cam

Ok just let me know how target temp then behaves and I'll make the rest of the changes. Also I'm assuming that all non-cooled cameras do not have temperature sensor to begin with, so isn't this information bogus?
8 years 2 months ago #6646

Please Log in or Create an account to join the conversation.

  • Posts: 20
  • Thank you received: 12

Replied by Markus on topic Cooled Asi Cam

Hi,

Just had a look:
You can directly use the temperature argument of the SetTemperature function in the ASISetControlValue function. No typecast, multiplication or any other operation is needed.

I can only be sure for my ASI120MC-S (and one other ASI120 where I do not exactly know which type it is). These have a temperature sensor that can be read with the control value.
I think we could check that by reading all the AsiControlCaps (You read them already in createControls()!). If there is one with the ControlType ASI_TEMPERATURE I would expect there is a sensor.
I'll try that in the next 1-2 weeks (just have to find some free time before...)
But I need some ideas how to show the TemperatureNP and TemperatureN properties of the CCD class even if there is no Cooler reported -> HasCooler() == false.
Ideally I would set TemperatureNP and TemperatureN to ReadOnly without a Cooler and to ReadWrite with Cooler and would use defineNumber if the camera reports a temperature sensor.
I know that implies a change in the interfaces, camera capabilities and so on and could effect other drivers! But I think creating a new INumber and INumberVectorProperty is kind of ugly if there is one already with the same purpose.

CS
Markus
8 years 2 months ago #6656

Please Log in or Create an account to join the conversation.

  • Posts: 20
  • Thank you received: 12

Replied by Markus on topic Cooled Asi Cam

Hi,

During my first light yesterday I found another problem which seems to be in the ASI SDK:
It looks like none of my two cameras (ASI120MC-S, ASI174MM-Cool) actually sets the start position if you want to take a picture of a non centered ROI. I'm using ASISetStartPos and ASIGetStartPos to check the values.
I'll also create a topic for that issue in the ZWO forum, but last time I found an error in the SDK you where quite a bit faster than me reaching Sam....

PS: I did not find time to write the temperature reading code and some input to my questions would be highly appreciated. (How to use the TemperatureN and TemperatureNP properties without a cooler)

CS Markus
8 years 2 months ago #6710

Please Log in or Create an account to join the conversation.

Replied by Jasem Mutlaq on topic Cooled Asi Cam

Before proceeding with this, I need confirmation from ASI that temperature sensors work on all other cameras. Currently, way to know if it is a cooled camera is by checking 'IsCoolerCam' parameter. No information in the SDK about temperature sensors otherwise. Since you'll be communicating with them, you can ask them for this confirmation.
The following user(s) said Thank You: Markus
8 years 2 months ago #6711

Please Log in or Create an account to join the conversation.

  • Posts: 20
  • Thank you received: 12

Replied by Markus on topic Cooled Asi Cam

Hi,

I just had another look at the driver while writing the post in the ZWO forum and found a solution before even sending my post there :P.

If you change the order of setting the ROI and the StartPos everything works as expected.

Can I ask you to change the two if cases in line 843 and 849 of asi_ccd.cpp to set the ROI first and afterwards the StartPos?

For the temperature sensor I sent a mail to Sam ;)

CS

Markus
8 years 2 months ago #6712

Please Log in or Create an account to join the conversation.

  • Posts: 20
  • Thank you received: 12

Replied by Markus on topic Cooled Asi Cam

Wow that was fast.

Sam wrote that all cameras do have a temperature sensor, so there should be no problem with reading the value ;)

CS Markus
8 years 2 months ago #6713

Please Log in or Create an account to join the conversation.

Time to create page: 0.817 seconds