From 474b2db2c9644e318d01abf2bba4be1aa5004365 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Fri, 6 Sep 2024 12:20:33 +0200 Subject: [PATCH] ui: display focus information, too. --- src/process_pipeline.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/process_pipeline.c b/src/process_pipeline.c index c61ca5a..1a5e4d4 100644 --- a/src/process_pipeline.c +++ b/src/process_pipeline.c @@ -387,6 +387,7 @@ update_control(controlstate *control) static int focus; static int focus_phase; +static const int focus_inf = 200; static void auto_focus_start(void) @@ -426,7 +427,7 @@ auto_focus_step(const struct focus_stats *stats) } if (focus_phase < PH_SWEEP) { best_sharp = 0; - focus = 200; + focus = focus_inf; focus_phase ++; best_focus = 0; if (debug>1) printf("...prepare\n"); @@ -495,7 +496,7 @@ update_exp(controlstate *control, int direction) static void summarize() { - double time, gain; + double time, gain, diopt; bool portrait = (state_proc.device_rotation == 0 || state_proc.device_rotation == 180); char *sep = portrait ? " " : "\n"; char buf[2048]; @@ -510,13 +511,19 @@ summarize() if (1) /* dgain */ gain *= state_proc.dgain.value / ((float) state_proc.dgain.min); - printf("1/%.0f sec, ISO %.0f, t=%f, g=%f %d %d\n", - (float) (1.0/time), (float) (gain*100), - (float) time, (float) gain, state_proc.gain.value, state_proc.dgain.value); + /* Focus */ + diopt = (state_proc.focus.value-focus_inf) / ((float) state_proc.focus.max-focus_inf); + diopt *= 30; - sprintf(buf, "1/%s%.0f%sISO%s%.0f", + printf("1/%.0f sec, ISO %.0f, t=%f, g=%f %d %d, %.2f m\n", + (float) (1.0/time), (float) (gain*100), + (float) time, (float) gain, state_proc.gain.value, state_proc.dgain.value, + (float) 1/diopt); + + sprintf(buf, "1/%s%.0f%sISO%s%.0f%sm%s%.2f", sep, (float) (1.0/time), sep, - sep, (float) (gain*100)); + sep, (float) (gain*100), + sep, sep, 1/diopt); notify_auto_status(buf); }