Keep measurements in a loop until we get a valid data point
This commit is contained in:
parent
0fe255436e
commit
876a07d2c8
1 changed files with 6 additions and 6 deletions
|
@ -94,12 +94,12 @@ class GpioSensorMotionPwm3901Plugin(GpioSensorPlugin):
|
||||||
|
|
||||||
sensor = self._get_sensor()
|
sensor = self._get_sensor()
|
||||||
|
|
||||||
try:
|
while True:
|
||||||
x, y = sensor.get_motion()
|
try:
|
||||||
except RuntimeError as e:
|
x, y = sensor.get_motion()
|
||||||
self.logger.warning('Unable to retrieve sensor data: {}'.format(e))
|
break
|
||||||
self._sensor = None
|
except RuntimeError as e:
|
||||||
return {}, str(e)
|
time.sleep(0.01)
|
||||||
|
|
||||||
secs = int(time.time())
|
secs = int(time.time())
|
||||||
if (x, y) != (self.x, self.y):
|
if (x, y) != (self.x, self.y):
|
||||||
|
|
Loading…
Reference in a new issue