diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2012-07-26 11:46:19 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-07-26 12:48:10 +0200 |
commit | 642a047ce60c9e071b9815d11ea9a81761598c9c (patch) | |
tree | 8c4dba653ddec7dad8d084a681af0b8d0c9d3baa | |
parent | 20b8ca4437ac411f5127f73a31d575c7c9494812 (diff) | |
download | uca-642a047ce60c9e071b9815d11ea9a81761598c9c.tar.gz uca-642a047ce60c9e071b9815d11ea9a81761598c9c.tar.bz2 uca-642a047ce60c9e071b9815d11ea9a81761598c9c.tar.xz uca-642a047ce60c9e071b9815d11ea9a81761598c9c.zip |
Don't confuse bit_mode with adc_resolution
-rw-r--r-- | src/cameras/uca-ufo-camera.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/cameras/uca-ufo-camera.c b/src/cameras/uca-ufo-camera.c index 06b154d..66a42c4 100644 --- a/src/cameras/uca-ufo-camera.c +++ b/src/cameras/uca-ufo-camera.c @@ -95,6 +95,7 @@ static GHashTable *ufo_property_table; /* maps from prop_id to RegisterInfo* */ struct _UcaUfoCameraPrivate { pcilib_t *handle; guint n_bits; + guint bit_mode; }; static void ignore_messages(const char *format, ...) @@ -136,7 +137,7 @@ UcaUfoCamera *uca_ufo_camera_new(GError **error) pcilib_model_description_t *model_description; pcilib_t *handle = pcilib_open("/dev/fpga0", model); guint prop = PROP_UFO_START; - guint bit_mode; + guint adc_resolution; if (handle == NULL) { g_set_error(error, UCA_UFO_CAMERA_ERROR, UCA_UFO_CAMERA_ERROR_INIT, @@ -193,9 +194,10 @@ UcaUfoCamera *uca_ufo_camera_new(GError **error) UcaUfoCamera *camera = g_object_new(UCA_TYPE_UFO_CAMERA, NULL); UcaUfoCameraPrivate *priv = UCA_UFO_CAMERA_GET_PRIVATE(camera); - bit_mode = read_register_value (handle, "bit_mode"); + priv->bit_mode = read_register_value (handle, "bit_mode"); + adc_resolution = read_register_value (handle, "adc_resolution"); - switch (bit_mode) { + switch (adc_resolution) { case 0: priv->n_bits = 10; break; @@ -351,8 +353,8 @@ uca_ufo_camera_get_property(GObject *object, guint property_id, GValue *value, G break; case PROP_SENSOR_TEMPERATURE: { - const double a = priv->n_bits == 10 ? 0.3 : 0.25; - const double b = priv->n_bits == 12 ? 1000 : 1200; + const double a = priv->bit_mode == 0 ? 0.3 : 0.25; + const double b = priv->bit_mode == 0 ? 1000 : 1200; guint32 temperature; temperature = read_register_value (priv->handle, "sensor_temperature"); |