Add -camera-auto-focus option

This commit is contained in:
Kamil Trzcinski 2022-07-07 12:08:56 +02:00
parent b16c686032
commit 1f5262afd8
3 changed files with 8 additions and 2 deletions

View File

@ -56,8 +56,7 @@ camera_options_t camera_options = {
.high_res_factor = 1.0,
.low_res_factor = 0.0,
.auto_reconnect = 0,
.options =
"aftrigger=1",
.options = "",
.h264 = {
.options =
"video_bitrate_mode=0" OPTION_VALUE_LIST_SEP
@ -97,6 +96,7 @@ option_value_t camera_formats[] = {
{ "RGBP", V4L2_PIX_FMT_RGB565 },
{ "RGB24", V4L2_PIX_FMT_RGB24 },
{ "RGB", V4L2_PIX_FMT_RGB24 },
{ "BGR", V4L2_PIX_FMT_BGR24 },
{}
};
@ -119,6 +119,7 @@ option_t all_options[] = {
DEFINE_OPTION(camera, low_res_factor, float),
DEFINE_OPTION_PTR(camera, options, list),
DEFINE_OPTION(camera, auto_reconnect, uint),
DEFINE_OPTION(camera, auto_focus, bool, "1"),
DEFINE_OPTION_PTR(camera, isp.options, list),
DEFINE_OPTION_PTR(camera, jpeg.options, list),

View File

@ -88,6 +88,10 @@ int camera_set_params(camera_t *camera)
device_set_option_list(camera->camera, camera->options.options);
device_set_option_list(camera->isp, camera->options.isp.options);
if (camera->options.auto_focus) {
device_set_option_string(camera->camera, "AfTrigger", "1");
}
// Set some defaults
for (int i = 0; i < 2; i++) {
device_set_option_list(camera->legacy_isp[i], camera->options.isp.options);

View File

@ -22,6 +22,7 @@ typedef struct camera_options_s {
bool allow_dma;
float high_res_factor;
float low_res_factor;
bool auto_focus;
unsigned auto_reconnect;
char options[CAMERA_OPTIONS_LENGTH];