Skip to content

Commit

Permalink
Merge pull request #620 from tstibor/master
Browse files Browse the repository at this point in the history
Enable/disable EOS camera mirror lockup with custom function
  • Loading branch information
knro committed Jun 20, 2018
2 parents bac1382 + 9108d2d commit 10ff249
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions 3rdparty/indi-gphoto/gphoto_driver.cpp
Expand Up @@ -36,6 +36,10 @@
#include <tiffio.h>
#include <tiffio.hxx>

#define EOS_CUSTOMFUNCEX "customfuncex"
#define EOS_MIRROR_LOCKUP_ENABLE "20,1,3,14,1,60f,1,1"
#define EOS_MIRROR_LOCKUP_DISABLE "20,1,3,14,1,60f,1,0"

static GPPortInfoList *portinfolist = nullptr;
static CameraAbilitiesList *abilities = nullptr;

Expand Down Expand Up @@ -65,6 +69,7 @@ struct _gphoto_driver
gphoto_widget *autoexposuremode_widget;
gphoto_widget *capturetarget_widget;
gphoto_widget *viewfinder_widget;
gphoto_widget *customfuncex_widget;

char bulb_port[256];
int bulb_fd;
Expand Down Expand Up @@ -782,17 +787,21 @@ int gphoto_get_last_sensor_temperature(gphoto_driver *gphoto)

int gphoto_mirrorlock(gphoto_driver *gphoto, int msec)
{
// If already set to BULB, set eosremoterelease to 2, then 4, then sleep
//if (gphoto->autoexposuremode_widget && gphoto->autoexposuremode_widget->value.index == 4)
if (gphoto->bulb_widget && !strcmp(gphoto->bulb_widget->name, "eosremoterelease"))
{
DEBUGFDEVICE(device, INDI::Logger::DBG_DEBUG, "eosremoterelease Mirror Lock for %g secs", msec / 1000.0);
DEBUGFDEVICE(device, INDI::Logger::DBG_DEBUG,
"eosremoterelease Mirror Lock for %g secs", msec / 1000.0);

gphoto_set_widget_text(gphoto, gphoto->customfuncex_widget,
EOS_MIRROR_LOCKUP_ENABLE);
gphoto_set_widget_num(gphoto, gphoto->bulb_widget, EOS_PRESS_FULL);
gphoto_set_widget_num(gphoto, gphoto->bulb_widget, EOS_RELEASE_FULL);

usleep(msec * 1000);

gphoto_set_widget_text(gphoto, gphoto->customfuncex_widget,
EOS_MIRROR_LOCKUP_DISABLE);

DEBUGDEVICE(device, INDI::Logger::DBG_DEBUG, "End of mirror lock timer");

return 0;
Expand Down Expand Up @@ -1485,6 +1494,13 @@ gphoto_driver *gphoto_open(Camera *camera, GPContext *context, const char *model
(gphoto->viewfinder_widget->value.toggle == 0) ? "Off" : "On");
}

// Check customfuncex widget to enable/disable mirror lockup.
if ((gphoto->customfuncex_widget = find_widget(gphoto, EOS_CUSTOMFUNCEX)) != nullptr)
{
DEBUGFDEVICE(device, INDI::Logger::DBG_DEBUG, "CustomFuncex Widget: %s",
gphoto->customfuncex_widget->name);
}

// Find Manufacturer
if ((widget = find_widget(gphoto, "manufacturer")) != nullptr)
{
Expand Down Expand Up @@ -1581,6 +1597,8 @@ int gphoto_close(gphoto_driver *gphoto)
widget_free(gphoto->autoexposuremode_widget);
if (gphoto->viewfinder_widget)
widget_free(gphoto->viewfinder_widget);
if (gphoto->customfuncex_widget)
widget_free(gphoto->customfuncex_widget);

while (gphoto->widgets)
{
Expand Down

0 comments on commit 10ff249

Please sign in to comment.