Skip to content

Commit bc31f2d

Browse files
authored
Merge pull request #2804 from adafruit/picow_cam
adding try/except for picowbell camera
2 parents a4f5493 + 56bf5f6 commit bc31f2d

File tree

1 file changed

+6
-1
lines changed
  • PiCowbell_Camera_Demos/TFT_Viewer

1 file changed

+6
-1
lines changed

PiCowbell_Camera_Demos/TFT_Viewer/code.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@
5858
height = display.height
5959

6060
#cam.test_pattern = OV7670_TEST_PATTERN_COLOR_BAR_FADE
61-
bitmap = displayio.Bitmap(cam.width, cam.height, 65535)
61+
try:
62+
bitmap = displayio.Bitmap(cam.width, cam.height, 65535)
63+
except MemoryError:
64+
print("Oops, 240x240 is a little too big, trying 240x176..")
65+
cam.size = adafruit_ov5640.OV5640_SIZE_QCIF
66+
bitmap = displayio.Bitmap(cam.width, cam.height, 65535)
6267
print(width, height, cam.width, cam.height)
6368
if bitmap is None:
6469
raise SystemExit("Could not allocate a bitmap")

0 commit comments

Comments
 (0)