make unipolar gain calibration work a little better
authorFrank Mori Hess <fmhess@speakeasy.net>
Sat, 14 Jun 2003 16:04:23 +0000 (16:04 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Sat, 14 Jun 2003 16:04:23 +0000 (16:04 +0000)
comedi_calibrate/cal_common.c

index 18739c30646c9133adec05e566224d5dffff126e..7f044fd1c39464bdff562855df4cac6e93bf4bd6 100644 (file)
@@ -157,6 +157,15 @@ static void generic_do_dac_channel( calibration_setup_t *setup, const generic_la
 static void generic_do_adc_channel( calibration_setup_t *setup, const generic_layout_t *layout,
        comedi_calibration_setting_t *current_cal, unsigned int channel, unsigned int range )
 {
+       /* make sure unipolar ground observable isn't out-of-range before
+        * doing gain calibrations */
+       if( is_unipolar( setup->dev, setup->ad_subdev, channel, range ) )
+       {
+               generic_do_cal( setup, current_cal, layout->adc_ground_observable( setup, channel, range ),
+                       layout->adc_offset( channel ) );
+               generic_do_cal( setup, current_cal, layout->adc_ground_observable( setup, channel, range ),
+                       layout->adc_offset_fine( channel ) );
+       }
        generic_do_relative( setup, current_cal, layout->adc_high_observable( setup, channel, range ),
                layout->adc_ground_observable( setup, channel, range ), layout->adc_gain( channel ) );
        generic_do_cal( setup, current_cal, layout->adc_ground_observable( setup, channel, range ),