Skip to content

Commit dc27fb9

Browse files
committed
error at runtime if no psram actually reserved
1 parent 9f22e75 commit dc27fb9

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

locale/circuitpython.pot

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,10 @@ msgstr ""
398398
msgid "All CAN peripherals are in use"
399399
msgstr ""
400400

401-
#: ports/espressif/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
402-
msgid "All I2C peripherals are in use"
403-
msgstr ""
404-
401+
#: ports/espressif/common-hal/busio/I2C.c
405402
#: ports/espressif/common-hal/i2ctarget/I2CTarget.c
406-
msgid "All I2C targets are in use"
403+
#: ports/nrf/common-hal/busio/I2C.c
404+
msgid "All I2C peripherals are in use"
407405
msgstr ""
408406

409407
#: ports/espressif/common-hal/countio/Counter.c
@@ -1061,6 +1059,7 @@ msgid "I2C init error"
10611059
msgstr ""
10621060

10631061
#: ports/raspberrypi/common-hal/busio/I2C.c
1062+
#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c
10641063
msgid "I2C peripheral in use"
10651064
msgstr ""
10661065

@@ -1592,6 +1591,7 @@ msgid "Only one TouchAlarm can be set in deep sleep."
15921591
msgstr ""
15931592

15941593
#: ports/espressif/common-hal/i2ctarget/I2CTarget.c
1594+
#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c
15951595
msgid "Only one address is allowed"
15961596
msgstr ""
15971597

@@ -2873,6 +2873,12 @@ msgstr ""
28732873
msgid "error = 0x%08lX"
28742874
msgstr ""
28752875

2876+
#: ports/espressif/common-hal/esp32_camera/Camera.c
2877+
msgid ""
2878+
"esp32_camera.Camera requires reserved PSRAM to be configured. See the "
2879+
"documentation for instructions."
2880+
msgstr ""
2881+
28762882
#: py/runtime.c
28772883
msgid "exceptions must derive from BaseException"
28782884
msgstr ""

ports/espressif/bindings/esp32_camera/Camera.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
//| """
6464
//| Configure and initialize a camera with the given properties
6565
//|
66-
//| 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.
66+
//| 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.
6767
//|
6868
//|
6969
//| .. important::

ports/espressif/common-hal/esp32_camera/Camera.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ void common_hal_esp32_camera_camera_construct(
6161
mp_int_t framebuffer_count,
6262
camera_grab_mode_t grab_mode) {
6363

64+
if (common_hal_espidf_get_reserved_psram() == 0) {
65+
mp_raise_msg(&mp_type_MemoryError, translate(
66+
"esp32_camera.Camera requires reserved PSRAM to be configured. "
67+
"See the documentation for instructions.");
68+
}
6469
for (int i = 0; i < 8; i++) {
6570
claim_pin_number(data_pins[i]);
6671
}

0 commit comments

Comments
 (0)