added some warning messages when binary calibrations set caldacs to
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 21 May 2003 17:52:41 +0000 (17:52 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 21 May 2003 17:52:41 +0000 (17:52 +0000)
max/min values

comedi_calibrate/comedi_calibrate.c
comedi_calibrate/save_cal.c

index ea8b9bea0f882bb1211e2a0c434492aeec016a14..61eff6ce04fd45e5a9c32472c9cedc0e7996b61e 100644 (file)
@@ -603,6 +603,8 @@ void cal_binary( calibration_setup_t *setup, int obs, int dac)
 
        update_caldac( setup, dac, x );
        DPRINT(0,"caldac[%d] set to %d\n",dac,x);
+       if( x >= setup->caldacs[dac].maxdata || x <= 0 )
+               DPRINT(0,"WARNING: caldac[%d] pegged!\n", dac );
        if(verbose>=3){
                measure_observable( setup, obs);
        }
@@ -701,6 +703,8 @@ void cal_relative_binary( calibration_setup_t *setup, int obs1, int obs2, int da
                x = x2;
        update_caldac( setup, dac, x );
        DPRINT(0,"caldac[%d] set to %d\n",dac,x);
+       if( x >= setup->caldacs[dac].maxdata || x <= 0 )
+               DPRINT(0,"WARNING: caldac[%d] pegged!\n", dac );
        if(verbose>=3){
                preobserve( setup, obs1);
                measure_observable( setup, obs1);
@@ -821,6 +825,8 @@ void cal_linearity_binary( calibration_setup_t *setup, int obs1, int obs2, int o
                x = x2;
        update_caldac( setup, dac, x );
        DPRINT(0,"caldac[%d] set to %d\n",dac,x);
+       if( x >= setup->caldacs[dac].maxdata || x <= 0 )
+               DPRINT(0,"WARNING: caldac[%d] pegged!\n", dac );
        if(verbose>=3){
                preobserve( setup, obs1);
                measure_observable( setup, obs1);
@@ -843,7 +849,7 @@ void chan_cal(int adc,int cdac,int range,double target)
        check_gain_chan_x(&l,CR_PACK(adc,range,AREF_OTHER),cdac);
        offset=linear_fit_func_y(&l,caldacs[cdac].current);
        gain=l.slope;
-       
+
        a=caldacs[cdac].current+(target-offset)/gain;
 
        update_caldac( setup, cdac, rint(a));
index ac472d7944ea3adf5aab6188c99d537b1d1ba459..3c2748856b0356b181623138075b9269e159c488 100644 (file)
@@ -130,6 +130,7 @@ int write_calibration_file( calibration_setup_t *setup )
                return -1;
        }
 
+       DPRINT( 0, "writing calibration to %s\n", setup->cal_save_file_path );
        retval = write_calibration_perl_hash( file, setup->new_calibration );
 
        fclose( file );