From d332dcbe5913bade12defca4cb15b5984fe8287d Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Fri, 27 Jul 2012 14:56:01 +0200 Subject: Set timeout less than infinity --- src/cameras/uca-ufo-camera.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/cameras') diff --git a/src/cameras/uca-ufo-camera.c b/src/cameras/uca-ufo-camera.c index fc27b1b..5e17937 100644 --- a/src/cameras/uca-ufo-camera.c +++ b/src/cameras/uca-ufo-camera.c @@ -259,15 +259,21 @@ static void uca_ufo_camera_grab(UcaCamera *camera, gpointer *data, GError **erro { g_return_if_fail(UCA_IS_UFO_CAMERA(camera)); UcaUfoCameraPrivate *priv = UCA_UFO_CAMERA_GET_PRIVATE(camera); - const gsize size = SENSOR_WIDTH * SENSOR_HEIGHT * sizeof(guint16); - pcilib_event_id_t event_id; + pcilib_event_id_t event_id; pcilib_event_info_t event_info; - size_t err = 0; + pcilib_timeout_t timeout; + gdouble exposure_time; + size_t err; + + const gsize size = SENSOR_WIDTH * SENSOR_HEIGHT * sizeof(guint16); err = pcilib_trigger(priv->handle, PCILIB_EVENT0, 0, NULL); PCILIB_SET_ERROR(err, UCA_UFO_CAMERA_ERROR_TRIGGER); - err = pcilib_get_next_event(priv->handle, PCILIB_TIMEOUT_INFINITE, &event_id, sizeof(pcilib_event_info_t), &event_info); + g_object_get (G_OBJECT (camera), "exposure-time", &exposure_time, NULL); + timeout = ((pcilib_timeout_t) (exposure_time * 1000 + 50.0) * 1000); + + err = pcilib_get_next_event(priv->handle, timeout, &event_id, sizeof(pcilib_event_info_t), &event_info); PCILIB_SET_ERROR(err, UCA_UFO_CAMERA_ERROR_NEXT_EVENT); if (*data == NULL) -- cgit v1.2.3