zhunk 1 年之前
父節點
當前提交
b5d2961412
共有 1 個文件被更改,包括 3 次插入 和 1 次删除
  1. 3 1
      Application_cbd_apm32f1/applications/hmi.c

+ 3 - 1
Application_cbd_apm32f1/applications/hmi.c

@@ -1430,12 +1430,12 @@ void thread1_signal_handler(int sig)
                 if(g_last_rising){
                     g_peak_counter++;
                     LOG_I("[对焦] 检测到清晰度波动[%d/3]", g_peak_counter);
+                    stepSize = 2;
                 }else {
                     g_peak_counter = 0;  // 连续下降则重置
                 }
                 g_last_rising = false;
                 dir = !dir;             // 清晰度下降,反转方向
-                stepSize = 4;
                 LOG_I("[对焦] 清晰度下降,反转方向:%d 步长:%d", dir, stepSize);
             }
         }
@@ -1449,6 +1449,7 @@ void thread1_signal_handler(int sig)
 
         if(counter_sharpness_diff>=30){
             dir = !dir;
+            stepSize += 10; //增大步幅
             counter_sharpness_diff = 0;
         }
 
@@ -1473,6 +1474,7 @@ void thread1_signal_handler(int sig)
                 stepSize = 20;
                 dir = !dir;
                 current_pos = 0;
+                maxIterations = 100;
             }else{
                 counter_sharpness_diff = 0;
                 char *c0 = makeJson_Warn("auto_focus","auto_focus");