From b0a4a1dbd0c8fb94c7b7952556fe71777723ae32 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Tue, 17 Jun 2003 00:05:28 +0000 Subject: [PATCH] Disable attempt to do unipolar postgain calibration on measurement computing pci-das1602/16 boards, since it is failing badly. --- comedi_calibrate/cal_common.c | 18 ++++++++++++------ comedi_calibrate/calib.h | 1 + comedi_calibrate/cb.c | 4 ++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/comedi_calibrate/cal_common.c b/comedi_calibrate/cal_common.c index 7f044fd..8a87777 100644 --- a/comedi_calibrate/cal_common.c +++ b/comedi_calibrate/cal_common.c @@ -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; } diff --git a/comedi_calibrate/calib.h b/comedi_calibrate/calib.h index e62294f..6e76d84 100644 --- a/comedi_calibrate/calib.h +++ b/comedi_calibrate/calib.h @@ -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, diff --git a/comedi_calibrate/cb.c b/comedi_calibrate/cb.c index 034e366..b005ef0 100644 --- a/comedi_calibrate/cb.c +++ b/comedi_calibrate/cb.c @@ -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 ); } -- 2.26.2