From: Jean-Philippe Orsini Date: Thu, 9 Oct 2014 06:39:57 +0000 (+0200) Subject: renamed psensor field X-Git-Tag: v1.2.0~81 X-Git-Url: http://git.wpitchoune.net/gitweb/?p=psensor.git;a=commitdiff_plain;h=9f2b7eb5cd9f86d72f63a3956a6088e6f0319070 renamed psensor field --- diff --git a/src/lib/psensor.c b/src/lib/psensor.c index 9073d12..415af89 100644 --- a/src/lib/psensor.c +++ b/src/lib/psensor.c @@ -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) { diff --git a/src/lib/psensor.h b/src/lib/psensor.h index 56b349f..11805f9 100644 --- a/src/lib/psensor.h +++ b/src/lib/psensor.h @@ -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; diff --git a/src/lib/psensor_json.c b/src/lib/psensor_json.c index 058a25e..fcb0982 100644 --- a/src/lib/psensor_json.c +++ b/src/lib/psensor_json.c @@ -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)); diff --git a/src/ui_sensorlist.c b/src/ui_sensorlist.c index cc00d79..f9b5fba 100644 --- a/src/ui_sensorlist.c +++ b/src/ui_sensorlist.c @@ -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,