raster pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=a15ac5f039bf28e35ce4fb6d54630955a8e61953

commit a15ac5f039bf28e35ce4fb6d54630955a8e61953
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Sun Dec 4 22:46:02 2016 +0900

    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
---
 src/modules/temperature/e_mod_main.c | 3 +++
 src/modules/temperature/e_mod_main.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/src/modules/temperature/e_mod_main.c 
b/src/modules/temperature/e_mod_main.c
index f1e2422..861e313 100644
--- a/src/modules/temperature/e_mod_main.c
+++ b/src/modules/temperature/e_mod_main.c
@@ -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;
diff --git a/src/modules/temperature/e_mod_main.h 
b/src/modules/temperature/e_mod_main.h
index a61c921..5207740 100644
--- a/src/modules/temperature/e_mod_main.h
+++ b/src/modules/temperature/e_mod_main.h
@@ -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 */

-- 


Reply via email to