Turn elseif into if if for proper reset pin handling
This commit is contained in:
@@ -840,6 +840,20 @@ esp_err_t camera_probe(const camera_config_t* config, camera_model_t* out_camera
|
|||||||
|
|
||||||
ESP_LOGD(TAG, "Initializing SSCB");
|
ESP_LOGD(TAG, "Initializing SSCB");
|
||||||
SCCB_Init(config->pin_sscb_sda, config->pin_sscb_scl);
|
SCCB_Init(config->pin_sscb_sda, config->pin_sscb_scl);
|
||||||
|
|
||||||
|
if(config->pin_pwdn >= 0) {
|
||||||
|
ESP_LOGD(TAG, "Resetting camera by power down line");
|
||||||
|
gpio_config_t conf = { 0 };
|
||||||
|
conf.pin_bit_mask = 1LL << config->pin_pwdn;
|
||||||
|
conf.mode = GPIO_MODE_OUTPUT;
|
||||||
|
gpio_config(&conf);
|
||||||
|
|
||||||
|
// carefull, logic is inverted compared to reset pin
|
||||||
|
gpio_set_level(config->pin_pwdn, 1);
|
||||||
|
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||||
|
gpio_set_level(config->pin_pwdn, 0);
|
||||||
|
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
|
||||||
if(config->pin_reset >= 0) {
|
if(config->pin_reset >= 0) {
|
||||||
ESP_LOGD(TAG, "Resetting camera");
|
ESP_LOGD(TAG, "Resetting camera");
|
||||||
@@ -852,18 +866,6 @@ esp_err_t camera_probe(const camera_config_t* config, camera_model_t* out_camera
|
|||||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(config->pin_reset, 1);
|
gpio_set_level(config->pin_reset, 1);
|
||||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||||
} else if(config->pin_pwdn >= 0) {
|
|
||||||
ESP_LOGD(TAG, "Resetting camera by power down line");
|
|
||||||
gpio_config_t conf = { 0 };
|
|
||||||
conf.pin_bit_mask = 1LL << config->pin_pwdn;
|
|
||||||
conf.mode = GPIO_MODE_OUTPUT;
|
|
||||||
gpio_config(&conf);
|
|
||||||
|
|
||||||
// carefull, logic is inverted compared to reset pin
|
|
||||||
gpio_set_level(config->pin_pwdn, 1);
|
|
||||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
|
||||||
gpio_set_level(config->pin_pwdn, 0);
|
|
||||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
|
||||||
#if CONFIG_OV2640_SUPPORT
|
#if CONFIG_OV2640_SUPPORT
|
||||||
} else {
|
} else {
|
||||||
//reset OV2640
|
//reset OV2640
|
||||||
|
|||||||
Reference in New Issue
Block a user