u/aeg: Add optional prefix for having multiple aeg UIs

This commit is contained in:
Mateo de Mayo 2023-01-25 17:21:58 -03:00
parent d22f58bee4
commit 60b996239c
4 changed files with 38 additions and 14 deletions

View file

@ -18,6 +18,7 @@
#include <assert.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
DEBUG_GET_ONCE_LOG_OPTION(aeg_log, "AEG_LOG", U_LOGGING_WARN)
@ -453,17 +454,41 @@ u_autoexpgain_create(enum u_aeg_strategy strategy, bool enabled_from_start, int
}
void
u_autoexpgain_add_vars(struct u_autoexpgain *aeg, void *root)
u_autoexpgain_add_vars(struct u_autoexpgain *aeg, void *root, char *prefix)
{
u_var_add_bool(root, &aeg->enable, "Update brightness automatically");
u_var_add_i32(root, &aeg->frame_delay, "Frame update delay");
u_var_add_combo(root, &aeg->strategy_combo, "Strategy");
u_var_add_draggable_f32(root, &aeg->brightness, "Brightness");
u_var_add_f32(root, &aeg->threshold, "Score threshold");
u_var_add_f32(root, &aeg->max_brightness_step, "Max brightness step");
u_var_add_ro_f32(root, &aeg->current_score, "Image score");
u_var_add_histogram_f32(root, &aeg->histogram_ui, "Intensity histogram");
u_var_add_log_level(root, &aeg->log_level, "AEG log level");
char tmp[256];
(void)snprintf(tmp, sizeof(tmp), "%sAuto exposure and gain control", prefix);
u_var_add_gui_header_begin(root, NULL, tmp);
(void)snprintf(tmp, sizeof(tmp), "%sUpdate brightness automatically", prefix);
u_var_add_bool(root, &aeg->enable, tmp);
(void)snprintf(tmp, sizeof(tmp), "%sFrame update delay", prefix);
u_var_add_i32(root, &aeg->frame_delay, tmp);
(void)snprintf(tmp, sizeof(tmp), "%sStrategy", prefix);
u_var_add_combo(root, &aeg->strategy_combo, tmp);
(void)snprintf(tmp, sizeof(tmp), "%sBrightness", prefix);
u_var_add_draggable_f32(root, &aeg->brightness, tmp);
(void)snprintf(tmp, sizeof(tmp), "%sScore threshold", prefix);
u_var_add_f32(root, &aeg->threshold, tmp);
(void)snprintf(tmp, sizeof(tmp), "%sMax brightness step", prefix);
u_var_add_f32(root, &aeg->max_brightness_step, tmp);
(void)snprintf(tmp, sizeof(tmp), "%sImage score", prefix);
u_var_add_ro_f32(root, &aeg->current_score, tmp);
(void)snprintf(tmp, sizeof(tmp), "%sIntensity histogram", prefix);
u_var_add_histogram_f32(root, &aeg->histogram_ui, tmp);
(void)snprintf(tmp, sizeof(tmp), "%sAEG log level", prefix);
u_var_add_log_level(root, &aeg->log_level, tmp);
u_var_add_gui_header_end(root, NULL, tmp);
}
void

View file

@ -39,7 +39,7 @@ u_autoexpgain_create(enum u_aeg_strategy strategy, bool enabled_from_start, int
//! Setup UI for the AEG algorithm
void
u_autoexpgain_add_vars(struct u_autoexpgain *aeg, void *root);
u_autoexpgain_add_vars(struct u_autoexpgain *aeg, void *root, char *prefix);
//! Update the AEG with a frame
void

View file

@ -248,7 +248,7 @@ rift_s_camera_create(struct xrt_prober *xp,
u_var_add_draggable_u16(cam, &cam->exposure_ui, "Exposure");
u_var_add_u8(cam, &cam->target_gain, "Gain");
u_var_add_gui_header(cam, NULL, "Auto exposure and gain control");
u_autoexpgain_add_vars(cam->aeg, cam);
u_autoexpgain_add_vars(cam->aeg, cam, "");
u_var_add_gui_header(cam, NULL, "Camera Streams");
u_var_add_sink_debug(cam, &cam->debug_sinks[0], "Tracking Streams");

View file

@ -464,8 +464,7 @@ wmr_camera_open(struct xrt_prober_device *dev_holo,
u_var_add_bool(cam, &cam->manual_control, "Manual exposure and gain control");
u_var_add_draggable_u16(cam, &cam->exposure_ui, "Exposure (usec)");
u_var_add_u8(cam, &cam->gain, "Gain");
u_var_add_gui_header(cam, NULL, "Auto exposure and gain control");
u_autoexpgain_add_vars(cam->aeg, cam);
u_autoexpgain_add_vars(cam->aeg, cam, "");
u_var_add_gui_header(cam, NULL, "Camera Streams");
u_var_add_sink_debug(cam, &cam->debug_sinks[0], "Tracking Streams");
u_var_add_sink_debug(cam, &cam->debug_sinks[1], "Controller Streams");