Browse Source

ui: display focus information, too.

Pavel Machek 2 tháng trước cách đây
mục cha
commit
474b2db2c9
1 tập tin đã thay đổi với 13 bổ sung6 xóa
  1. 13 6
      src/process_pipeline.c

+ 13 - 6
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",
+	/* Focus */
+	diopt = (state_proc.focus.value-focus_inf) / ((float) state_proc.focus.max-focus_inf);
+	diopt *= 30;
+
+	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) time, (float) gain, state_proc.gain.value, state_proc.dgain.value,
+	       (float) 1/diopt);
 
-	sprintf(buf, "1/%s%.0f%sISO%s%.0f", 
+	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);
 }