diff --git a/src/picam/picam.py b/src/picam/picam.py index db78a5f..28f1800 100644 --- a/src/picam/picam.py +++ b/src/picam/picam.py @@ -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: