add library support for logarithms and exponents (!) to support

vt1211 / vt8235 thermistor calculations. Add such calculations to
      vt1211/vt8235 section in sensors.conf; bump library version to 1.4.0.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1667 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker committed 2002-12-09 02:55:58 +00:00
1 parent 42043728ee
commit 1d0d09cc26
6 files changed
+58 -7

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ LIBMAN5FILES := $(MODULE_DIR)/sensors.conf.5
# The main and minor version of the library
LIBMAINVER := 1
LIBMINORVER := 3.0
LIBMINORVER := 4.0
LIBVER := $(LIBMAINVER).$(LIBMINORVER)
# The static lib name, the shared lib name, and the internal ('so') name of
+9
View File
@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "access.h"
#include "sensors.h"
#include "data.h"
@@ -395,6 +396,14 @@ int sensors_eval_expr(sensors_chip_name chipname, const sensors_expr *expr,
case sensors_negate:
*result = -res1;
return 0;
case sensors_exp:
*result = exp(res1);
return 0;
case sensors_log:
if (res1 < 0.0)
return -SENSORS_ERR_DIV_ZERO;
*result = log(res1);
return 0;
}
return 0;
}
+6
View File
@@ -178,6 +178,12 @@ OCTESC (1[0-7]{0,2})|([2-7][0-7]?)|(0[1-7][0-7]?)|(00[1-7])
<MIDDLE>"@" {
return '@';
}
<MIDDLE>"^" {
return '^';
}
<MIDDLE>"`" {
return '`';
}
/* Quoted string */
<MIDDLE>\" {
+15
View File
@@ -102,6 +102,7 @@ static sensors_chip *current_chip = NULL;
%left <nothing> '-' '+'
%left <nothing> '*' '/'
%left <nothing> NEG
%right <nothing> '^' '`'
%token <nothing> ','
%token <nothing> EOL
@@ -272,6 +273,20 @@ expression: FLOAT
}
| '(' expression ')'
{ $$ = $2; }
| '^' expression
{ $$ = malloc_expr();
$$->kind = sensors_kind_sub;
$$->data.subexpr.op = sensors_exp;
$$->data.subexpr.sub1 = $2;
$$->data.subexpr.sub2 = NULL;
}
| '`' expression
{ $$ = malloc_expr();
$$->kind = sensors_kind_sub;
$$->data.subexpr.op = sensors_log;
$$->data.subexpr.sub1 = $2;
$$->data.subexpr.sub2 = NULL;
}
;
i2cbus_name: NAME
+1 -1
View File
@@ -29,7 +29,7 @@
/* Kinds of expression operators recognized */
typedef enum sensors_operation {
sensors_add, sensors_sub, sensors_multiply, sensors_divide,
sensors_negate } sensors_operation;
sensors_negate, sensors_exp, sensors_log } sensors_operation;
/* An expression can have several forms */
typedef enum sensors_expr_kind {