diff FXAnalyse.c @ 246:d6a37eca6d92

Fix errors in previous commit
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Fri, 27 Feb 2015 10:52:11 +0100
parents b1dc2ba9a315
children eaac96094640
line wrap: on
line diff
--- a/FXAnalyse.c	Thu Feb 26 23:11:01 2015 +0100
+++ b/FXAnalyse.c	Fri Feb 27 10:52:11 2015 +0100
@@ -380,11 +380,11 @@
 	.fDDS = 70e6,
 	.applied = 0.0,
 	.interval = 30.0,
-	.t0 = 0.0
-	.threshold = 10.0,
+	.t0 = 0.0,
+	.threshold = 20.0, // corresponding to a relative frequnecy stability of ~1e-13
 	.badcount = 0,
+	.badcountmax = 10,
 	.safety = TRUE,
-	.badcountmax = 10,
 };
 
 
@@ -428,10 +428,10 @@
 // one. If the data point is accepted `count` is reset to zero.
 int stat_accumulate_resilient(struct stat *stat, double v, double threshold, int *count)
 {
-	if ((! isnan(stat.previous) && (fabs(v - stat->previous) > threshold)) {
+	if (!isnan(stat->previous) && (fabs(v - stat->previous) > threshold)) {
 		// bad data point
 		stat_accumulate(stat, stat->previous);
-		*count++;
+		*count += 1;
 		return TRUE;
 	} else {
 		// good data point
@@ -454,9 +454,9 @@
 		logmsg("dedrift: bad data point detected");
 		
 		// too many consecutive bad data points detected
-		if ((dedrift.safety) && (dedrift.badcount > &dedrift.badcountmax)) {
+		if (dedrift.safety && (dedrift.badcount > dedrift.badcountmax)) {
+			logmsg("dedrift: maximum number of consecutive bad data points exceeded");
 			dedrift_update_disable();
-			logmsg("dedrift: maximum number of consecutive bad data points exceeded");
 		}
 	}
 
@@ -2035,7 +2035,6 @@
 int  CVICALLBACK CB_OnStopSlopeCancellingOnUnlocked (int panel, int control, int event, 
 		 void *callbackData, int eventData1, int eventData2)
 {
-	int value;
 	switch (event)
 	{
 		case EVENT_COMMIT: