Programming the cooler in Python

Somewhere to ask questions about the best way to use SharpCap
Forum rules


If you have a problem or question, please check the FAQ to see if it already has an answer : https://www.sharpcap.co.uk/sharpcap-faqs
Post Reply
tmnathe
Posts: 21
Joined: Fri Jul 29, 2022 4:13 am

Programming the cooler in Python

#1

Post 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!
User avatar
admin
Site Admin
Posts: 13344
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Programming the cooler in Python

#2

Post 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
tmnathe
Posts: 21
Joined: Fri Jul 29, 2022 4:13 am

Re: Programming the cooler in Python

#3

Post by tmnathe »

Thanks, Robin!

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