Some fixes.
This commit is contained in:
parent
6ae519f78e
commit
b618b1cd21
|
@ -86,7 +86,7 @@
|
||||||
"frequency": 25000
|
"frequency": 25000
|
||||||
},
|
},
|
||||||
"activated-channels": [ 0, 1],
|
"activated-channels": [ 0, 1],
|
||||||
"interval": 1.0,
|
"interval": 1,
|
||||||
"use_difference": false,
|
"use_difference": false,
|
||||||
"thresholds-for": "inside",
|
"thresholds-for": "inside",
|
||||||
"thresholds": {
|
"thresholds": {
|
||||||
|
|
|
@ -15,11 +15,19 @@ class Service(object):
|
||||||
def run(self):
|
def run(self):
|
||||||
interval = self.__cfg.get_data()["interval"]
|
interval = self.__cfg.get_data()["interval"]
|
||||||
t = time.time()
|
t = time.time()
|
||||||
|
last = None
|
||||||
|
ran = False
|
||||||
while True:
|
while True:
|
||||||
t = time.time()
|
t = time.time()
|
||||||
time.sleep(t + interval - time.time())
|
if int(t) % interval == 0 and not ran:
|
||||||
thread = Thread(self.work)
|
thread = Thread(self.work)
|
||||||
thread.start()
|
thread.start()
|
||||||
|
ran = True
|
||||||
|
last = int(t)
|
||||||
|
else:
|
||||||
|
time.sleep(0.01)
|
||||||
|
if t > last:
|
||||||
|
ran = False
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def work(self):
|
def work(self):
|
||||||
|
|
Loading…
Reference in New Issue