Browse Source

auto: tweak debugging

Pavel Machek 2 months ago
parent
commit
5fd1e09059
1 changed files with 10 additions and 7 deletions
  1. 10 7
      src/process_pipeline.c

+ 10 - 7
src/process_pipeline.c

@@ -401,22 +401,22 @@ struct focus_stats {
 static void auto_focus_step(const struct focus_stats *stats)
 {
 	static uint64_t best_sharp, best_focus;
-	static const bool debug = true;
+	static const int debug = 1;
 
-	if (debug) printf("Phase %d, sharp %d best %d ", focus_phase, (int)(stats->sharp / 10000), (int)(best_sharp/ 10000));	
 	if (focus_phase >= PH_DONE) {
+		if (debug>1) printf("Phase %d, sharp %d best %d ", focus_phase, (int)(stats->sharp / 10000), (int)(best_sharp/ 10000));	
 		focus_phase++;
 		if (stats->sharp > (best_sharp * 2)) {
-			if (debug) printf("Improved on its own.\n");
+			if (debug>1) printf("Improved on its own.\n");
 			auto_focus_start();
 			return;
 		}
 		if (stats->sharp < (best_sharp * 6) / 10) {
-			if (debug) printf("Lost, restart.\n");
+			if (debug>1) printf("Lost, restart.\n");
 			auto_focus_start();
 			return;
 		}
-		if (debug) printf("Idle @ %d.\n", focus);
+		if (debug>1) printf("Idle @ %d.\n", focus);
 		return;
 	}
 	if (focus_phase < PH_SWEEP) {
@@ -424,9 +424,11 @@ static void auto_focus_step(const struct focus_stats *stats)
 		focus = 200;
 		focus_phase ++;
 		best_focus = 0;
-		if (debug) printf("...prepare\n");
+		if (debug>1) printf("...prepare\n");
 		goto set;
 	}
+	if (debug)
+		printf("Phase %d, sharp %d best %d ", focus_phase, (int)(stats->sharp / 10000), (int)(best_sharp/ 10000));
 	if (stats->sharp > best_sharp) {
 		if (debug) printf("Still improving, focus %d\n", focus);
 		best_focus = focus;
@@ -473,6 +475,7 @@ focus_stats(struct focus_stats *stats, const unsigned int *frame, const int widt
 	stats->sharp = sharp;
 }
 
+/* This does approximately 1.3 EV steps */
 static void update_exp(controlstate *control, int direction)
 {
 	int step = 0;
@@ -534,7 +537,7 @@ process_aaa()
                                 printf("D/Gain + %d\n", state_proc.dgain.value_req);
 			} else {
 				printf("AE: out of options\n");
-				exit(1); /* HACK HACK don't merge */
+				//exit(1); /* HACK HACK don't merge */
 			}
                 } else if (direction < 0) {
                         // Preview is too bright