Skip to content
Snippets Groups Projects
Commit 26fb5536 authored by jkerdreu's avatar jkerdreu
Browse files

Added smooth

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/fork@1629 b32b6428-25c9-4566-ad07-03861ab6144f
parent 450d0f2b
Branches
Tags
No related merge requests found
......@@ -24,6 +24,11 @@ def build_dev(addr,devtype):
return dev
def smooth(attribute,value,gap):
old = attribute.value
if not (old - gap <= value <= old + gap):
attribute.value = value
class GW:
def __init__(self,engine):
......@@ -48,9 +53,8 @@ class GW:
self.sensor = HTU21D.HTU21D()
def process(self):
self.temp.value = round(self.sensor.read_temperature(),1)
self.hum.value = round(self.sensor.read_humidity(),0)
smooth(self.temp,round(self.sensor.read_temperature(),1),0.1)
smooth(self.hum.value,round(self.sensor.read_humidity(),0),1)
def run():
eng = xaal.lib.Engine()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment