Explorar el Código

Gradient monitor improvement

spike_filter
Dirk Alders hace 3 años
padre
commit
afedf43bdf
Se han modificado 1 ficheros con 4 adiciones y 3 borrados
  1. 4
    3
      dht.py

+ 4
- 3
dht.py Ver fichero

@@ -90,14 +90,15 @@ class gradient_monitor(object):
90 90
         self.__last_time__ = None
91 91
 
92 92
     def process(self, value, time):
93
-        rv = True
94 93
         if self.__last_value__ is not None and self.__last_time__ is not None:
94
+            # Valid last value exists
95 95
             gradient = abs((value - self.__last_value__) / (time - self.__last_time__))
96 96
             if gradient > self.__max_gradient__:
97
-                rv = False
97
+                return False
98
+
98 99
         self.__last_value__ = value
99 100
         self.__last_time__ = time
100
-        return rv
101
+        return True
101 102
 
102 103
 
103 104
 class dht_22_monitor(object):

Loading…
Cancelar
Guardar