Merge pull request #6794 from jepler/esp32-camera-error-checking

Esp32 camera error checking
This commit is contained in:
Dan Halbert 2022-08-30 11:41:42 -04:00 committed by GitHub
commit 3ba385ff5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 42 additions and 6 deletions

View File

@ -398,12 +398,10 @@ msgstr ""
msgid "All CAN peripherals are in use"
msgstr ""
#: ports/espressif/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
msgid "All I2C peripherals are in use"
msgstr ""
#: ports/espressif/common-hal/busio/I2C.c
#: ports/espressif/common-hal/i2ctarget/I2CTarget.c
msgid "All I2C targets are in use"
#: ports/nrf/common-hal/busio/I2C.c
msgid "All I2C peripherals are in use"
msgstr ""
#: ports/espressif/common-hal/countio/Counter.c
@ -1061,6 +1059,7 @@ msgid "I2C init error"
msgstr ""
#: ports/raspberrypi/common-hal/busio/I2C.c
#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c
msgid "I2C peripheral in use"
msgstr ""
@ -1592,6 +1591,7 @@ msgid "Only one TouchAlarm can be set in deep sleep."
msgstr ""
#: ports/espressif/common-hal/i2ctarget/I2CTarget.c
#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c
msgid "Only one address is allowed"
msgstr ""
@ -2873,6 +2873,12 @@ msgstr ""
msgid "error = 0x%08lX"
msgstr ""
#: ports/espressif/common-hal/esp32_camera/Camera.c
msgid ""
"esp32_camera.Camera requires reserved PSRAM to be configured. See the "
"documentation for instructions."
msgstr ""
#: py/runtime.c
msgid "exceptions must derive from BaseException"
msgstr ""

View File

@ -63,7 +63,7 @@
//| """
//| Configure and initialize a camera with the given properties
//|
//| This driver requires that the ``CIRCUITPY_RESERVED_PSRAM`` in ``/.env`` be large enough to hold the camera frambuffer(s). Generally, boards with built-in cameras will have a default setting that is large enough. If the constructor raises a MemoryError, this probably indicates the setting is too small and should be increased.
//| This driver requires that the ``CIRCUITPY_RESERVED_PSRAM`` in ``/.env`` be large enough to hold the camera frambuffer(s). Generally, boards with built-in cameras will have a default setting that is large enough. If the constructor raises a MemoryError or an IDFError, this probably indicates the setting is too small and should be increased.
//|
//|
//| .. important::

View File

@ -19,3 +19,4 @@ CIRCUITPY_ESP_FLASH_SIZE = 4MB
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = qio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 8MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -13,3 +13,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -20,3 +20,4 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -17,3 +17,4 @@ CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 8MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 8MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 8MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -21,3 +21,4 @@ CIRCUITPY_ESP32_CAMERA = 0
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_cp_lib/mixgoce_lib
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -21,3 +21,4 @@ CIRCUITPY_ESP32_CAMERA = 0
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_cp_lib/mixgoce_lib
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -18,3 +18,4 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -18,3 +18,4 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -15,3 +15,4 @@ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP32_CAMERA = 0

View File

@ -34,6 +34,10 @@
#include "esp32-camera/driver/private_include/cam_hal.h"
#if !CONFIG_SPIRAM
#error esp32_camera only works on boards configured with spiram, disable it in mpconfigboard.mk
#endif
static void maybe_claim_pin(const mcu_pin_obj_t *pin) {
if (pin) {
claim_pin(pin);
@ -57,6 +61,11 @@ void common_hal_esp32_camera_camera_construct(
mp_int_t framebuffer_count,
camera_grab_mode_t grab_mode) {
if (common_hal_espidf_get_reserved_psram() == 0) {
mp_raise_msg(&mp_type_MemoryError, translate(
"esp32_camera.Camera requires reserved PSRAM to be configured. "
"See the documentation for instructions."));
}
for (int i = 0; i < 8; i++) {
claim_pin_number(data_pins[i]);
}