From d2a9fc95d61372de52e243bfcc13b96e400f871c Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Wed, 21 May 2003 17:52:41 +0000 Subject: [PATCH] added some warning messages when binary calibrations set caldacs to max/min values --- comedi_calibrate/comedi_calibrate.c | 8 +++++++- comedi_calibrate/save_cal.c | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/comedi_calibrate/comedi_calibrate.c b/comedi_calibrate/comedi_calibrate.c index ea8b9be..61eff6c 100644 --- a/comedi_calibrate/comedi_calibrate.c +++ b/comedi_calibrate/comedi_calibrate.c @@ -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)); diff --git a/comedi_calibrate/save_cal.c b/comedi_calibrate/save_cal.c index ac472d7..3c27488 100644 --- a/comedi_calibrate/save_cal.c +++ b/comedi_calibrate/save_cal.c @@ -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 ); -- 2.26.2