diff options
-rw-r--r-- | plugins/ufo/uca-ufo-camera.c | 37 | ||||
-rw-r--r-- | src/uca-camera.c | 8 |
2 files changed, 24 insertions, 21 deletions
diff --git a/plugins/ufo/uca-ufo-camera.c b/plugins/ufo/uca-ufo-camera.c index d0b7d59..c989b94 100644 --- a/plugins/ufo/uca-ufo-camera.c +++ b/plugins/ufo/uca-ufo-camera.c @@ -94,7 +94,6 @@ static gint base_overrideables[] = { PROP_ROI_HEIGHT_MULTIPLIER, PROP_HAS_STREAMING, PROP_HAS_CAMRAM_RECORDING, - PROP_TRIGGER_MODE, 0, }; @@ -118,7 +117,6 @@ struct _UcaUfoCameraPrivate { FPGA_48MHZ = 0, FPGA_40MHZ } frequency; - UcaCameraTrigger trigger; }; static void @@ -287,26 +285,27 @@ static void uca_ufo_camera_start_recording(UcaCamera *camera, GError **error) { UcaUfoCameraPrivate *priv; + UcaCameraTrigger trigger; gdouble exposure_time; - int err; + gboolean transfer_async; + int err; g_return_if_fail(UCA_IS_UFO_CAMERA(camera)); priv = UCA_UFO_CAMERA_GET_PRIVATE(camera); - if (priv->trigger == UCA_CAMERA_TRIGGER_AUTO) - set_streaming (priv, TRUE); - - err = pcilib_start(priv->handle, PCILIB_EVENT_DATA, PCILIB_EVENT_FLAGS_DEFAULT); - PCILIB_SET_ERROR(err, UCA_UFO_CAMERA_ERROR_START_RECORDING); - - gboolean transfer_async = FALSE; g_object_get (G_OBJECT(camera), "transfer-asynchronously", &transfer_async, "exposure-time", &exposure_time, - "trigger-mode", &priv->trigger, + "trigger-mode", &trigger, NULL); + if (trigger == UCA_CAMERA_TRIGGER_AUTO) + set_streaming (priv, TRUE); + + err = pcilib_start(priv->handle, PCILIB_EVENT_DATA, PCILIB_EVENT_FLAGS_DEFAULT); + PCILIB_SET_ERROR(err, UCA_UFO_CAMERA_ERROR_START_RECORDING); + priv->timeout = ((pcilib_timeout_t) (exposure_time * 1000 + 50.0) * 1000); if (transfer_async) @@ -316,8 +315,13 @@ uca_ufo_camera_start_recording(UcaCamera *camera, GError **error) static void uca_ufo_camera_stop_recording(UcaCamera *camera, GError **error) { + UcaUfoCameraPrivate *priv; + UcaCameraTrigger trigger; g_return_if_fail(UCA_IS_UFO_CAMERA(camera)); - UcaUfoCameraPrivate *priv = UCA_UFO_CAMERA_GET_PRIVATE(camera); + + priv = UCA_UFO_CAMERA_GET_PRIVATE(camera); + + g_object_get (G_OBJECT (camera), "trigger-mode", &trigger, NULL); if (priv->async_thread) { int err = pcilib_stop(priv->handle, PCILIB_EVENT_FLAG_STOP_ONLY); @@ -329,7 +333,7 @@ uca_ufo_camera_stop_recording(UcaCamera *camera, GError **error) int err = pcilib_stop (priv->handle, PCILIB_EVENT_FLAGS_DEFAULT); PCILIB_SET_ERROR(err, UCA_UFO_CAMERA_ERROR_STOP_RECORDING); - if (priv->trigger == UCA_CAMERA_TRIGGER_AUTO) + if (trigger == UCA_CAMERA_TRIGGER_AUTO) set_streaming (priv, FALSE); } @@ -417,10 +421,6 @@ uca_ufo_camera_set_property(GObject *object, guint property_id, const GValue *va g_debug("ROI feature not implemented yet"); break; - case PROP_TRIGGER_MODE: - priv->trigger = g_value_get_enum (value); - break; - default: { RegisterInfo *reg_info; @@ -521,9 +521,6 @@ uca_ufo_camera_get_property(GObject *object, guint property_id, GValue *value, G case PROP_NAME: g_value_set_string(value, "Ufo Camera w/ CMOSIS CMV2000"); break; - case PROP_TRIGGER_MODE: - g_value_set_enum (value, priv->trigger); - break; default: { RegisterInfo *reg_info = g_hash_table_lookup (priv->property_table, GINT_TO_POINTER (property_id)); diff --git a/src/uca-camera.c b/src/uca-camera.c index ec4b418..5073a57 100644 --- a/src/uca-camera.c +++ b/src/uca-camera.c @@ -116,6 +116,7 @@ struct _UcaCameraPrivate { gboolean is_recording; gboolean is_readout; gboolean transfer_async; + UcaCameraTrigger trigger; }; static void @@ -148,6 +149,10 @@ uca_camera_set_property (GObject *object, guint property_id, const GValue *value } break; + case PROP_TRIGGER_MODE: + priv->trigger = g_value_get_enum (value); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); } @@ -172,7 +177,7 @@ uca_camera_get_property(GObject *object, guint property_id, GValue *value, GPara break; case PROP_TRIGGER_MODE: - g_value_set_enum (value, UCA_CAMERA_TRIGGER_AUTO); + g_value_set_enum (value, priv->trigger); break; case PROP_FRAMES_PER_SECOND: @@ -403,6 +408,7 @@ uca_camera_init (UcaCamera *camera) camera->priv->is_recording = FALSE; camera->priv->is_readout = FALSE; camera->priv->transfer_async = FALSE; + camera->priv->trigger = UCA_CAMERA_TRIGGER_AUTO; uca_camera_set_property_unit (camera_properties[PROP_SENSOR_WIDTH], UCA_UNIT_PIXEL); uca_camera_set_property_unit (camera_properties[PROP_SENSOR_HEIGHT], UCA_UNIT_PIXEL); |