Jump to content

Canon EOS Digital Control


chibill
 Share

Recommended Posts

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
Link to comment
Share on other sites

  • 3 weeks later...
  • 7 months later...

Sorry for the bump. 

 

I have not made much progress on this because I had to reinstall windows after a corruption where I could not reboot. So I have to go find Cannons digital control again before I can continue on this.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...