ae: use gain/dgain minimum values

This commit is contained in:
Pavel Machek
2024-09-04 11:15:47 +02:00
parent b5dbc416b5
commit 47772bde2e

View File

@@ -372,6 +372,9 @@ clamp_control(controlstate *control)
if (control->value_req > control->max) { if (control->value_req > control->max) {
control->value_req = control->max; control->value_req = control->max;
} }
if (control->value_req < control->min) {
control->value_req = control->min;
}
} }
static void static void
@@ -564,16 +567,15 @@ process_aaa()
update_exp(&state_proc.dgain, direction); update_exp(&state_proc.dgain, direction);
printf("D/Gain + %d\n", state_proc.dgain.value_req); printf("D/Gain + %d\n", state_proc.dgain.value_req);
} else { } else {
printf("AE: out of options\n"); printf("AE: way too dark\n");
//exit(1); /* HACK HACK don't merge */
} }
} else if (direction < 0) { } else if (direction < 0) {
// Preview is too bright // Preview is too bright
// Lower the sensor gain first to have less noise // Lower the sensor gain first to have less noise
if (state_proc.dgain.value > 256 /* state_proc.dgain.min FIXME */) { if (state_proc.dgain.value > state_proc.dgain.min) {
update_exp(&state_proc.dgain, direction); update_exp(&state_proc.dgain, direction);
printf("D/Gain - %d\n", state_proc.gain.value_req); printf("D/Gain - %d\n", state_proc.gain.value_req);
} else if (state_proc.gain.value > 0) { } else if (state_proc.gain.value > state_proc.gain.min) {
update_exp(&state_proc.gain, direction); update_exp(&state_proc.gain, direction);
printf("Gain - %d\n", state_proc.gain.value_req); printf("Gain - %d\n", state_proc.gain.value_req);
} else { } else {