chibill

Canon EOS Digital Control

5 posts in this topic

#1 ·  Posted (edited)

Now I am not exactly sure if this is against the rules. (As Canon does not want you reverse engineering their tools to write your own.  And don't offer there SDKs to the general public.) So if it sorry and you can promptly lock this.

I came back to AutoIt after a good 5 years just to be able to control my Canon EOS Rebel Camera for the eclipse (August 21, 2017) and the following is what I have done as a "api"  to their graphical interface for the camera.

#include <String.au3>
#include <Array.au3>

Local Const $exposures = StringSplit("BULB|30 Sec|25 Sec|20 Sec|15 Sec|13 Sec|10 Sec|8 Sec|6 Sec|5 Sec|4 Sec|3.2 Sec|2.5 Sec|2 Sec|1.6 Sec|1.3 Sec|1 Sec|0.8 Sec|0.6 Sec|0.5 Sec|0.4 Sec|0.3 Sec|1/4 Sec|1/5 Sec|1/6 Sec|1/8 Sec|1/10 Sec|1/13 Sec|1/15 Sec|1/20 Sec|1/25 Sec|1/30 Sec|1/40 Sec|1/50 Sec|1/60 Sec|1/80 Sec|1/100 Sec|1/125 Sec|1/160 Sec|1/200 Sec|1/250 Sec|1/320 Sec|1/400 Sec|1/500 Sec|1/640 Sec|1/800 Sec|1/1000 Sec|1/1250 Sec|1/1600 Sec|1/2000 Sec|1/2500 Sec|1/3200 Sec|1/4000 Sec","|")
Local Const $ISOS[6] = ["AUTO","100","200","400","800","1600"]

Func Capture()
    ControlClick(" EOS DIGITAL","","[NAME:takePictureButton]")
EndFunc

Func BULB()
    ControlSend(" EOS DIGITAL","","[NAME:olcTv]","{DOWN}")
EndFunc

Func SetExposure($cur,$expos)
    $index = _ArraySearch($exposures,$expos)
    $index1 = _ArraySearch($exposures,$cur)
    If $index-$index1 < 0 Then
        ControlSend(" EOS DIGITAL","","[NAME:olcTv]",_StringRepeat("{Left}",$index1-$index))
    Else
        If $index-$index1 > 0 Then
            ControlSend(" EOS DIGITAL","","[NAME:olcTv]",_StringRepeat("{RIGHT}",$index-$index1))
        EndIf
    EndIF
EndFunc

Func GUICtrlGetBkColor($hWnd)
    Local $hDC = _WinAPI_GetDC($hWnd)
    Local $iColor = _WinAPI_GetPixel($hDC, 10, 10)
    _WinAPI_ReleaseDC($hWnd, $hDC)
    Return Hex($iColor,6)
EndFunc

Func CheckWarning()
    $i = GUICtrlGetBkColor(ControlGetHandle(" EOS DIGITAL","","[NAME:ledWarning]"))
    Return $i == "E80000"
EndFunc

Func SetAutoISO()
    ControlSend(" EOS DIGITAL","","[NAME:olcIso]","{DOWN}")
EndFunc

Func SetISO($iso)
    SetAutoISO()
    ControlSend(" EOS DIGITAL","","[NAME:olcIso]",_StringRepeat("{RIGHT}",_ArraySearch($ISOS,$iso)))
EndFunc

Now I know there are probably many problems with this. (Namely the first Const... ) And possibly some other areas that are just not logical. But bear in mind I am uploading this on the 20th after spending 2 days relearning AutoIt after 5 years of using Java and Python.

 

Any improvements would be nice. (I have a lot I need to add still.) I can also work on a way to return the captured image.

Edited by chibill
1 person likes this

Share this post


Link to post
Share on other sites



This looks like an awesome start! can't wait to see future versions

Share this post


Link to post
Share on other sites

I am eventually going to make it actually in a proper format. (Instead of its only lonely include)

 

Also I need to tidy up my code more. (I found a few bugs in it.)

 

Share this post


Link to post
Share on other sites

seems it will be very interesting...

Share this post


Link to post
Share on other sites

Currently I am annoyed by canons use of controls. I can't get a bunch of the information present because of AutoIT not being able to see the image or what not.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now