zhunk пре 1 година
родитељ
комит
d8bed6830d

+ 1 - 16
Application_cbd_apm32f1/applications/control.h

@@ -19,24 +19,9 @@
 #define ROBOT_EN         0              //机器人
 #define Color_EN         0              //定制色诱
 #define BZYV2_EN         0              //孢子仪2.0
-#define BOOT_ERR         1              //1-新bootloader,0-旧bootloader()2023年9月份之前的设备升级需要设置为0
 ////////////////////////////////////////////////////////////////
-#if LAMP_EN == 1
-    #define VERSION_HK          "1.(3ledV9).41(HK)"      //4.0海康-三色光源
-    #define VERSION_HK_2000W    "1.3led.40(2000W)"       //水稻
-#else
-    #define VERSION_HK          "2.0.41(HK)"            //4.0海康-1200W
-    #define VERSION_HK_2000W    "2.0.4(2000W)"         //4.0水稻
-#endif
 
-#define VERSION_ZP          "1.45.1(ZP)"            //1.0转盘
-#define VERSION_GK          "1.41.1(GK)"            //1.0高空
-
-#define VERSION_XCT         "1.13.6(HK)"            //吸虫塔-海康
-#define VERSION_V5          "1.2.5(HK)"             //5.0
-#define VERSION_Robot       "1.0(robot)"            //展厅机器人
-
-#define VERSION_BZY         "2.0.0"                   //孢子仪
+#define VERSION_BZY         "2.1.0"                   //孢子仪
 
 
 /*********************************************************************/

+ 6 - 102
Application_cbd_apm32f1/applications/hmi.c

@@ -1128,104 +1128,7 @@ static void HMI_Decode(void)
     else if (strstr(rx_buffer,"DebugDisable")!=NULL) {
         Debug_log_OFF();
     }
-    //高空
-    else if (strstr(rx_buffer,"SwversionV11")!=NULL)
-    {
-        device_status.dtype = 3;
-        if(device_status.version_type != 11)
-        {
-            device_status.version_type = 11;
-            sprintf(device_status.driver, "%s",VERSION_GK);
-            ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
-            ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype));        //版本类型
-            MA_save();
-        }
-        else {
-
-        }
-    }
-    //1.0
-    else if (strstr(rx_buffer,"SwversionV1")!=NULL)
-    {
-        if(device_status.version_type != 1)
-        {
-            device_status.dtype = 3;
-            device_status.version_type = 1;
-            sprintf(device_status.driver, "%s",VERSION_ZP);
-            ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
-            ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype));        //版本类型
-            MA_save();
-        }
-        else {
-
-        }
-    }
-    //4.0
-    else if (strstr(rx_buffer,"SwversionV41")!=NULL) {
-        device_status.dtype = 3;
-        if(device_status.version_type != 41)
-        {
-            device_status.dtype = 3;
-            device_status.version_type = 41;
-            sprintf(device_status.driver, "%s",VERSION_HK);
-            ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
-            ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype));        //版本类型+
-            DTU_Write("SwversionV41");
-            MA_save();
-        }
-        else {
-
-        }
-    }
-    //水稻
-    else if (strstr(rx_buffer,"SwversionV4")!=NULL) {
-        device_status.dtype = 3;
-        if(device_status.version_type != 4)
-        {
-            device_status.version_type = 4;
-            sprintf(device_status.driver, "%s",VERSION_HK_2000W);
-            ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
-            ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype));        //版本类型
-            DTU_Write("SwversionV4");
-            MA_save();
-        }
-        else {
 
-        }
-    }
-    //5.0测报灯
-    else if (strstr(rx_buffer,"SwversionV5")!=NULL) {
-        device_status.dtype = 3;
-        if(device_status.version_type!=5)
-        {
-            device_status.version_type = 5;
-            sprintf(device_status.driver, "%s",VERSION_V5);
-            ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
-            ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype));        //版本类型
-            MA_save();
-        }
-    }
-    //吸虫塔
-    else if (strstr(rx_buffer,"SwversionV6")!=NULL) {
-        device_status.dtype = 3;
-        if(device_status.version_type != 6)
-        {
-            device_status.version_type = 6;
-            sprintf(device_status.driver, "%s",VERSION_XCT);
-            ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
-            ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype));        //版本类型
-            MA_save();
-        }
-    }
-    else if (strstr(rx_buffer,"SwversionV30")!=NULL) {
-        if(device_status.version_type != 30)
-        {
-            device_status.version_type = 30;
-            sprintf(device_status.driver, "%s",VERSION_Robot);
-            ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
-            MA_save();
-        }
-    }
     else if((strstr(rx_buffer,"SwversionV7")!=NULL)) {
         if(device_status.dtype!=7)
         {
@@ -1423,11 +1326,12 @@ void thread1_signal_handler(int sig)
                 counter_sharpness_reduce = 0;
             }
 
-            /* 方向策略调整 */
+            /* 方向策略调整,检测到清晰度变大 */
             if (current_sharpness > (g_last_sharpness - 3.5f)) { // 噪声容忍阈值3.0
                 // 保持方向,当接近峰值时自动减小步长
                 LOG_I("保持方向,当接近峰值时自动减小步长...");
                 g_last_rising = true;
+                stepSize += 2;          //动态调整步幅
             } else {
                 if(g_last_rising){
                     g_peak_counter++;
@@ -1455,13 +1359,13 @@ void thread1_signal_handler(int sig)
             counter_sharpness_diff = 0;
         }
 
-        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&&current_sharpness>g_best_sharpness-3.0f){
+        if(g_peak_counter>=3&&current_sharpness>g_best_sharpness-2.0f){
             focus_done = true;
         }else{
             focus_done = false;
-            g_best_sharpness -= 3.0f;   //降低阈值,防止找不到
+            g_best_sharpness -= 2.0f;   //降低阈值,防止找不到
         }
 
         /* 终止条件检测 */
@@ -1715,7 +1619,7 @@ void Check_ParamConfig(void)
         device_status.cul_time = 1;
         device_status.run_sta = 0;
         device_status.handle_bugger = 0;    //默认排虫
-        sprintf(device_status.driver, "%s",VERSION_HK);
+        sprintf(device_status.driver, "%s",VERSION_BZY);
         sprintf(device_status.deviceId,"0");
         rt_sprintf(device_status.tempture, "-15");
         rt_sprintf(device_status.humidity, "31");

+ 3 - 0
Application_cbd_apm32f1/readme.md

@@ -1,3 +1,6 @@
+# 2025-05-23 更新说明
+#define VERSION_BZY         "2.1.0"                   //孢子仪
+1. 自动对焦移植;
 # 2025-01-23 更新说明
 1.  项目重建,使用rtthread4.1.1版本;
 2. 串口驱动框架适配V2版本