|
@@ -1390,7 +1390,7 @@ void thread1_signal_handler(int sig)
|
|
|
}
|
|
}
|
|
|
g_initial_move = false;
|
|
g_initial_move = false;
|
|
|
} else {
|
|
} else {
|
|
|
- if(current_sharpness< g_last_sharpness){ //持续3次清晰度降低,调整行进方向
|
|
|
|
|
|
|
+ if(current_sharpness< (g_last_sharpness+0.5f)){ //持续3次清晰度降低,调整行进方向
|
|
|
counter_sharpness_reduce++;
|
|
counter_sharpness_reduce++;
|
|
|
LOG_I("[对焦] 清晰度下降,次数:%d", counter_sharpness_reduce);
|
|
LOG_I("[对焦] 清晰度下降,次数:%d", counter_sharpness_reduce);
|
|
|
if(counter_sharpness_reduce>=3){
|
|
if(counter_sharpness_reduce>=3){
|
|
@@ -1436,7 +1436,7 @@ void thread1_signal_handler(int sig)
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 终止条件检测 */
|
|
/* 终止条件检测 */
|
|
|
- if (stepSize < 1 || maxIterations <= 0 || g_peak_counter >= 3) {
|
|
|
|
|
|
|
+ if (maxIterations <= 0 || g_peak_counter >= 3) {
|
|
|
LOG_I("[对焦] 完成搜索,最佳位置:%d (清晰度:%.2f)", g_best_pos, g_best_sharpness);
|
|
LOG_I("[对焦] 完成搜索,最佳位置:%d (清晰度:%.2f)", g_best_pos, g_best_sharpness);
|
|
|
if (g_peak_counter >= 3) {
|
|
if (g_peak_counter >= 3) {
|
|
|
LOG_I("[对焦] 连续三次波动确认峰值");
|
|
LOG_I("[对焦] 连续三次波动确认峰值");
|
|
@@ -1447,6 +1447,7 @@ void thread1_signal_handler(int sig)
|
|
|
{
|
|
{
|
|
|
maxIterations = 120;
|
|
maxIterations = 120;
|
|
|
dir = !dir;
|
|
dir = !dir;
|
|
|
|
|
+ current_pos = 0;
|
|
|
}else{
|
|
}else{
|
|
|
char *c0 = makeJson_Warn("auto_focus","auto_focus");
|
|
char *c0 = makeJson_Warn("auto_focus","auto_focus");
|
|
|
DTU_Write("%s",c0);
|
|
DTU_Write("%s",c0);
|