|
@@ -1363,7 +1363,7 @@ void thread2_signal_handler(int sig)
|
|
|
rt_timer_stop(timer_takephoto);
|
|
rt_timer_stop(timer_takephoto);
|
|
|
maxIterations--;
|
|
maxIterations--;
|
|
|
LOG_I("[Y] 清晰度值更新:%.2f", device_status.focus_value);
|
|
LOG_I("[Y] 清晰度值更新:%.2f", device_status.focus_value);
|
|
|
- slide_para.pulse_period = mapSpeed(slide_para.pulse_period); // 更新电机速度参数
|
|
|
|
|
|
|
+ slide_para.pulse_period = mapSpeed(50); // 更新电机速度参数
|
|
|
if(device_status.calibrate_slide==20&& maxIterations >= 0){
|
|
if(device_status.calibrate_slide==20&& maxIterations >= 0){
|
|
|
float current_sharpness = device_status.focus_value;
|
|
float current_sharpness = device_status.focus_value;
|
|
|
/* 更新全局最佳状态 */
|
|
/* 更新全局最佳状态 */
|
|
@@ -1387,6 +1387,7 @@ void thread2_signal_handler(int sig)
|
|
|
LOG_I("[Y] 清晰度变化累计%d次小于1.0",counter_sharpness_diff);
|
|
LOG_I("[Y] 清晰度变化累计%d次小于1.0",counter_sharpness_diff);
|
|
|
if(counter_sharpness_diff>1&&diff_sharpness>100.0){
|
|
if(counter_sharpness_diff>1&&diff_sharpness>100.0){
|
|
|
//停止,保存当前位置
|
|
//停止,保存当前位置
|
|
|
|
|
+ device_status.calibrate_slide = 0;
|
|
|
device_status.y_init_dis = slide_para.ystep;
|
|
device_status.y_init_dis = slide_para.ystep;
|
|
|
LOG_I("设置Y轴初始位置:%d",slide_para.ystep);
|
|
LOG_I("设置Y轴初始位置:%d",slide_para.ystep);
|
|
|
ef_set_env_blob("y_init_dis", &device_status.y_init_dis, sizeof(device_status.y_init_dis));
|
|
ef_set_env_blob("y_init_dis", &device_status.y_init_dis, sizeof(device_status.y_init_dis));
|
|
@@ -1514,11 +1515,12 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
if(device_status.autotakepic == 4)
|
|
if(device_status.autotakepic == 4)
|
|
|
{
|
|
{
|
|
|
device_status.autotakepic = 2;
|
|
device_status.autotakepic = 2;
|
|
|
- g_best_sharpness = -FLT_MAX; // 全局最佳清晰度
|
|
|
|
|
|
|
+ g_best_sharpness = 0.0; // 全局最佳清晰度
|
|
|
g_best_pos = 0; // 全局最佳位置
|
|
g_best_pos = 0; // 全局最佳位置
|
|
|
- g_last_sharpness = -FLT_MAX; // 上一次移动后的清晰度
|
|
|
|
|
|
|
+ g_last_sharpness = 0.0; // 上一次移动后的清晰度
|
|
|
g_initial_move = true; // 初始方向判断标志
|
|
g_initial_move = true; // 初始方向判断标志
|
|
|
maxIterations = 100;
|
|
maxIterations = 100;
|
|
|
|
|
+ counter_sharpness_diff = 0;
|
|
|
dir = 1;
|
|
dir = 1;
|
|
|
stepSize = 20; // 初始步长(单位:步进电机脉冲数)
|
|
stepSize = 20; // 初始步长(单位:步进电机脉冲数)
|
|
|
current_pos = 0; // 根据实际类型修改(int/float等)
|
|
current_pos = 0; // 根据实际类型修改(int/float等)
|