Skip to content

Commit b927e9a

Browse files
WangYuxin-espigrr
authored andcommitted
feat: add an option for cam task size
1 parent 7b6f020 commit b927e9a

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

Kconfig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ menu "Camera configuration"
142142
bool "Subsample Mode"
143143
endchoice
144144

145+
config CAMERA_TASK_STACK_SIZE
146+
int "CAM task stack size"
147+
default 2048
148+
help
149+
Camera task stack size
150+
145151
choice CAMERA_TASK_PINNED_TO_CORE
146152
bool "Camera task pinned to core"
147153
default CAMERA_CORE0
@@ -163,8 +169,8 @@ menu "Camera configuration"
163169
default 32768
164170
help
165171
Maximum value of DMA buffer
166-
Larger values may fail to allocate due to insufficient contiguous memory blocks, and smaller value may cause DMA interrupt to be too frequent
167-
172+
Larger values may fail to allocate due to insufficient contiguous memory blocks, and smaller value may cause DMA interrupt to be too frequent.
173+
168174
config CAMERA_CONVERTER_ENABLED
169175
bool "Enable camera RGB/YUV converter"
170176
depends on IDF_TARGET_ESP32S3

driver/cam_hal.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
#endif // ESP_IDF_VERSION_MAJOR
3333
#define ESP_CAMERA_ETS_PRINTF ets_printf
3434

35+
#if CONFIG_CAM_TASK_STACK_SIZE
36+
#define CAM_TASK_STACK CONFIG_CAM_TASK_STACK_SIZE
37+
#else
38+
#define CAM_TASK_STACK (2*1024)
39+
#endif
40+
3541
static const char *TAG = "cam_hal";
3642
static cam_obj_t *cam_obj = NULL;
3743

@@ -392,11 +398,11 @@ esp_err_t cam_config(const camera_config_t *config, framesize_t frame_size, uint
392398

393399

394400
#if CONFIG_CAMERA_CORE0
395-
xTaskCreatePinnedToCore(cam_task, "cam_task", 2048, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle, 0);
401+
xTaskCreatePinnedToCore(cam_task, "cam_task", CAM_TASK_STACK, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle, 0);
396402
#elif CONFIG_CAMERA_CORE1
397-
xTaskCreatePinnedToCore(cam_task, "cam_task", 2048, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle, 1);
403+
xTaskCreatePinnedToCore(cam_task, "cam_task", CAM_TASK_STACK, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle, 1);
398404
#else
399-
xTaskCreate(cam_task, "cam_task", 2048, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle);
405+
xTaskCreate(cam_task, "cam_task", CAM_TASK_STACK, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle);
400406
#endif
401407

402408
ESP_LOGI(TAG, "cam config ok");

0 commit comments

Comments
 (0)