diff options
author | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-05-31 17:44:17 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-05-31 17:44:17 +0200 |
commit | 480365d362cc427e48608f48e1966f4d77d38e52 (patch) | |
tree | 7264a418f6b5384a5e621e2dd936e81c5bc9407b /src | |
parent | b1e3aa27d505551a6e3656ecb828ac05617badaa (diff) | |
download | uca-480365d362cc427e48608f48e1966f4d77d38e52.tar.gz uca-480365d362cc427e48608f48e1966f4d77d38e52.tar.bz2 uca-480365d362cc427e48608f48e1966f4d77d38e52.tar.xz uca-480365d362cc427e48608f48e1966f4d77d38e52.zip |
Set correct ADC count
Diffstat (limited to 'src')
-rw-r--r-- | src/cameras/uca-pco-camera.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/cameras/uca-pco-camera.c b/src/cameras/uca-pco-camera.c index ad5cb77..78ee8bf 100644 --- a/src/cameras/uca-pco-camera.c +++ b/src/cameras/uca-pco-camera.c @@ -47,7 +47,7 @@ if ((err) != PCO_NOERROR) { \ g_set_error(error, UCA_PCO_CAMERA_ERROR, \ UCA_PCO_CAMERA_ERROR_LIBPCO_GENERAL,\ - "libpco error %i", err); \ + "libpco error %x", err); \ return; \ } @@ -290,6 +290,12 @@ static guint override_temperature_range(UcaPcoCameraPrivate *priv) return err; } +static void override_maximum_adcs(UcaPcoCameraPrivate *priv) +{ + GParamSpecInt *spec = (GParamSpecInt *) pco_properties[PROP_SENSOR_ADCS]; + spec->maximum = pco_get_maximum_number_of_adcs(priv->pco); +} + static gdouble convert_timebase(guint16 timebase) { switch (timebase) { @@ -384,10 +390,11 @@ UcaPcoCamera *uca_pco_camera_new(GError **error) fill_pixelrates(priv); /* - * Here we override the temperature property range because this was not - * possible at property installation time. + * Here we override property ranges because we didn't know them at property + * installation time. */ override_temperature_range(priv); + override_maximum_adcs(priv); return camera; } @@ -668,7 +675,8 @@ static void uca_pco_camera_set_property(GObject *object, guint property_id, cons case PROP_SENSOR_ADCS: { const guint num_adcs = g_value_get_uint(value); - pco_set_adc_mode(priv->pco, num_adcs); + if (pco_set_adc_mode(priv->pco, num_adcs) != PCO_NOERROR) + g_warning("Cannot set the number of ADCs per pixel\n"); } break; @@ -820,7 +828,8 @@ static void uca_pco_camera_get_property(GObject *object, guint property_id, GVal * ADCs in use. */ pco_adc_mode mode; - pco_get_adc_mode(priv->pco, &mode); + if (pco_get_adc_mode(priv->pco, &mode) != PCO_NOERROR) + g_warning("Cannot read number of ADCs per pixel"); g_value_set_uint(value, mode); } break; @@ -1094,13 +1103,6 @@ static void uca_pco_camera_class_init(UcaPcoCameraClass *klass) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READABLE); - pco_properties[PROP_SENSOR_ADCS] = - g_param_spec_uint("sensor-adcs", - "Number of ADCs to use", - "Number of ADCs to use", - 1, 2, 1, - G_PARAM_READWRITE); - pco_properties[PROP_HAS_DOUBLE_IMAGE_MODE] = g_param_spec_boolean("has-double-image-mode", "Is double image mode supported by this model", @@ -1158,6 +1160,13 @@ static void uca_pco_camera_class_init(UcaPcoCameraClass *klass) "Cooling point of the camera", "Cooling point of the camera", 0, 10, 5, G_PARAM_READWRITE); + + pco_properties[PROP_SENSOR_ADCS] = + g_param_spec_uint("sensor-adcs", + "Number of ADCs to use", + "Number of ADCs to use", + 1, 2, 1, + G_PARAM_READWRITE); for (guint id = N_BASE_PROPERTIES; id < N_PROPERTIES; id++) g_object_class_install_property(gobject_class, id, pco_properties[id]); |