]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2001-03-09 14:24:49 by ltoetsch]
authorltoetsch <ltoetsch@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Fri, 9 Mar 2001 14:24:49 +0000 (14:24 +0000)
committerltoetsch <ltoetsch@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Fri, 9 Mar 2001 14:24:49 +0000 (14:24 +0000)
exec: Scale_x ->Min/Max_x

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@106 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

README
exec.c
lcd4linux.conf.sample

diff --git a/README b/README
index 0ce7f4603b4e4788c96b6e1032f15003053033ea..ea62bb9f68aeb388ecc7805f367f8a6cbbcea29a 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 #
-# $Id: README,v 1.15 2001/03/09 13:08:11 ltoetsch Exp $
+# $Id: README,v 1.16 2001/03/09 14:24:49 ltoetsch Exp $
 #
 
 This is the README file for lcd4linux
@@ -148,7 +148,8 @@ Data-specific options:
                 $X1 ... $X8 is result of command 1..8 in environment
      Tick_x1 .. 9 delay in ticks (overrides delay_x)
      Delay_x1 ..9 delay in seconds (default 1)
-     Scale_x1 ..9 scale for bars (default 100)
+     Max_x1 ..9 max value for bars (default 100)
+     Min_x1 ..9 min value for bars (default 0)
      
   battery: Battwarning 10 (default 10)
    
diff --git a/exec.c b/exec.c
index 3c7c8de6c7ced911016aac0b35e5135f44f6bdb5..71c18a19fb87670f156367173f8fbb15caf50da5 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -1,4 +1,4 @@
-/* $Id: exec.c,v 1.3 2001/03/08 15:25:38 ltoetsch Exp $
+/* $Id: exec.c,v 1.4 2001/03/09 14:24:49 ltoetsch Exp $
  *
  * exec ('x*') functions
  *
@@ -20,6 +20,9 @@
  *
  *
  * $Log: exec.c,v $
+ * Revision 1.4  2001/03/09 14:24:49  ltoetsch
+ * exec: Scale_x ->Min/Max_x
+ *
  * Revision 1.3  2001/03/08 15:25:38  ltoetsch
  * improved exec
  *
@@ -36,7 +39,8 @@
  *   x1 .. x9      command to execute
  *   Tick_x1 ... 9 delay in ticks
  *   Delay_x1 .. 9 delay in seconds
- *   Scale_x1 .. 9 scale for bars
+ *   Max_x1 .. 9   max for scaling bars (100)
+ *   Min_x1 .. 9   min for scaling bars (0)
  */
 
 #include <stdio.h>
@@ -120,9 +124,14 @@ int Exec(int index, char buff[EXEC_TXT_LEN], double *val)
   for (p = buff ; *p && isspace(*p); p++)
     ;
   if (isdigit(*p)) {
+    double max, min;
     *val = atof(p);
-    sprintf(xn, "Scale_x%d", index);
-    *val /= atoi(cfg_get(xn)?:"100")?:100;
+    sprintf(xn, "Max_x%d", index);
+    max = atof(cfg_get(xn)?:"100")?:100;
+    sprintf(xn, "Min_x%d", index);
+    min = atof(cfg_get(xn)?:"0");
+    if (max != min)
+      *val = (*val - min)/(max - min);
   }
   return 0;
 }
index 5c9a2b29c08d926c1dd96659f52261a5e0bed953..c12f7f07195d27b6d9f9b6392b278f0fb5183f39 100644 (file)
@@ -76,7 +76,8 @@ Row4 "Load%l1%L$r10l1"
 #
 # Tick_x1 10  # every 10 ticks
 # Delay_x1 2  # every 2 seconds
-# Scale_x1 50 # scale for bars (default 100), value SHOULD be numeric ;-)
+# Max_x1 50 # max for scaling bars (default 100), value SHOULD be numeric ;-)
+# Min_x1 10 # min (default 0), SHOULD be != Max_x1
 
 #Row1 "Load%l1%L$r10cs+cb"
 #Row2 "Disk%dm $R10dr+dw"