diff options
-rw-r--r-- | exec.c | 8 | ||||
-rw-r--r-- | lcd4linux.conf.sample | 17 | ||||
-rw-r--r-- | mail.c | 8 | ||||
-rw-r--r-- | parser.c | 8 | ||||
-rw-r--r-- | processor.c | 16 | ||||
-rw-r--r-- | system.c | 22 |
6 files changed, 50 insertions, 29 deletions
@@ -1,4 +1,4 @@ -/* $Id: exec.c,v 1.4 2001/03/09 14:24:49 ltoetsch Exp $ +/* $Id: exec.c,v 1.5 2001/03/13 08:34:15 reinelt Exp $ * * exec ('x*') functions * @@ -20,6 +20,10 @@ * * * $Log: exec.c,v $ + * Revision 1.5 2001/03/13 08:34:15 reinelt + * + * corrected a off-by-one bug with sensors + * * Revision 1.4 2001/03/09 14:24:49 ltoetsch * exec: Scale_x ->Min/Max_x * @@ -67,7 +71,7 @@ int Exec(int index, char buff[EXEC_TXT_LEN], double *val) size_t len; int i; - if (index < 1 || index > EXECS) + if (index < 0 || index > EXECS) return -1; if (errs[index]) return -1; diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample index ec8d857..6724650 100644 --- a/lcd4linux.conf.sample +++ b/lcd4linux.conf.sample @@ -1,12 +1,12 @@ -#Display LCD2041 -#Port /dev/ttyS2 -#Speed 19200 -#Contrast 160 +Display LCD2041 +Port /dev/ttyS2 +Speed 19200 +Contrast 160 -Display HD44780 -Port 0x278 -Size 24x2 -Delay 503 +#Display HD44780 +#Port 0x278 +#Size 24x2 +#Delay 503 #Display BLC100x #Port /dev/ttyS2 @@ -118,3 +118,4 @@ Sensor2_max 50 Sensor3 /proc/sys/dev/sensors/as99127f-i2c-0-2d/temp3 Sensor3_min 30 Sensor3_max 50 + @@ -1,4 +1,4 @@ -/* $Id: mail.c,v 1.4 2001/03/08 09:02:04 reinelt Exp $ +/* $Id: mail.c,v 1.5 2001/03/13 08:34:15 reinelt Exp $ * * email specific functions * @@ -20,6 +20,10 @@ * * * $Log: mail.c,v $ + * Revision 1.5 2001/03/13 08:34:15 reinelt + * + * corrected a off-by-one bug with sensors + * * Revision 1.4 2001/03/08 09:02:04 reinelt * * seti client cleanup @@ -83,7 +87,7 @@ int Mail (int index, int *num) char *txt; char txt1[100]; - if (index<1 || index>MAILBOXES) return -1; + if (index<0 || index>MAILBOXES) return -1; if (time(NULL)==now[index]) return 0; // More then 1 second after last check time(&now[index]); // for Mailbox #index @@ -1,4 +1,4 @@ -/* $Id: parser.c,v 1.13 2001/03/08 15:25:38 ltoetsch Exp $ +/* $Id: parser.c,v 1.14 2001/03/13 08:34:15 reinelt Exp $ * * row definition parser * @@ -20,6 +20,10 @@ * * * $Log: parser.c,v $ + * Revision 1.14 2001/03/13 08:34:15 reinelt + * + * corrected a off-by-one bug with sensors + * * Revision 1.13 2001/03/08 15:25:38 ltoetsch * improved exec * @@ -192,7 +196,7 @@ static int get_token (char *s, char **p, int bar, int usage[]) return -1; } c=*(s+l-1); - if (strncmp(Symtab[i].symbol, s, l-1)==0 && c>='1' && c<='9') { + if (strncmp(Symtab[i].symbol, s, l-1)==0 && c>='0' && c<='9') { *p=s+l; usage[Symtab[i].token]|=(1<<(c-'0')); usage[Symtab[i].class]=1; diff --git a/processor.c b/processor.c index 173412f..8676747 100644 --- a/processor.c +++ b/processor.c @@ -1,4 +1,4 @@ -/* $Id: processor.c,v 1.18 2001/03/08 15:25:38 ltoetsch Exp $ +/* $Id: processor.c,v 1.19 2001/03/13 08:34:15 reinelt Exp $ * * main data processing * @@ -20,6 +20,10 @@ * * * $Log: processor.c,v $ + * Revision 1.19 2001/03/13 08:34:15 reinelt + * + * corrected a off-by-one bug with sensors + * * Revision 1.18 2001/03/08 15:25:38 ltoetsch * improved exec * @@ -148,8 +152,8 @@ struct { int usage, in, out, total, max, peak; } isdn; struct { int rx, tx, total, max, peak; } ppp; struct { int perc, stat; double dur; } batt; struct { double perc, cput; } seti; -struct { int num; } mail[MAILBOXES]; -struct { double val, min, max; } sensor[SENSORS]; +struct { int num; } mail[MAILBOXES+1]; +struct { double val, min, max; } sensor[SENSORS+1]; static double query (int token) { @@ -516,19 +520,19 @@ static void collect_data (void) Battery (&batt.perc, &batt.stat, &batt.dur); } - for (i=1; i<=MAILBOXES; i++) { + for (i=0; i<=MAILBOXES; i++) { if (token_usage[T_MAIL]&(1<<i)) { Mail (i, &mail[i].num); } } - for (i=1; i<SENSORS; i++) { + for (i=0; i<=SENSORS; i++) { if (token_usage[T_SENSOR]&(1<<i)) { Sensor (i, &sensor[i].val, &sensor[i].min, &sensor[i].max); } } - for (i=1; i<EXECS; i++) { + for (i=0; i<=EXECS; i++) { if (token_usage[T_EXEC]&(1<<i)) { Exec (i, exec[i].s, &exec[i].val); } @@ -1,4 +1,4 @@ -/* $Id: system.c,v 1.22 2001/03/12 12:39:36 reinelt Exp $ +/* $Id: system.c,v 1.23 2001/03/13 08:34:15 reinelt Exp $ * * system status retreivement * @@ -20,6 +20,10 @@ * * * $Log: system.c,v $ + * Revision 1.23 2001/03/13 08:34:15 reinelt + * + * corrected a off-by-one bug with sensors + * * Revision 1.22 2001/03/12 12:39:36 reinelt * * reworked autoconf a lot: drivers may be excluded, #define's went to config.h @@ -730,14 +734,14 @@ int Sensor (int index, double *val, double *min, double *max) { char buffer[32]; double dummy, value; - static int fd[SENSORS]={[0 ... SENSORS-1]=-2,}; - static char *sensor[SENSORS]={NULL,}; - static double val_buf[SENSORS]={0.0,}; - static double min_buf[SENSORS]={0.0,}; - static double max_buf[SENSORS]={0.0,}; - static time_t now[SENSORS]={0,}; - - if (index<1 || index>=SENSORS) return -1; + static int fd[SENSORS+1]={[0 ... SENSORS]=-2,}; + static char *sensor[SENSORS+1]={NULL,}; + 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 time_t now[SENSORS+1]={0,}; + + if (index<0 || index>SENSORS) return -1; *val=val_buf[index]; *min=min_buf[index]; |