Add delay before starting camera

On the ESP32Cam board, when you try to start the camera right after boot-up,
it will give an error, like this:
[E][sccb.c:115] SCCB_Write(): SCCB_Write Failed addr:0x30, reg:0xc7, data:0x10, ret:-1
And then it will fail to init.
They say it is related to poor power supply.

But after I added this 500ms delay, the issue gone.
I suppose it's because after the board boot-up, there is a bunch of things initializing
and comsuming power, which causes camera voltage to be unstable.
And if we wait a bit then those initializations are over
and voltage is more stable.
This commit is contained in:
Semyon Maryasin 2021-07-20 14:22:49 +03:00
parent 7aeaee8236
commit 53d58aa49c
No known key found for this signature in database
GPG Key ID: 22BC43FD649F86E3

View File

@ -274,6 +274,7 @@ bool Camera::initHardware()
gpio_config(&gpio_pwr_config); gpio_config(&gpio_pwr_config);
gpio_set_level(GPIO_NUM_32,0); gpio_set_level(GPIO_NUM_32,0);
#endif //CAMERA_DEVICE == CAMERA_MODEL_AI_THINKER #endif //CAMERA_DEVICE == CAMERA_MODEL_AI_THINKER
delay(500);
log_esp3d("Init camera config"); log_esp3d("Init camera config");
esp_err_t err = esp_camera_init(&config); esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) { if (err != ESP_OK) {