fixed catching of unknown board name with NI drivers, fixed board name
authorFrank Mori Hess <fmhess@speakeasy.net>
Sat, 26 Apr 2003 16:23:04 +0000 (16:23 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Sat, 26 Apr 2003 16:23:04 +0000 (16:23 +0000)
of daqcard-6062E, added dummy daqcard-6064E, changed some cb boards
to use my favorite cal_binary().

comedi_calibrate/cb.c
comedi_calibrate/cb64.c
comedi_calibrate/comedi_calibrate.c
comedi_calibrate/ni.c

index 48bfd85e1f6294fcc8f01cb0e30e9543621bfa5f..faa81dfc69f6a613c6586d57bb44169bfbffca35 100644 (file)
@@ -700,7 +700,7 @@ static int cal_cb_pci_1xxx( calibration_setup_t *setup )
                current_cal++;
        }
 
-       if( setup->da_subdev >= 0 )
+       if( setup->da_subdev >= 0 && setup->do_output)
        {
                for( range = 0; range < num_ao_ranges; range++ )
                {
@@ -752,24 +752,19 @@ static int cal_cb_pci_1001( calibration_setup_t *setup )
                ADC_GAIN,
        };
 
-       cal1( setup, OBS_0V_RANGE_10V_BIP_1XXX, ADC_OFFSET_COARSE );
-       cal1_fine( setup, OBS_0V_RANGE_10V_BIP_1XXX, ADC_OFFSET_COARSE );
-
-       cal1( setup, OBS_0V_RANGE_10V_BIP_1XXX, ADC_OFFSET_FINE );
-       cal1_fine( setup, OBS_0V_RANGE_10V_BIP_1XXX, ADC_OFFSET_FINE );
-
-       cal1( setup, OBS_7V_RANGE_10V_BIP_1XXX, ADC_GAIN );
-       cal1_fine( setup, OBS_7V_RANGE_10V_BIP_1XXX, ADC_GAIN );
+       cal_binary( setup, OBS_0V_RANGE_10V_BIP_1XXX, ADC_OFFSET_COARSE );
+       cal_binary( setup, OBS_0V_RANGE_10V_BIP_1XXX, ADC_OFFSET_FINE );
+       cal_binary( setup, OBS_7V_RANGE_10V_BIP_1XXX, ADC_GAIN );
 
-       if( setup->da_subdev >= 0 )
+       if( setup->da_subdev >= 0 && setup->do_output )
        {
-               cal1( setup, OBS_DAC0_GROUND_1XXX, DAC0_OFFSET );
-               cal1( setup, OBS_DAC0_HIGH_1XXX, DAC0_GAIN_COARSE );
-               cal1( setup, OBS_DAC0_HIGH_1XXX, DAC0_GAIN_FINE );
+               cal_binary( setup, OBS_DAC0_GROUND_1XXX, DAC0_OFFSET );
+               cal_binary( setup, OBS_DAC0_HIGH_1XXX, DAC0_GAIN_COARSE );
+               cal_binary( setup, OBS_DAC0_HIGH_1XXX, DAC0_GAIN_FINE );
 
-               cal1( setup, OBS_DAC1_GROUND_1XXX, DAC1_OFFSET );
-               cal1( setup, OBS_DAC1_HIGH_1XXX, DAC1_GAIN_COARSE );
-               cal1( setup, OBS_DAC1_HIGH_1XXX, DAC1_GAIN_FINE );
+               cal_binary( setup, OBS_DAC1_GROUND_1XXX, DAC1_OFFSET );
+               cal_binary( setup, OBS_DAC1_HIGH_1XXX, DAC1_GAIN_COARSE );
+               cal_binary( setup, OBS_DAC1_HIGH_1XXX, DAC1_GAIN_FINE );
        }
 
        return 0;
@@ -792,14 +787,9 @@ static int cal_cb_pci_1602_16( calibration_setup_t *setup )
                ADC_PREGAIN_OFFSET,
        };
 
-       cal1( setup, OBS_0V_RANGE_10V_BIP_1602_16, ADC_PREGAIN_OFFSET );
-       cal1_fine( setup, OBS_0V_RANGE_10V_BIP_1602_16, ADC_PREGAIN_OFFSET );
-
-       cal1( setup, OBS_0V_RANGE_10V_BIP_1602_16, ADC_POSTGAIN_OFFSET );
-       cal1_fine( setup, OBS_0V_RANGE_10V_BIP_1602_16, ADC_POSTGAIN_OFFSET );
-
-       cal1( setup, OBS_7V_RANGE_10V_BIP_1602_16, ADC_GAIN );
-       cal1_fine( setup, OBS_7V_RANGE_10V_BIP_1602_16, ADC_GAIN );
+       cal_binary( setup, OBS_0V_RANGE_10V_BIP_1602_16, ADC_PREGAIN_OFFSET );
+       cal_binary( setup, OBS_0V_RANGE_10V_BIP_1602_16, ADC_POSTGAIN_OFFSET );
+       cal_binary( setup, OBS_7V_RANGE_10V_BIP_1602_16, ADC_GAIN );
 
        return 0;
 }
index b741dfac1afa7a433e8f6b89d1fe920d33efff58..d7948f77d2b75aead2ce1a140782cbf89524df6e 100644 (file)
@@ -834,7 +834,7 @@ static int cal_cb_pci_64xx( calibration_setup_t *setup )
 
        update_caldac( setup, ADC_OFFSET_64XX, adc_offset_for_ao );
        update_caldac( setup, ADC_GAIN_64XX, adc_gain_for_ao );
-       for( i = 0; i < num_ao_ranges ; i++ )
+       for( i = 0; i < num_ao_ranges && setup->do_output; i++ )
        {
                prep_dac_caldacs_64xx( setup, 0, i );
 
@@ -999,7 +999,7 @@ static int cal_cb_pci_60xx( calibration_setup_t *setup )
        update_caldac( setup, ADC_OFFSET_COARSE_60XX, adc_offset_coarse_for_ao );
        update_caldac( setup, ADC_GAIN_FINE_60XX, adc_gain_fine_for_ao );
        update_caldac( setup, ADC_GAIN_COARSE_60XX, adc_gain_coarse_for_ao );
-       for( i = 0; i < num_ao_ranges ; i++ )
+       for( i = 0; i < num_ao_ranges && setup->do_output; i++ )
        {
                prep_dac_caldacs_60xx( setup, 0, i );
 
index 2612b60a14a10b5999f24c3131a9703ac3bb2984..db651ff7314240ba4b40ab3475a0252fd3d6f96e 100644 (file)
@@ -2,9 +2,6 @@
    A little auto-calibration utility, for boards
    that support it.
 
-   Right now, it only supports NI E series boards,
-   but it should be easily portable.
-
    A few things need improvement here:
     - current system gets "close", but doesn't
       do any fine-tuning
@@ -267,10 +264,11 @@ void set_target( calibration_setup_t *setup, int obs,double target)
                setup->observables[obs].preobserve_insn.subdev,
                CR_CHAN( setup->observables[obs].preobserve_insn.chanspec ),
                CR_RANGE( setup->observables[obs].preobserve_insn.chanspec ));
+       assert( range );
        maxdata = comedi_get_maxdata( setup->dev,
                setup->observables[obs].preobserve_insn.subdev,
                CR_CHAN(setup->observables[obs].preobserve_insn.chanspec));
-
+       assert( maxdata > 0 );
        data = comedi_from_phys(target,range,maxdata);
 
        setup->observables[obs].preobserve_data[0] = data;
index 55082cef1a29ced6380dfd82fef473be356bbf70..0f725864cb0cbc7cee59a0f138ce5482df3ad142 100644 (file)
@@ -103,7 +103,8 @@ static struct board_struct boards[]={
        { "DAQCard-ai-16e-4",   STATUS_DONE,    cal_ni_daqcard_ai_16e_4,        ni_setup_observables },
        { "pci-6110",   STATUS_DONE,    cal_ni_pci_611x,        ni_setup_observables_611x },
        { "pci-6111",   STATUS_DONE,    cal_ni_pci_611x,        ni_setup_observables_611x },
-       { "DAQCard-6062e", STATUS_SOME, cal_ni_daqcard_6062e, ni_setup_observables },
+       { "DAQCard-6062E", STATUS_SOME, cal_ni_daqcard_6062e, ni_setup_observables },
+       { "DAQCard-6024E",      STATUS_UNKNOWN, NULL, ni_setup_observables },
 #if 0
 //     { "at-mio-16de-10",     cal_ni_unknown },
        { "at-mio-64e-3",       cal_ni_16e_1 },
@@ -120,7 +121,6 @@ static struct board_struct boards[]={
 //     { "pci-6713",           cal_ni_unknown },
 //     { "pxi-6070e",          cal_ni_unknown },
 //     { "pxi-6052e",          cal_ni_unknown },
-//     { "DAQCard-6024e",      cal_ni_unknown },
 #endif
 };
 #define n_boards (sizeof(boards)/sizeof(boards[0]))
@@ -162,7 +162,10 @@ enum reference_sources {
 
 int ni_setup( calibration_setup_t *setup , const char *device_name )
 {
-       ni_setup_board( setup, device_name );
+       int retval;
+
+       retval = ni_setup_board( setup, device_name );
+       if( retval < 0 ) return retval;
        setup_caldacs( setup, setup->caldac_subdev );
 
        return 0;