From 124c5be21330e82fe023956eea7ea5c2e5f04e3c Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Mon, 30 Mar 2015 17:11:22 +0200 Subject: Revert "ufo: fix readout timeouts ..." This reverts commit 378770200967f6e5b10152c9b094b835b4216c92. --- plugins/ufo/uca-ufo-camera.c | 51 ++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 28 deletions(-) (limited to 'plugins/ufo/uca-ufo-camera.c') diff --git a/plugins/ufo/uca-ufo-camera.c b/plugins/ufo/uca-ufo-camera.c index 5c20517..53cb160 100644 --- a/plugins/ufo/uca-ufo-camera.c +++ b/plugins/ufo/uca-ufo-camera.c @@ -163,33 +163,6 @@ event_callback(pcilib_event_id_t event_id, pcilib_event_info_t *info, void *user return PCILIB_STREAMING_CONTINUE; } -static gdouble -total_readout_time (UcaUfoCamera *camera) -{ - gdouble clock_period_ns; - gdouble exposure_time; - gdouble readout_time; - gdouble overhead_time; - guint output_mode; - guint roi_height; - guint num_outputs; - - g_object_get (G_OBJECT (camera), - "exposure-time", &exposure_time, - "ufo-cmosis-output-mode", &output_mode, - "roi-height", &roi_height, - NULL); - - num_outputs = camera->priv->n_bits == 10 ? 16 : 4; /* what about 11? */ - clock_period_ns = camera->priv->frequency == FPGA_40MHZ ? 1 / 40.0 * 1000 : 1 / 48.0 * 1000; - exposure_time *= 1000 * 1000; /* convert to nanoseconds */ - - readout_time = (129 * clock_period_ns * 16 / num_outputs) * roi_height; - overhead_time = (7 /* reg73 */ + 2 * (16 / num_outputs)) * 129 * clock_period_ns; - - return exposure_time + (overhead_time + readout_time) / 1000 / 1000; -} - static guint update_properties (UcaUfoCameraPrivate *priv) { @@ -352,7 +325,7 @@ uca_ufo_camera_start_recording(UcaCamera *camera, GError **error) set_streaming (priv, trigger == UCA_CAMERA_TRIGGER_AUTO); - priv->timeout = (pcilib_timeout_t) (total_readout_time (UCA_UFO_CAMERA (camera)) * 1000 * 1000); + priv->timeout = ((pcilib_timeout_t) (exposure_time * 1000 + 50.0) * 1000); if (transfer_async) priv->async_thread = g_thread_create ((GThreadFunc) stream_async, camera, TRUE, error); @@ -445,6 +418,28 @@ uca_ufo_camera_trigger (UcaCamera *camera, GError **error) PCILIB_SET_ERROR (err, UCA_UFO_CAMERA_ERROR_TRIGGER); } +static gdouble +total_readout_time (UcaUfoCamera *camera) +{ + gdouble clock_period, foo; + gdouble exposure_time, image_readout_time, overhead_time; + guint output_mode; + guint roi_height; + + g_object_get (G_OBJECT (camera), + "exposure-time", &exposure_time, + "ufo-cmosis-output-mode", &output_mode, + "roi-height", &roi_height, + NULL); + + clock_period = camera->priv->frequency == FPGA_40MHZ ? 1 / 40.0 : 1 / 48.0; + foo = pow (2, output_mode); + image_readout_time = (129 * clock_period * foo) * roi_height; + overhead_time = (10 /* reg73 */ + 2 * foo) * 129 * clock_period; + + return exposure_time + (overhead_time + image_readout_time) / 1000 / 1000; +} + static void uca_ufo_camera_set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { -- cgit v1.2.3