Calibration now stores to a config file, which can be loaded

This commit is contained in:
Joel Collins 2018-11-29 17:58:24 +00:00
parent f0e638f894
commit 2cf025088b
4 changed files with 235 additions and 15 deletions

View file

@ -9,9 +9,10 @@ import time
MMAL_PARAMETER_ANALOG_GAIN = mmal.MMAL_PARAMETER_GROUP_CAMERA + 0x59
MMAL_PARAMETER_DIGITAL_GAIN = mmal.MMAL_PARAMETER_GROUP_CAMERA + 0x5A
def set_gain(camera, gain, value):
"""Set the analog gain of a PiCamera.
camera: the picamera.PiCamera() instance you are configuring
gain: either MMAL_PARAMETER_ANALOG_GAIN or MMAL_PARAMETER_DIGITAL_GAIN
value: a numeric value that can be converted to a rational number.
@ -26,10 +27,12 @@ def set_gain(camera, gain, value):
elif ret != 0:
raise exc.PiCameraMMALError(ret)
def set_analog_gain(camera, value):
"""Set the gain of a PiCamera object to a given value."""
set_gain(camera, MMAL_PARAMETER_ANALOG_GAIN, value)
def set_digital_gain(camera, value):
"""Set the digital gain of a PiCamera object to a given value."""
set_gain(camera, MMAL_PARAMETER_DIGITAL_GAIN, value)