fix: fixed the issue of slow startup for devices without cameras (#866)

This commit is contained in:
virgil
2025-06-30 22:41:42 +08:00
committed by GitHub
parent d1c586239c
commit 8a0ec8b657
4 changed files with 14 additions and 4 deletions

View File

@@ -83,6 +83,16 @@ SscmaCamera::SscmaCamera(esp_io_expander_handle_t io_exp_handle) {
sscma_client_init(sscma_client_handle_);
ESP_LOGI(TAG, "SSCMA client initialized");
// 设置分辨率
// 3 = 640x480
if (sscma_client_set_sensor(sscma_client_handle_, 1, 3, true)) {
ESP_LOGE(TAG, "Failed to set sensor");
sscma_client_del(sscma_client_handle_);
sscma_client_handle_ = NULL;
return;
}
// 获取设备信息
sscma_client_info_t *info;
if (sscma_client_get_info(sscma_client_handle_, &info, true) == ESP_OK) {
@@ -90,8 +100,6 @@ SscmaCamera::SscmaCamera(esp_io_expander_handle_t io_exp_handle) {
info->id ? info->id : "NULL",
info->name ? info->name : "NULL");
}
sscma_client_set_sensor(sscma_client_handle_, 1, 3, true); // 3 = 640x480
// 初始化JPEG数据的内存
jpeg_data_.len = 0;
jpeg_data_.buf = (uint8_t*)heap_caps_malloc(IMG_JPEG_BUF_SIZE, MALLOC_CAP_SPIRAM);;