Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ev and white balance getters #33

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions adafruit_ov5640/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1543,15 +1543,16 @@ def contrast(self, value: int) -> None:

@property
def exposure_value(self) -> int:
"""Sensor exposure (EV) adjustment, from -4 to 4 inclusive"""
"""Sensor exposure (EV) adjustment, from -3 to 3 inclusive"""
return self._ev

@exposure_value.setter
def exposure_value(self, value: int) -> None:
if not -3 <= value <= 3:
raise ValueError(
"Invalid exposure value (EV) {value}, use a value from -4..4 inclusive"
"Invalid exposure value (EV) {value}, use a value from -3..3 inclusive"
)
self._ev = value
for offset, reg_value in enumerate(_sensor_ev_levels[value]):
self._write_register(0x5381 + offset, reg_value)

Expand All @@ -1567,6 +1568,7 @@ def white_balance(self, value: int) -> None:
"Invalid exposure value (EV) {value}, "
"use one of the OV5640_WHITE_BALANCE_* constants"
)
self._white_balance = value
self._write_register(0x3212, 0x3) # start group 3
for reg_addr, reg_value in zip(_light_registers, _light_modes[value]):
self._write_register(reg_addr, reg_value)
Expand Down
Loading