Turn elseif into if if for proper reset pin handling
This commit is contained in:
@@ -841,18 +841,7 @@ esp_err_t camera_probe(const camera_config_t* config, camera_model_t* out_camera
|
||||
ESP_LOGD(TAG, "Initializing SSCB");
|
||||
SCCB_Init(config->pin_sscb_sda, config->pin_sscb_scl);
|
||||
|
||||
if(config->pin_reset >= 0) {
|
||||
ESP_LOGD(TAG, "Resetting camera");
|
||||
gpio_config_t conf = { 0 };
|
||||
conf.pin_bit_mask = 1LL << config->pin_reset;
|
||||
conf.mode = GPIO_MODE_OUTPUT;
|
||||
gpio_config(&conf);
|
||||
|
||||
gpio_set_level(config->pin_reset, 0);
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
gpio_set_level(config->pin_reset, 1);
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
} else if(config->pin_pwdn >= 0) {
|
||||
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;
|
||||
@@ -864,6 +853,19 @@ esp_err_t camera_probe(const camera_config_t* config, camera_model_t* out_camera
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
gpio_set_level(config->pin_pwdn, 0);
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
if(config->pin_reset >= 0) {
|
||||
ESP_LOGD(TAG, "Resetting camera");
|
||||
gpio_config_t conf = { 0 };
|
||||
conf.pin_bit_mask = 1LL << config->pin_reset;
|
||||
conf.mode = GPIO_MODE_OUTPUT;
|
||||
gpio_config(&conf);
|
||||
|
||||
gpio_set_level(config->pin_reset, 0);
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
gpio_set_level(config->pin_reset, 1);
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
#if CONFIG_OV2640_SUPPORT
|
||||
} else {
|
||||
//reset OV2640
|
||||
|
||||
Reference in New Issue
Block a user