Skip to content

Commit

Permalink
camera: vertical flip for OV5640 (for diy devices, eg. T-Display S3 PRO)
Browse files Browse the repository at this point in the history
  • Loading branch information
odudex authored and JamieDriver committed Dec 6, 2024
1 parent 125fdf5 commit 7f6b361
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion main/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ static void jade_camera_init(void)

sensor_t* camera_sensor = esp_camera_sensor_get();
JADE_ASSERT(camera_sensor);
JADE_ASSERT(camera_sensor->set_hmirror);

camera_sensor_info_t* camera_info = esp_camera_sensor_get_info(&camera_sensor->id);
JADE_ASSERT(camera_info);
Expand All @@ -299,12 +298,22 @@ static void jade_camera_init(void)

// GC0308 appears to need image flipping on both axes
if (camera_info->model == CAMERA_GC0308) {
JADE_ASSERT(camera_sensor->set_hmirror);
JADE_ASSERT(camera_sensor->set_vflip);
const int hret = camera_sensor->set_hmirror(camera_sensor, 1);
const int vret = camera_sensor->set_vflip(camera_sensor, 1);
if (hret || vret) {
JADE_LOGE("Failed to set camera hmirror/vflip, returned: %d/%d", hret, vret);
}
}
// OV5640 needs vertical flip for T-Display S3 PRO
else if (camera_info->model == CAMERA_OV5640) {
JADE_ASSERT(camera_sensor->set_vflip);
const int vret = camera_sensor->set_vflip(camera_sensor, 1);
if (vret) {
JADE_LOGE("Failed to set camera vflip, returned: %d", vret);
}
}
#if defined(CONFIG_DISPLAY_TOUCHSCREEN)
touchscreen_deinit();
touchscreen_init();
Expand Down

0 comments on commit 7f6b361

Please sign in to comment.