|
@@ -137,8 +137,8 @@ static const char *TAG = "example:take_picture";
|
|
|
|
|
|
|
|
#if ESP_CAMERA_SUPPORTED
|
|
#if ESP_CAMERA_SUPPORTED
|
|
|
static camera_config_t camera_config = {
|
|
static camera_config_t camera_config = {
|
|
|
- //.pin_pwdn = CAM_PIN_PWDN,
|
|
|
|
|
- //.pin_reset = CAM_PIN_RESET,
|
|
|
|
|
|
|
+ .pin_pwdn = CAM_PIN_PWDN,
|
|
|
|
|
+ .pin_reset = CAM_PIN_RESET,
|
|
|
.pin_xclk = CAM_PIN_XCLK,
|
|
.pin_xclk = CAM_PIN_XCLK,
|
|
|
.pin_sccb_sda = CAM_PIN_SIOD,
|
|
.pin_sccb_sda = CAM_PIN_SIOD,
|
|
|
.pin_sccb_scl = CAM_PIN_SIOC,
|
|
.pin_sccb_scl = CAM_PIN_SIOC,
|
|
@@ -165,7 +165,7 @@ static camera_config_t camera_config = {
|
|
|
|
|
|
|
|
.jpeg_quality = 12, //0-63, for OV series camera sensors, lower number means higher quality
|
|
.jpeg_quality = 12, //0-63, for OV series camera sensors, lower number means higher quality
|
|
|
.fb_count = 1, //When jpeg mode is used, if fb_count more than one, the driver will work in continuous mode.
|
|
.fb_count = 1, //When jpeg mode is used, if fb_count more than one, the driver will work in continuous mode.
|
|
|
- .fb_location = CAMERA_FB_IN_PSRAM,
|
|
|
|
|
|
|
+ .fb_location = CAMERA_FB_IN_DRAM,
|
|
|
.grab_mode = CAMERA_GRAB_WHEN_EMPTY,
|
|
.grab_mode = CAMERA_GRAB_WHEN_EMPTY,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -194,7 +194,13 @@ void take_photo(void)
|
|
|
{
|
|
{
|
|
|
ESP_LOGI(TAG, "Taking picture...");
|
|
ESP_LOGI(TAG, "Taking picture...");
|
|
|
camera_fb_t *pic = esp_camera_fb_get();
|
|
camera_fb_t *pic = esp_camera_fb_get();
|
|
|
-
|
|
|
|
|
|
|
+ if ( pic == NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ /* code */
|
|
|
|
|
+ ESP_LOGE(TAG, "Camera capture failed");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// use pic->buf to access the image
|
|
// use pic->buf to access the image
|
|
|
ESP_LOGI(TAG, "Picture taken! Its size was: %zu bytes", pic->len);
|
|
ESP_LOGI(TAG, "Picture taken! Its size was: %zu bytes", pic->len);
|
|
|
esp_camera_fb_return(pic);
|
|
esp_camera_fb_return(pic);
|