Page 1 of 1

Programming the cooler in Python

Posted: Sun Jan 21, 2024 2:37 am
by tmnathe
I'm working through some of the SharpCap Python commands and hit a snag with how to control the cooler.
The commands that I'm attempting to work with are CoolerOnOff and CoolerPower.

For CoolerOnOff there's this cryptic command "cooler = SharpCap.SelectedCamera.Controls.Find(lambda x: x.Name == "Cooler")"in the command cheatsheet, but no explanation oh how to use it.
Now I know that lambda is a temporary command that goes away after it's used, but what is the rest? Is that supposed to be the path to wherever the cooler function is for the camera that I'm using or something else? My camera is a QHY163M and I do have the QHY SDK, however, I'm not finding any sort of cooler program.

For CoolerPower, I'm not sure how it's supposed to be used. I'd like to just display the number, but if I run the command as a print statement, it returns None.

Thanks for the help in advance!

Re: Programming the cooler in Python

Posted: Sun Jan 21, 2024 11:42 am
by admin
Hi,

the Lambda function provides a small piece of code that is used to test each control to find the one you want - basically you get back the first control that the lambda function returns true for.

However, there is now an easier way to get the control you want - using FindByName like this

Code: Select all

print (SharpCap.SelectedCamera.Controls.FindByName("Cooler Power").Value)
SharpCap.SelectedCamera.Controls.FindByName("Cooler Power").Automatic = False
SharpCap.SelectedCamera.Controls.FindByName("Cooler Power").Value = 30
The code above will print the current power level, then turn 'automatic' power adjustment off and set the cooler to power 30 (automatic power adjustment will try to hit the set 'Target Temperature'.

For 'Find By Name' use the name of the control (in English, not translation) as you see it on the right. Only controls that you can see on the right will be available, so for instance some cameras do not have a specific cooler on/off control, in which case cooler off is achieved either by setting the power to zero or setting the target temperature to +30C or so.

Hopefully that will make it easier for you to get what you need done.

cheers,

Robin

Re: Programming the cooler in Python

Posted: Sun Jan 21, 2024 10:34 pm
by tmnathe
Thanks, Robin!

That command had me running around in circles.
Tom :)