set min/max for percent sensor
authorJean-Philippe Orsini <jeanfi@gmail.com>
Sat, 18 Oct 2014 11:18:40 +0000 (13:18 +0200)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Sat, 18 Oct 2014 11:18:40 +0000 (13:18 +0200)
src/lib/psensor.c

index c5e412b..236842a 100644 (file)
@@ -45,8 +45,13 @@ struct psensor *psensor_create(char *id,
        psensor->sess_lowest = UNKNOWN_DBL_VALUE;
        psensor->sess_highest = UNKNOWN_DBL_VALUE;
 
-       psensor->min = UNKNOWN_DBL_VALUE;
-       psensor->max = UNKNOWN_DBL_VALUE;
+       if (type & SENSOR_TYPE_PERCENT) {
+               psensor->min = 0;
+               psensor->max = 100;
+       } else {
+               psensor->min = UNKNOWN_DBL_VALUE;
+               psensor->max = UNKNOWN_DBL_VALUE;
+       }
 
        psensor->type = type;