diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2015-03-27 10:10:22 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2015-03-27 10:10:22 +0100 |
commit | 378770200967f6e5b10152c9b094b835b4216c92 (patch) | |
tree | 0ef6d7f4394a043287b5dcb26100e5cb4426f560 /plugins/ufo | |
parent | c24491c2c916220648802e5e711e923c7685ee9d (diff) | |
download | uca-378770200967f6e5b10152c9b094b835b4216c92.tar.gz uca-378770200967f6e5b10152c9b094b835b4216c92.tar.bz2 uca-378770200967f6e5b10152c9b094b835b4216c92.tar.xz uca-378770200967f6e5b10152c9b094b835b4216c92.zip |
ufo: fix readout timeouts ...
Diffstat (limited to 'plugins/ufo')
-rw-r--r-- | plugins/ufo/uca-ufo-camera.c | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/plugins/ufo/uca-ufo-camera.c b/plugins/ufo/uca-ufo-camera.c index bfcc184..e92e184 100644 --- a/plugins/ufo/uca-ufo-camera.c +++ b/plugins/ufo/uca-ufo-camera.c @@ -163,6 +163,33 @@ 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) { @@ -319,7 +346,7 @@ uca_ufo_camera_start_recording(UcaCamera *camera, GError **error) if (trigger == UCA_CAMERA_TRIGGER_AUTO) set_streaming (priv, TRUE); - priv->timeout = ((pcilib_timeout_t) (exposure_time * 1000 + 50.0) * 1000); + priv->timeout = (pcilib_timeout_t) (total_readout_time (UCA_UFO_CAMERA (camera)) * 1000 * 1000); if (transfer_async) priv->async_thread = g_thread_create ((GThreadFunc) stream_async, camera, TRUE, error); @@ -414,28 +441,6 @@ uca_ufo_camera_trigger (UcaCamera *camera, GError **error) pcilib_trigger (priv->handle, PCILIB_EVENT0, 0, NULL); } -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) { |