From 26521bed933853a430ccb086524bd5bb9d2a78ba Mon Sep 17 00:00:00 2001 From: reinelt <> Date: Wed, 22 Mar 2000 07:33:50 +0000 Subject: [lcd4linux @ 2000-03-22 07:33:50 by reinelt] FAQ added new modules 'processor.c' contains all data processing --- filter.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'filter.c') diff --git a/filter.c b/filter.c index 74ae3fd..1fbf9c2 100644 --- a/filter.c +++ b/filter.c @@ -1,4 +1,4 @@ -/* $Id: filter.c,v 1.2 2000/03/06 06:04:06 reinelt Exp $ +/* $Id: filter.c,v 1.3 2000/03/22 07:33:50 reinelt Exp $ * * smooth and damp functions * @@ -20,11 +20,15 @@ * * * $Log: filter.c,v $ + * Revision 1.3 2000/03/22 07:33:50 reinelt + * + * FAQ added + * new modules 'processor.c' contains all data processing + * * Revision 1.2 2000/03/06 06:04:06 reinelt * * minor cleanups * - * */ /* @@ -37,7 +41,6 @@ * * damp (name, value) * damps a value with exp(-t/tau) - * uses global variable "tau" * */ @@ -47,10 +50,10 @@ #include #include +#include "cfg.h" #include "filter.h" extern int tick; -extern int tau; #define SLOTS 64 #define SECONDS(x) (x.tv_sec+x.tv_usec/1000000.0) @@ -116,12 +119,16 @@ double smooth(char *name, int period, double value) double damp(char *name, double value) { + static int tau=-1; static FILTER *Filter=NULL; static int nFilter=0; struct timeval now; double max; int i, j; + if (tau==-1) + tau=atoi(cfg_get("tau")); + if (tau==0.0) return value; -- cgit v1.2.3