temp module - avoid a bit of cpu sendingh edje message if temp same

each poll - check if temp actually changed and only send edje message
if tempt actually did change. saves some cpu while polling in the bg
for these things.

@optimize
This commit is contained in:
Carsten Haitzler 2016-12-04 22:46:02 +09:00
parent bdbd0f4753
commit a15ac5f039
2 changed files with 4 additions and 0 deletions

View File

@ -77,6 +77,8 @@ _temperature_apply(Config_Face *inst, int temp)
{
char buf[64];
if (inst->temp == temp) return;
inst->temp = temp;
if (temp != -999)
{
if (inst->units == FAHRENHEIT) temp = (temp * 9.0 / 5.0) + 32;
@ -139,6 +141,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
inst->high = 80;
inst->sensor_type = SENSOR_TYPE_NONE;
inst->sensor_name = NULL;
inst->temp = -900;
inst->units = CELSIUS;
#ifdef HAVE_EEZE
inst->backend = UDEV;

View File

@ -55,6 +55,7 @@ struct _Config_Face
int poll_interval;
int low, high;
int sensor_type;
int temp;
const char *sensor_name;
Unit units;
/* config state */