kylemcdonald / ofxEdsdk

Interfacing with Canon cameras from openFrameworks for OSX. An alternative to ofxCanon and CanonCameraWrapper.
Other
111 stars 51 forks source link

kEdsCameraCommand_PressShutterButton #31

Closed jeffcrouse closed 9 years ago

jeffcrouse commented 9 years ago

I am trying to implement two commands:

Eds::SendCommand(camera, kEdsCameraCommand_PressShutterButton, kEdsCameraCommand_ShutterButton_Completely); and Eds::SendCommand(camera, kEdsCameraCommand_PressShutterButton, kEdsCameraCommand_ShutterButton_OFF);

This will make it possible to do arbitrarily long exposures in Bulb Mode.

It works pretty well using the structure already set up in the Camera class using a flag to execute the command in the captureLoop. However, after the I "release" the shutter, it seems to get stuck in an endless loop of taking photos, and I'm not sure why.

Any tips would be appreciated! Working towards a PR with the new "pressShutter" and "releaseShutter" functions.

jeffcrouse commented 9 years ago

PS: In the interest of saving someone from heading down the wrong road, I spent a good mount of time thinking that kEdsCameraCommand_BulbStart and kEdsCameraCommand_BulbEnd were the way to go until I found this thread "problem with SDK kEdsCameraCommand_BulbStart" http://photography-on-the.net/forum/showthread.php?t=1407231

Taprik commented 8 years ago

I made it with this code in the threaded function ` if (needToTakeBulb) { try { Eds::SendCommand(camera, kEdsCameraCommand_PressShutterButton, kEdsCameraCommand_ShutterButton_Completely); while (expTime <= duration) {

                }
                Eds::SendCommand(camera, kEdsCameraCommand_PressShutterButton, kEdsCameraCommand_ShutterButton_OFF);
                lock();
                needToTakeBulb = false;
                unlock();
            }
            catch (Eds::Exception& e) {
                ofLogError() << "Error while taking a bulb picture: " << e.what();
            }

        }`

where duration is the duration of the bulb in sec expTime is variable feed by an event handler put that code in the setup function EdsSetCameraStateEventHandler(camera, kEdsStateEvent_BulbExposureTime,handleBulbExposureTimeStateEvent, (EdsVoid*)&expTime);

and create that function `EdsError EDSCALLBACK Camera::handleBulbExposureTimeStateEvent(EdsStateEvent event,EdsUInt32 parameter,EdsVoid * context) { EdsError err = EDS_ERR_OK; EdsUInt32* pI = (EdsUInt32)context; pI = parameter;

    return err;
}`

of course you need to select the bulb mode in the speed settings