Skip to content

Commit

Permalink
indi-gphoto with external shutter (#1023)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpeex authored Jan 20, 2025
1 parent 8f07ef5 commit dc80d96
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions indi-gphoto/gphoto_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,26 +627,13 @@ static void *stop_bulb(void *arg)
DEBUGDEVICE(device, INDI::Logger::DBG_DEBUG, "Closing DSUSB shutter.");
gphoto->dsusb->closeShutter();
}
if (gphoto->bulb_widget)
{
DEBUGDEVICE(device, INDI::Logger::DBG_DEBUG, "Closing internal shutter.");
DEBUGFDEVICE(device, INDI::Logger::DBG_DEBUG, "Using widget:%s", gphoto->bulb_widget->name);
if (strcmp(gphoto->bulb_widget->name, "eosremoterelease") == 0)
{
//600D eosremoterelease RELEASE FULL
gphoto_set_widget_num(gphoto, gphoto->bulb_widget, EOS_RELEASE_FULL);
}
else
{
gphoto_set_widget_num(gphoto, gphoto->bulb_widget, FALSE);
}
}

if (gphoto->bulb_port[0] && (gphoto->bulb_fd >= 0))
{
DEBUGDEVICE(device, INDI::Logger::DBG_DEBUG, "Closing remote serial shutter.");
DEBUGFDEVICE(device, INDI::Logger::DBG_DEBUG, "Closing remote serial shutter (%s)",gphoto->bulb_port);

// Close Nikon Shutter
if (!strstr(device, "Nikon"))
if (strstr(device, "Nikon"))
{
uint8_t close_shutter[3] = {0xFF, 0x01, 0x00};
if (write(gphoto->bulb_fd, close_shutter, 3) != 3)
Expand All @@ -656,6 +643,20 @@ static void *stop_bulb(void *arg)
ioctl(gphoto->bulb_fd, TIOCMBIC, &RTS_flag);
close(gphoto->bulb_fd);
}
else if (gphoto->bulb_widget)
{
DEBUGDEVICE(device, INDI::Logger::DBG_DEBUG, "Closing internal shutter.");
DEBUGFDEVICE(device, INDI::Logger::DBG_DEBUG, "Using widget:%s", gphoto->bulb_widget->name);
if (strcmp(gphoto->bulb_widget->name, "eosremoterelease") == 0)
{
//600D eosremoterelease RELEASE FULL
gphoto_set_widget_num(gphoto, gphoto->bulb_widget, EOS_RELEASE_FULL);
}
else
{
gphoto_set_widget_num(gphoto, gphoto->bulb_widget, FALSE);
}
}
gphoto->command |= DSLR_CMD_DONE;
pthread_cond_signal(&gphoto->signal);
}
Expand Down Expand Up @@ -1221,7 +1222,7 @@ int gphoto_start_exposure(gphoto_driver *gphoto, uint32_t exptime_usec, int mirr
}

// Open Nikon Shutter
if (!strstr(device, "Nikon"))
if (strstr(device, "Nikon"))
{
uint8_t open_shutter[3] = {0xFF, 0x01, 0x01};
if (write(gphoto->bulb_fd, open_shutter, 3) != 3)
Expand Down Expand Up @@ -1418,10 +1419,12 @@ int gphoto_read_exposure_fd(gphoto_driver *gphoto, int fd)
return GP_OK;

case GP_EVENT_FILE_ADDED:
if (downloadComplete) break;
DEBUGDEVICE(device, INDI::Logger::DBG_DEBUG, "File added event completed.");
fn = static_cast<CameraFilePath *>(data);
if (gphoto->handle_sdcard_image != IGNORE_IMAGE)
download_image(gphoto, fn, fd);

downloadComplete = true;
// Wait 1 second for GP_EVENT_CAPTURE_COMPLETE
// If that times out, we already marked downloadComplete as true so we will exist gracefully.
Expand Down

0 comments on commit dc80d96

Please sign in to comment.