Disable attempt to do unipolar postgain calibration on measurement computing
authorFrank Mori Hess <fmhess@speakeasy.net>
Tue, 17 Jun 2003 00:05:28 +0000 (00:05 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Tue, 17 Jun 2003 00:05:28 +0000 (00:05 +0000)
pci-das1602/16 boards, since it is failing badly.

comedi_calibrate/cal_common.c
comedi_calibrate/calib.h
comedi_calibrate/cb.c

index 7f044fd1c39464bdff562855df4cac6e93bf4bd6..8a8777734875ae533c11f0f9ac7a59e5e0477250 100644 (file)
@@ -259,8 +259,11 @@ int generic_cal_by_channel_and_range( calibration_setup_t *setup,
                                        sc_push_range( current_cal, range );
                        postgain_bip = setup->caldacs[ layout->adc_postgain_offset( channel ) ].current;
                        /* unipolar postgain */
-                       current_cal = sc_alloc_calibration_setting( setup );
-                       generic_do_adc_postgain_offset( setup, layout, current_cal, channel, 1 );
+                       if( layout->do_adc_unipolar_postgain )
+                       {
+                               current_cal = sc_alloc_calibration_setting( setup );
+                               generic_do_adc_postgain_offset( setup, layout, current_cal, channel, 1 );
+                       }
                        for( range = 0; range < num_ai_ranges; range++ )
                                if( is_unipolar( setup->dev, setup->ad_subdev, channel, range ) )
                                        sc_push_range( current_cal, range );
@@ -329,11 +332,13 @@ int generic_cal_by_range( calibration_setup_t *setup,
                        if( is_bipolar( setup->dev, setup->ad_subdev, 0, range ) )
                                sc_push_range( current_cal, range );
                postgain_bip = setup->caldacs[ layout->adc_postgain_offset( 0 ) ].current;
-
                /* unipolar postgain */
-               current_cal = sc_alloc_calibration_setting( setup );
-               generic_do_adc_postgain_offset( setup, layout, current_cal, 0, 1 );
-               sc_push_channel( current_cal, SC_ALL_CHANNELS );
+               if( layout->do_adc_unipolar_postgain )
+               {
+                       current_cal = sc_alloc_calibration_setting( setup );
+                       generic_do_adc_postgain_offset( setup, layout, current_cal, 0, 1 );
+                       sc_push_channel( current_cal, SC_ALL_CHANNELS );
+               }
                for( range = 0; range < num_ai_ranges; range++ )
                        if( is_unipolar( setup->dev, setup->ad_subdev, 0, range ) )
                                sc_push_range( current_cal, range );
@@ -390,4 +395,5 @@ void init_generic_layout( generic_layout_t *layout )
        layout->adc_ground_observable = dummy_observable;
        layout->dac_high_observable = dummy_observable;
        layout->dac_ground_observable = dummy_observable;
+       layout->do_adc_unipolar_postgain = 1;
 }
index e62294f49ff89c76b4c3a38f2f0f6fd90684b2dd..6e76d84932ad3295c806c1bb466d65fe34156253 100644 (file)
@@ -251,6 +251,7 @@ typedef struct
                unsigned int channel, unsigned int range );
        int (*dac_ground_observable)( const calibration_setup_t *setup,
                unsigned int channel, unsigned int range );
+       unsigned do_adc_unipolar_postgain : 1;
 } generic_layout_t;
 void init_generic_layout( generic_layout_t *layout );
 int generic_cal_by_channel_and_range( calibration_setup_t *setup,
index 034e3664b8f65798aa8dfafeb5b4a63ff65bfd5b..b005ef01cc108e25bd74c35e7ce4a2d53adcb800 100644 (file)
@@ -489,6 +489,10 @@ static int cal_cb_pci_1602_16( calibration_setup_t *setup )
        layout.adc_ground_observable = ai_ground_observable_1xxx;
        layout.dac_high_observable = ao_high_observable_1xxx;
        layout.dac_ground_observable = ao_ground_observable_1xxx;
+       /* On unipolar ranges, both the gain and offset adjustments couple
+        * to the ground observables. I don't know if there is a way
+        * to get around it, so we'll just use the bipolar postgain setting. */
+       layout.do_adc_unipolar_postgain = 0;
        return generic_cal_by_range( setup, &layout );
 }