Skip to content

Cannot read saturation variable unless it is set #34

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

Closed
jmangum opened this issue Feb 2, 2025 · 1 comment · Fixed by #40
Closed

Cannot read saturation variable unless it is set #34

jmangum opened this issue Feb 2, 2025 · 1 comment · Fixed by #40
Assignees

Comments

@jmangum
Copy link

jmangum commented Feb 2, 2025

OV5640 in a PiCowbell breakout mounted to a PiCowbell doubler all being run by a RP2350 Pico 2W. Running CircuitPython 9.2.1. When I try the following:

cam = adafruit_ov5640.OV5640(i2c,
        data_pins=(
        board.GP6,
        board.GP7,
        board.GP8,
        board.GP9,
        board.GP10,
        board.GP11,
        board.GP12,
        board.GP13,
        ),
        clock=board.GP3,
        vsync=board.GP0,
        href=board.GP2,
        mclk=None,
        shutdown=None,
        reset=reset,
        size=adafruit_ov5640.OV5640_SIZE_VGA, # 640x480.  Works.  Requires 30720 bytes when quality = 10 (PREFERRED!)
    )
print('Saturation: ',cam.saturation) # Allowed values: -4 to 5 inclusive

...I get the following error...

Traceback (most recent call last):
  File "code.py", line 585, in <module>
  File "asyncio/core.py", line 317, in run
  File "asyncio/core.py", line 276, in run_until_complete
  File "asyncio/core.py", line 261, in run_until_complete
  File "code.py", line 527, in main
  File "adafruit_ov5640/__init__.py", line 1463, in saturation
AttributeError: 'OV5640' object has no attribute '_saturation'

If I first set the saturation before reading it back, I do not get an error...

cam.saturation = 0
print('Saturation: ',cam.saturation) # Allowed values: -4 to 5 inclusive
@relic-se
Copy link
Contributor

The same applies for adafruit_ov5640.OV5640.effect. My temporary solution has been to wrap the property read into a try block.

try:
    value = cam.saturation
except AttributeError:
    value = 0
print('Saturation: ', value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants