Stability fixes

This commit is contained in:
Fabio Manganiello 2018-07-06 03:38:07 +02:00
parent 85cdd8e5af
commit 88d9f9d3ac
2 changed files with 10 additions and 6 deletions

View file

@ -73,14 +73,10 @@ class CameraPiBackend(Backend):
self.camera.rotation = rotation self.camera.rotation = rotation
self.camera.crop = crop self.camera.crop = crop
self.start_recording_on_startup = start_recording_on_startup self.start_recording_on_startup = start_recording_on_startup
self.redis = get_backend('redis') self.redis = None
self.redis_queue = redis_queue self.redis_queue = redis_queue
self._recording_thread = None self._recording_thread = None
if self.start_recording_on_startup:
self.send_camera_action(self.CameraAction.START_RECORDING)
self.logger.info('Initialized Pi camera backend')
def send_camera_action(self, action, **kwargs): def send_camera_action(self, action, **kwargs):
action = { action = {
@ -167,6 +163,14 @@ class CameraPiBackend(Backend):
def run(self): def run(self):
super().run() super().run()
if not self.redis:
self.redis = get_backend('redis')
if self.start_recording_on_startup:
self.send_camera_action(self.CameraAction.START_RECORDING)
self.logger.info('Initialized Pi camera backend')
while not self.should_stop(): while not self.should_stop():
try: try:
msg = self.redis.get_message(self.redis_queue) msg = self.redis.get_message(self.redis_queue)

View file

@ -34,7 +34,7 @@ class GpioSensorPlugin(Plugin):
Alias for ``get_measurement`` Alias for ``get_measurement``
""" """
return self.get_measurement(*args, **kwargs) return self.get_measurement(*args, **kwargs).output
# vim:sw=4:ts=4:et: # vim:sw=4:ts=4:et: