From 6d37fae4c97c8f254d5f0fe31d588af66a386f28 Mon Sep 17 00:00:00 2001
From: Frank Mori Hess <fmhess@speakeasy.net>
Date: Fri, 29 Nov 2002 21:29:04 +0000
Subject: [PATCH] 611x calibration works now

---
 comedi_calibrate/comedi_calibrate.c | 12 +++++++-----
 comedi_calibrate/ni.c               |  4 ++--
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/comedi_calibrate/comedi_calibrate.c b/comedi_calibrate/comedi_calibrate.c
index 711ad86..3c22066 100644
--- a/comedi_calibrate/comedi_calibrate.c
+++ b/comedi_calibrate/comedi_calibrate.c
@@ -267,16 +267,15 @@ void observe( calibration_setup_t *setup )
 			observable_dependence( setup, i);
 		}
 	}
-
 }
 
 int preobserve( calibration_setup_t *setup, int obs)
 {
-	int retval = 0;
+	int retval;
 	comedi_insn reference_source_config;
 	lsampl_t ref_data[ 2 ];
-	// setup reference source
 
+	// setup reference source
 	memset( &reference_source_config, 0, sizeof(reference_source_config) );
 	reference_source_config.insn = INSN_CONFIG;
 	reference_source_config.n = 2;
@@ -289,7 +288,6 @@ int preobserve( calibration_setup_t *setup, int obs)
 	/* ignore errors for now since older ni driver doesn't
 	 * support reference config insn */
 	if( retval < 0 )
-
 		perror("preobserve() ignoring reference config error" );
 	retval = 0;
 
@@ -553,14 +551,18 @@ void cal_postgain_binary( calibration_setup_t *setup, int obs1, int obs2, int da
 		}
 
 		if(verbose>=3){
+			preobserve( setup, obs1);
 			measure_observable( setup, obs1);
+			preobserve( setup, obs2);
 			measure_observable( setup, obs2);
 		}
 	}
 
 	DPRINT(0,"caldac[%d] set to %d\n",dac,x);
 	if(verbose>=3){
+		preobserve( setup, obs1);
 		measure_observable( setup, obs1);
+		preobserve( setup, obs2);
 		measure_observable( setup, obs2);
 	}
 }
@@ -714,7 +716,7 @@ double check_gain_chan_x( calibration_setup_t *setup, linear_fit_t *l,unsigned i
 	l->y_data=malloc(n*sizeof(double)/step);
 	if(l->y_data == NULL)
 	{
-		perror("comedi_calibrate");
+		perror("check_gain_chan_x");
 		exit(1);
 	}
 
diff --git a/comedi_calibrate/ni.c b/comedi_calibrate/ni.c
index 4db9f34..a470d49 100644
--- a/comedi_calibrate/ni.c
+++ b/comedi_calibrate/ni.c
@@ -88,8 +88,8 @@ static struct board_struct boards[]={
 	{ "pci-mio-16e-4",	STATUS_SOME,    cal_ni_pci_mio_16e_4,	ni_setup_observables },
 	{ "pci-6032e",		STATUS_DONE,	cal_ni_pci_6032e,	ni_setup_observables },
 	{ "DAQCard-ai-16e-4",	STATUS_DONE,	cal_ni_daqcard_ai_16e_4,	ni_setup_observables },
-	{ "pci-6110",	STATUS_SOME,	cal_ni_pci_611x,	ni_setup_observables_611x },
-	{ "pci-6111",	STATUS_SOME,	cal_ni_pci_611x,	ni_setup_observables_611x },
+	{ "pci-6110",	STATUS_DONE,	cal_ni_pci_611x,	ni_setup_observables_611x },
+	{ "pci-6111",	STATUS_DONE,	cal_ni_pci_611x,	ni_setup_observables_611x },
 #if 0
 //	{ "at-mio-16de-10",	cal_ni_unknown },
 	{ "at-mio-64e-3",	cal_ni_16e_1 },