error at runtime if no psram actually reserved

This commit is contained in:
Jeff Epler 2022-08-23 11:34:22 -05:00
parent 9f22e75e5e
commit dc27fb967d
3 changed files with 17 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

@ -61,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]);
}