aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/system.c b/system.c
index d62f871..a7fc947 100644
--- a/system.c
+++ b/system.c
@@ -1,4 +1,4 @@
-/* $Id: system.c,v 1.24 2001/08/05 17:13:29 reinelt Exp $
+/* $Id: system.c,v 1.25 2002/12/05 19:12:47 reinelt Exp $
*
* system status retreivement
*
@@ -20,6 +20,9 @@
*
*
* $Log: system.c,v $
+ * Revision 1.25 2002/12/05 19:12:47 reinelt
+ * sensors factor and offset patch from Petri Damsten <petri.damsten@raketti.net>
+ *
* Revision 1.24 2001/08/05 17:13:29 reinelt
*
* cleaned up inlude of sys/time.h and time.h
@@ -743,6 +746,8 @@ int Sensor (int index, double *val, double *min, double *max)
static double val_buf[SENSORS+1]={0.0,};
static double min_buf[SENSORS+1]={0.0,};
static double max_buf[SENSORS+1]={0.0,};
+ static double factor_buf[SENSORS+1]={0.0,};
+ static double offset_buf[SENSORS+1]={0.0,};
static time_t now[SENSORS+1]={0,};
if (index<0 || index>SENSORS) return -1;
@@ -772,7 +777,13 @@ int Sensor (int index, double *val, double *min, double *max)
snprintf(buffer, 32, "Sensor%d_max", index);
max_buf[index]=atof(cfg_get(buffer)?:"100");
*max=max_buf[index];
-
+
+ snprintf(buffer, 32, "Sensor%d_factor", index);
+ factor_buf[index]=atof(cfg_get(buffer)?:"1");
+
+ snprintf(buffer, 32, "Sensor%d_offset", index);
+ offset_buf[index]=atof(cfg_get(buffer)?:"0");
+
fd[index]=open(sensor[index], O_RDONLY);
if (fd[index]==-1) {
error ("open(%s) failed: %s", sensor[index], strerror(errno));
@@ -798,7 +809,8 @@ int Sensor (int index, double *val, double *min, double *max)
fd[index]=-1;
return -1;
}
-
+ value *= factor_buf[index];
+ value += offset_buf[index];
val_buf[index]=value;
*val=value;
return 0;
bject'>Release 0+git20141218.b46a22c-1debian/0+git20141218.b46a22c-1Jonathan McCrohan1-2/+2 2014-12-28Updated AU DVB-T files; Thanks Brian Burch! (Closes LP: #1393280)Jonathan McCrohan1-0/+1 2014-12-28New Upstream Snapshot (commit b46a22c)Jonathan McCrohan1-0/+6 2014-12-28Imported Upstream version 0+git20141218.b46a22cupstream/0+git20141218.b46a22cJonathan McCrohan535-639/+317 2014-10-20Release 0+git20141009.d26b627-1debian/0+git20141009.d26b627-1Jonathan McCrohan1-2/+2 2014-10-20Fix up packaging to account for move to DVBv5Jonathan McCrohan2-2/+6 2014-10-20delete d/dtv-scan-files.install; Upstream now supplies a MakefileJonathan McCrohan2-4/+1 2014-10-15d/control: update Standards Version to 3.9.6Jonathan McCrohan2-1/+3 2014-10-15d/control: add Build-Depends on dvb-toolsJonathan McCrohan2-1/+2 2014-10-15New Upstream Snapshot (commit d26b627)Jonathan McCrohan1-0/+10 2014-10-15Imported Upstream version 0+git20141009.d26b627upstream/0+git20141009.d26b627Jonathan McCrohan2010-11120/+159271 2014-07-23Release 0+git20140611.14bd6c7-1debian/0+git20140611.14bd6c7-1Jonathan McCrohan1-2/+2 2014-07-23New Upstream Snapshot (commit 14bd6c7)Jonathan McCrohan1-2/+3 2014-07-23Imported Upstream version 0+git20140611.14bd6c7upstream/0+git20140611.14bd6c7Jonathan McCrohan7-11/+60 2014-05-13New Upstream Snapshot (commit 1246b27)Jonathan McCrohan1-0/+6 2014-05-13Imported Upstream version 0+git20140512.1246b27upstream/0+git20140512.1246b27Jonathan McCrohan391-301/+3983 2014-04-05Release 0+git20140326.cfc2975-1debian/0+git20140326.cfc2975-1Jonathan McCrohan1-2/+2 2014-04-05d/control: update Homepage (upstream has moved from Gitweb to cgit)Jonathan McCrohan2-1/+2 2014-04-05New Upstream Snapshot (commit cfc2975)Jonathan McCrohan1-0/+6 2014-04-05Imported Upstream version 0+git20140326.cfc2975upstream/0+git20140326.cfc2975Jonathan McCrohan118-656/+877 2014-01-16Release 0+git20140107.1850cf8-1debian/0+git20140107.1850cf8-1Jonathan McCrohan1-2/+2 2014-01-16Update Standards Version to 3.9.5Jonathan McCrohan2-1/+9 No changes required