Skip to content

Commit

Permalink
merge issues and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rzeldent committed Mar 10, 2024
1 parent 71079f4 commit 312d916
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion boards/esp32cam_m5stack_camera.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'",
"'-D CAMERA_CONFIG_FB_COUNT=1'",
"'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'",
"'-D SCCB_I2C_PORT=I2C_NUM_0'"
"'-D SCCB_I2C_PORT=I2C_NUM_0'",
"'-D GROVE_SDA=13'",
"'-D GROVE_SCL=4'"
],
Expand Down
2 changes: 1 addition & 1 deletion boards/esp32cam_m5stack_camera_psram.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'",
"'-D CAMERA_CONFIG_FB_COUNT=2'",
"'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'",
"'-D SCCB_I2C_PORT=I2C_NUM_0'"
"'-D SCCB_I2C_PORT=I2C_NUM_0'",
"'-D GROVE_SDA=13'",
"'-D GROVE_SCL=4'"
],
Expand Down
2 changes: 1 addition & 1 deletion boards/esp32cam_m5stack_esp32cam.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'",
"'-D CAMERA_CONFIG_FB_COUNT=2'",
"'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'",
"'-D SCCB_I2C_PORT=I2C_NUM_0'"
"'-D SCCB_I2C_PORT=I2C_NUM_0'",
"'-D MICROPHONE_GPIO=32'",
"'-D GROVE_SDA=13'",
"'-D GROVE_SCL=4'"
Expand Down
2 changes: 1 addition & 1 deletion boards/esp32cam_ttgo_t_camera.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'",
"'-D CAMERA_CONFIG_FB_COUNT=1'",
"'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'",
"'-D SCCB_I2C_PORT=I2C_NUM_0'"
"'-D SCCB_I2C_PORT=I2C_NUM_0'",
"'-D LCD_SSD1306_PIN_SDA=21'",
"'-D LCD_SSD1306_PIN_SCL=22'",
"'-D BUTTON_RIGHT_PIN=34'",
Expand Down
15 changes: 5 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,12 @@ esp_err_t initialize_camera()
{
log_v("initialize_camera");

constexpr auto pixformat = PIXFORMAT_JPEG;
log_i("Frame size: %s", param_frame_size.value());
auto frame_size = lookup_frame_size(param_frame_size.value());
log_i("JPEG quality: %d", param_jpg_quality.value());
auto jpeg_quality = param_jpg_quality.value();
log_i("Frame duration: %d ms", param_frame_duration.value());
camera_config_t camera_config = {
const camera_config_t camera_config = {
.pin_pwdn = CAMERA_CONFIG_PIN_PWDN, // GPIO pin for camera power down line
.pin_reset = CAMERA_CONFIG_PIN_RESET, // GPIO pin for camera reset line
.pin_xclk = CAMERA_CONFIG_PIN_XCLK, // GPIO pin for camera XCLK line
Expand All @@ -239,7 +238,7 @@ esp_err_t initialize_camera()
.xclk_freq_hz = CAMERA_CONFIG_CLK_FREQ_HZ, // Frequency of XCLK signal, in Hz. EXPERIMENTAL: Set to 16MHz on ESP32-S2 or ESP32-S3 to enable EDMA mode
.ledc_timer = CAMERA_CONFIG_LEDC_TIMER, // LEDC timer to be used for generating XCLK
.ledc_channel = CAMERA_CONFIG_LEDC_CHANNEL, // LEDC channel to be used for generating XCLK
.pixel_format = pixformat, // Format of the pixel data: PIXFORMAT_ + YUV422|GRAYSCALE|RGB565|JPEG
.pixel_format = PIXFORMAT_JPEG, // Format of the pixel data: PIXFORMAT_ + YUV422|GRAYSCALE|RGB565|JPEG
.frame_size = frame_size, // Size of the output image: FRAMESIZE_ + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA
.jpeg_quality = jpeg_quality, // Quality of JPEG output. 0-63 lower means higher quality
.fb_count = CAMERA_CONFIG_FB_COUNT, // Number of frame buffers to be allocated. If more than one, then each frame will be acquired (double speed)
Expand Down Expand Up @@ -337,11 +336,8 @@ void setup()
log_i("Board: %s", BOARD_NAME);
log_i("Starting " APP_TITLE "...");

if (CAMERA_CONFIG_FB_LOCATION == CAMERA_FB_IN_PSRAM)
{
if (!psramInit())
log_e("Failed to initialize PSRAM");
}
if (CAMERA_CONFIG_FB_LOCATION == CAMERA_FB_IN_PSRAM && !psramInit())
log_e("Failed to initialize PSRAM");

param_group_camera.addItem(&param_frame_duration);
param_group_camera.addItem(&param_frame_size);
Expand Down Expand Up @@ -388,6 +384,7 @@ void setup()
break;
}

esp_camera_deinit();
log_e("Failed to initialize camera. Error: 0x%0x. Frame size: %s, frame rate: %d ms, jpeg quality: %d", camera_init_result, param_frame_size.value(), param_frame_duration.value(), param_jpg_quality.value());
delay(500);
}
Expand All @@ -411,6 +408,4 @@ void loop()

if (camera_server)
camera_server->doLoop();

sleep(0);
}

0 comments on commit 312d916

Please sign in to comment.