renamed psensor field
authorJean-Philippe Orsini <jeanfi@gmail.com>
Thu, 9 Oct 2014 06:39:57 +0000 (08:39 +0200)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Thu, 9 Oct 2014 06:39:57 +0000 (08:39 +0200)
src/lib/psensor.c
src/lib/psensor.h
src/lib/psensor_json.c
src/ui_sensorlist.c

index 9073d12..415af89 100644 (file)
@@ -42,8 +42,8 @@ struct psensor *psensor_create(char *id,
        psensor->id = id;
        psensor->name = name;
        psensor->chip = chip;
-       psensor->min = UNKNOWN_DBL_VALUE;
-       psensor->max = UNKNOWN_DBL_VALUE;
+       psensor->sess_lowest = UNKNOWN_DBL_VALUE;
+       psensor->sess_highest = UNKNOWN_DBL_VALUE;
 
        psensor->type = type;
 
@@ -247,11 +247,11 @@ void psensor_set_current_measure(struct psensor *s, double v, struct timeval tv)
        s->measures[s->values_max_length - 1].value = v;
        s->measures[s->values_max_length - 1].time = tv;
 
-       if (s->min == UNKNOWN_DBL_VALUE || v < s->min)
-               s->min = v;
+       if (s->sess_lowest == UNKNOWN_DBL_VALUE || v < s->sess_lowest)
+               s->sess_lowest = v;
 
-       if (s->max == UNKNOWN_DBL_VALUE || v > s->max)
-               s->max = v;
+       if (s->sess_highest == UNKNOWN_DBL_VALUE || v > s->sess_highest)
+               s->sess_highest = v;
 
        if (v > s->alarm_high_threshold || v < s->alarm_low_threshold) {
                if (!s->alarm_raised && s->cb_alarm_raised) {
index 56b349f..11805f9 100644 (file)
@@ -80,11 +80,11 @@ struct psensor {
        /* see psensor_type */
        unsigned int type;
 
-       /* The maximum detected value of the sensor */
-       double max;
+       /* The highest value detected during this session. */
+       double sess_highest;
 
-       /* The minimum detected value of the sensor */
-       double min;
+       /* The lowest value detected during this session. */
+       double sess_lowest;
 
        int alarm_high_threshold;
        int alarm_low_threshold;
index 058a25e..fcb0982 100644 (file)
@@ -80,9 +80,11 @@ static json_object *sensor_to_json(struct psensor *s)
        json_object_object_add(obj,
                               ATT_SENSOR_TYPE, json_object_new_int(s->type));
        json_object_object_add(obj,
-                              ATT_SENSOR_MIN, json_object_new_double(s->min));
+                              ATT_SENSOR_MIN,
+                              json_object_new_double(s->sess_lowest));
        json_object_object_add(obj,
-                              ATT_SENSOR_MAX, json_object_new_double(s->max));
+                              ATT_SENSOR_MAX,
+                              json_object_new_double(s->sess_highest));
        json_object_object_add(obj,
                               ATT_SENSOR_MEASURES,
                               measures_to_json_object(s));
index cc00d79..f9b5fba 100644 (file)
@@ -119,8 +119,12 @@ void ui_sensorlist_update(struct ui_psensor *ui, bool complete)
                value = psensor_value_to_str(s->type,
                                             psensor_get_current_value(s),
                                             use_celsius);
-               min = psensor_value_to_str(s->type, s->min, use_celsius);
-               max = psensor_value_to_str(s->type, s->max, use_celsius);
+               min = psensor_value_to_str(s->type,
+                                          s->sess_lowest,
+                                          use_celsius);
+               max = psensor_value_to_str(s->type,
+                                          s->sess_highest,
+                                          use_celsius);
 
                gtk_list_store_set(store, &iter,
                                   COL_TEMP, value,