Fixed camera settings

Since splitting the camera config into a separate YAML file, we've broken
the ability to change the camera's configuration via the API (or at any time
except when the camera is set up, I think).  This (mostly) fixes that, though
I get type errors that I've had to work around (e.g. when setting
shutter_speed), see `pi.py`
This commit is contained in:
Richard Bowman 2019-04-08 22:41:12 +01:00
parent e90eb7c2d4
commit e6ec800c21
4 changed files with 20 additions and 7 deletions

View file

@ -184,12 +184,17 @@ class StreamingCamera(BaseCamera):
set_digital_gain(self.camera, value)
elif key == 'analog_gain':
set_analog_gain(self.camera, value)
elif key == "shutter_speed":
self.camera.shutter_speed = int(value)
else:
setattr(self.camera, key, value) # Write setting to camera
# StreamingCamera parameters (applied via StreamingCamera config)
for key, value in config.items(): # For each provided setting
if key != 'picamera_settings': # We already handled this
if key in self.config.keys():
if key != 'picamera_settings': # We already handled this
logging.warn("{} is not in the streaming camera settings dictionary - adding it.")
#continue #TODO: filter settings somehow?
logging.debug("Setting parameter {}: {}".format(key, value))
self.config[key] = value