#22 more fixes

This commit is contained in:
James Hodgson
2022-10-07 17:30:17 +01:00
parent e1ff0112b7
commit b72867e467

View File

@@ -1,16 +1,18 @@
from utils.utils import round_resolution
ROUND_MULTIPLES = (32, 16)
class PiCam:
def __init__(self, config: dict):
self.capture_resolution = round_resolution(config["capture_resolution"])
self.preview_resolution = round_resolution(config["preview_resolution"])
self.capture_resolution = round_resolution(config["capture_resolution"], ROUND_MULTIPLES)
self.preview_resolution = round_resolution(config["preview_resolution"], ROUND_MULTIPLES)
def set_capture_resolution(self, resolution: "tuple[int, int]") -> None:
"""Set capture resolution for camera
:param resolution: New resolution for camera captures
"""
rounded_resolution = round_resolution(resolution, (32, 16))
rounded_resolution = round_resolution(resolution, ROUND_MULTIPLES)
self.capture_resolution = rounded_resolution
def set_preview_resolution(self, resolution: "tuple[int, int]") -> None:
@@ -18,7 +20,7 @@ class PiCam:
:param resolution: New resolution for camera preview
"""
rounded_resolution = round_resolution(resolution, (32, 16))
rounded_resolution = round_resolution(resolution, ROUND_MULTIPLES)
self.preview_resolution = rounded_resolution
def capture(self) -> bytearray: