zhunk 1 год назад
Родитель
Сommit
019118beb2

+ 45 - 25
Application_CBD/applications/control.c

@@ -1502,6 +1502,18 @@ void calorstat(uint16_t heat_time)
                 if(device_status.heattem>device_status.run_sta + 1){
                     device_status.run_sta = device_status.heattem;
                 }
+                //如果触发异常退出加热
+                if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
+                {
+                    rt_thread_delay(1000);
+                    if(device_status.bat_status == 1)
+                    {
+                        LOG_W("============================触发异常退出加热==========================");
+                        ctr_lamp(OFF,1);
+                        ctr_Heat(OFF);
+                        break;
+                    }
+                }
             }
             delay_heat = 60;
             //跳出FOR循环
@@ -2550,38 +2562,26 @@ void WorkTask(void)
             //2022-04-12add:
              LOG_I("打开上仓门!!!");
              HMI_WRITE("workSta.g0.txt=\"打开上仓门!\"");
-             device_status.ctr_up_motor = 1;
+             if(device_status.rain_status==0)
+             {
+                 device_status.ctr_up_motor = 1;
+             }
             if(device_status.version_type==4||device_status.version_type==41||strstr(device_status.project,"A7_RTU_V3")!=RT_NULL)
             {
                 //震动
                 ctr_shake(ON, device_status.shake_sec);
-                //补光&&拍照
-                LOG_I("拍照!!!");
-                HMI_WRITE("workSta.g0.txt=\"拍照!\"");
-                ctr_led(ON);
-                HK_TakePhoto();
-                //清扫
-                device_status.clear_status=1;
+                device_status.photo_ws = 1;
+//                //补光&&拍照
+//                LOG_I("拍照!!!");
+//                HMI_WRITE("workSta.g0.txt=\"拍照!\"");
+//                ctr_led(ON);
+//                HK_TakePhoto();
+//                //清扫
+//                device_status.clear_status=1;
                 //清扫失效则使用震动
                 //ctr_shake(ON, 100);
             }
         }
-        else {
-                    //打开高压
-                    ctr_Heat(ON);
-                    //打开补光
-                    ctr_led(ON);
-                    LOG_I("打开补光!!");
-                    rt_pin_mode(CLEAR_L_LIMIT,PIN_MODE_INPUT);
-                    //2.翻转清虫
-                    while(rt_pin_read(CLEAR_L_LIMIT)==1)  rt_thread_delay(20);
-                    rt_thread_delay(500);
-                    Hk_Take_io();  //触发海康相机拍照
-                    rt_thread_delay(500);
-                    ctr_turnv5();  //摆动清虫
-                    LOG_I("摆动清虫!");
-
-        }
    }
         if(device_status.bat_status == 1 || device_status.temp_status == 1 || device_status.rain_status==1 || device_status.ds==0)
         {
@@ -2650,6 +2650,7 @@ static void Control_Clear_thread_entry(void *parameter)
 {
     static int selfcheck_cnt = 0;
     float voltage_f = 0.0;
+    static uint8_t rain_clear = 0;
     while(1)
     {
         #if ROBOT_EN ==1
@@ -2715,9 +2716,28 @@ static void Control_Clear_thread_entry(void *parameter)
         if(device_status.selfcheck_ws==0){
             selfcheck_cnt = 0;
         }
+        if(device_status.rain_status==2)
+        {
+            while(device_status.ctr_up_motor!=0)    //等待上仓门完全打开
+            {
+                rt_thread_delay(1000);
+            }
+            device_status.ctr_up_motor = 2;  //关闭上仓门
+            calorstat(5*60);                 //加热5分钟
+            device_status.ctr_down_motor = 1;   //打开下仓门
+            while(device_status.ctr_down_motor!=0)    //等待下仓门完全打开
+            {
+                rt_thread_delay(1000);
+            }
+            rt_thread_delay(1000);
+            device_status.ctr_down_motor = 2;  //关闭下仓门
+            ctr_shake(ON, 5);                //震动0.5S钟
+            device_status.clear_status= 1;
+            device_status.rain_status = 0;   //解除雨控
+        }
         if(device_status.clear_status==1)
         {
-            if(ctr_clear(1200)==0)
+            ///if(ctr_clear(1200)==0)
             ctr_TG_Clear(400);
         }
         rt_thread_delay(100);

+ 4 - 4
Application_CBD/applications/control.h

@@ -30,8 +30,8 @@
     #define VERSION_HK_2000W    "1.57.40(2000W)"         //4.0水稻
 #endif
 
-#define VERSION_ZP          "1.47.1(ZP)"            //1.0转盘
-#define VERSION_GK          "1.44.1(GK)"            //1.0高空
+#define VERSION_ZP          "1.58.1(ZP)"            //1.0转盘
+#define VERSION_GK          "1.58.1(GK)"            //1.0高空
 
 #define VERSION_XCT         "1.13.6(HK)"            //吸虫塔-海康
 #define VERSION_V5          "1.2.5(HK)"             //5.0
@@ -82,8 +82,8 @@ typedef struct  _packed
     uint8_t clear_status;    //清扫状态   0-停止 1-开始
     uint8_t shake_ws;        //震动       0-关   1-开
     uint8_t heatvalue;       //加热设定温度
-    uint8_t ctr_up_motor;    //上仓门,    1打开,0关闭
-    uint8_t ctr_down_motor;  //下仓门,    1打开,0关闭
+    uint8_t ctr_up_motor;    //上仓门,    1打开,2关闭
+    uint8_t ctr_down_motor;  //下仓门,    1打开,2关闭
     uint8_t rain_status;     //雨控              0-正常 1-欠压
     uint8_t temp_status;     //温控              0-正常 1-温控
     uint8_t sun_status;      //光控              0-正常 1-光控

+ 3 - 76
Application_CBD/applications/hmi.c

@@ -1485,97 +1485,38 @@ static void Ctr_Mortor_entry(void* parameter)
         #endif
         if(device_status.ctr_up_motor==1)
         {
-            #if 0
-            if(num_up_open==200&&device_status.clear_status==0&&device_status.work_status==1)
-            {
-                motor_current = atoi(device_status.power);
-                LOG_D("上仓门待机电流:%d",motor_current);
-            }
-            //打开上仓门
-            if(num_up_open<200)
-            #endif
             ctr_cangmen_up(OPEN);
             num_up_open--;
-//            current_t[num_up_open] = atoi(device_status.power);
             if (num_up_open == 0)
             {
                 ctr_cangmen_up(OFF);
                 num_up_open = 200;
-//                bubblesort(current_t, 200);
-//                if(current_t[199]-motor_current<100&&device_status.clear_status==0&&device_status.work_status==1&&motor_current!=0&&motor_current<5000)
-//                {
-//                    LOG_E("上仓门打开电机电流不足:%d!!!",current_t[199]);
-//                    char * ctr_cm_up_warn = makeJson_Warn("电流不足,打开", "上仓门电机");
-//                    DTU_Write("%s",ctr_cm_up_warn);
-//                    rt_free(ctr_cm_up_warn);
-//                }
             }
-//            else {
-//                LOG_D("上仓门打开电流:%d",current_t[num_up_open]);
-//            }
         }
         else if(device_status.ctr_up_motor==2)
         {
-//            if(num_up_close==200&&device_status.clear_status==0&&device_status.work_status==1)
-//            {
-//                motor_current = atoi(device_status.power);
-//                LOG_D("上仓门待机电流:%d",motor_current);
-//            }
-//            if(num_up_close<200)
             ctr_cangmen_up(CLOSE);
             num_up_close --;
-//            current_t[num_up_close] = atoi(device_status.power);
             if (num_up_close == 0)
             {
                 ctr_cangmen_up(OFF);
                 num_up_close= 200;
-//                bubblesort(current_t, 200);
-//                if(current_t[199]-motor_current<100&&device_status.clear_status==0&&device_status.work_status==1&&motor_current!=0&&motor_current<5000)
-//                {
-//
-//                    LOG_E("上仓门电机电流不足!!!-%d",current_t[199]);
-//                    char * ctr_cm_up_warn = makeJson_Warn("电流不足,关闭", "上仓门电机");
-//                    DTU_Write("%s",ctr_cm_up_warn);
-//                    rt_free(ctr_cm_up_warn);
-//                }
             }
-            //LOG_D("上仓门关闭电流:%d",current_t[num_up_close]);
         }
         if (device_status.ctr_down_motor == 1)
         {
-//            if(num_down_open==200&&device_status.clear_status==0&&device_status.work_status==1)
-//            {
-//                motor_current = atoi(device_status.power);
-//                LOG_D("下仓门待机电流:%d",motor_current);
-//            }
-//            if(num_down_open<200)
             ctr_cangmen_down(OPEN);
             num_down_open--;
-//            current_t[num_down_open] = atoi(device_status.power);
             //如果关闭仓门1S后检测不到电流增大,则判定为异常
             if (num_down_open == 0)
             {
                 ctr_cangmen_down(OFF);
                 num_down_open = 200;
-//                bubblesort(current_t, 200);
-//                if (current_t[199]-motor_current<100&&device_status.clear_status==0&&device_status.work_status==1&&motor_current!=0&&motor_current<5000)
-//                {
-//                    LOG_E("下仓门电机电流不足!!!-%d",current_t[199]);
-//                    char * ctr_cm_down_warn = makeJson_Warn("电流不足,打开", "下仓门电机");
-//                    DTU_Write("%s",ctr_cm_down_warn);
-//                    rt_free(ctr_cm_down_warn);
-//                }
             }
 //            LOG_D("下仓门打开电流:%d",current_t[num_down_open]);
         }
         else if (device_status.ctr_down_motor == 2)
         {
-//            if(num_down_close==200&&device_status.clear_status==0&&device_status.work_status==1)
-//            {
-//                motor_current = atoi(device_status.power);
-//                LOG_D("下仓门待机电流:%d",motor_current);
-//            }
-//            if(num_down_close<200)
             ctr_cangmen_down(CLOSE);
             num_down_close--;
 //            current_t[num_down_close] = atoi(device_status.power);
@@ -1584,16 +1525,6 @@ static void Ctr_Mortor_entry(void* parameter)
             {
                ctr_cangmen_down(OFF);
                num_down_close = 200;
-//               bubblesort(current_t, 200);
-//               //如果关闭仓门5S后检测不到电流增大,则判定为异常
-//               if (current_t[199]-motor_current<100&&device_status.clear_status==0&&device_status.work_status==1&&motor_current!=0&&motor_current<5000)
-//               {
-//                   LOG_E("下仓门关闭电机电流不足!!!-%d",current_t[199]);
-//                   char * ctr_cm_down_warn = makeJson_Warn("电流不足,关闭", "下仓门电机");
-//                   DTU_Write("%s",ctr_cm_down_warn);
-//                   rt_free(ctr_cm_down_warn);
-//
-//               }
             }
 //            LOG_D("下仓门关闭电流:%d",current_t[num_down_close]);
         }
@@ -1638,16 +1569,12 @@ static void Ctr_Mortor_entry(void* parameter)
                 ctr_led(OFF);
                 photo_led_sec = 900;
                 device_status.photo_ws = 0;
+                if(device_status.work_status = 1){
+                    device_status.clear_status = 1;
+                }
                 HMI_WRITE("sysTest.switchPhoto.val=0");
                 HMI_WRITE("sysTest.switchFill.val=0");
             }
-//            else if (photo_led_sec==0&&device_status.version_type!=48) {
-//                ctr_led(OFF);
-//                photo_led_sec = 900;
-//                device_status.photo_ws = 0;
-//                HMI_WRITE("sysTest.switchPhoto.val=0");
-//                HMI_WRITE("sysTest.switchFill.val=0");
-//            }
         }else{
             photo_led_sec = 900;
         }

+ 0 - 4
Application_CBD/applications/main.c

@@ -112,19 +112,15 @@ static int wdt_init(void)
 static void idle_hook(void)
 {
     #if 1
-    #if Color_EN == 0
     time_t now;
     time(&now);
     static struct tm alarm_new;
     alarm_new =*localtime(&now);
     if((alarm_new.tm_hour)==8&&(alarm_new.tm_min==20)&&(alarm_new.tm_sec==0))
     {
-        #if ROBOT_EN == 0
         rt_hw_cpu_reset();
-        #endif
     }
     #endif
-    #endif
 //    else {
 //        rt_kprintf("%d:%d:%d\n",alarm_new.tm_hour,alarm_new.tm_min,alarm_new.tm_sec);
 //    }

+ 8 - 6
Application_CBD/applications/sht30_collect.c

@@ -200,7 +200,7 @@ static void sht30_collect_thread_entry(void *parameter)
 }
 static void Power_ReadCheck(void *parameter)
 {
-    int rain_cnt = 0;
+    rt_uint32_t rain_cnt = 0;
     int bat_cnt = 0;
     int RV;
     MovingAverageFilter* filter = moving_average_filter_init(10);
@@ -298,18 +298,20 @@ static void Power_ReadCheck(void *parameter)
             }
             else {
                 rain_cnt++;
-                //雨控消抖,1分钟
-                if(rain_cnt==600&&Read_Rain_Voltage()<250)
+                //雨控消抖,5分钟
+                if(rain_cnt==3000&&Read_Rain_Voltage()<250)
                 {
+                    LOG_D("雨控触发:%d",Read_Rain_Voltage());
                     rain_cnt = 0;
                     #if DZ_250723 == 0
-                    device_status.rain_status = 0;
+                    device_status.rain_status = 2;
+                    device_status.ctr_up_motor = 1;    //打开上仓门
                     #endif
                 }
             }
-            LOG_D("rain_cnt:%d-value:%d",rain_cnt,Read_Rain_Voltage());
+            //LOG_D("rain_cnt:%d-value:%d",rain_cnt,Read_Rain_Voltage());
         }
-        if(bat_cnt>=15){  //持续10s
+        if(bat_cnt>=100){  //持续10s
             bat_cnt = 0;
             device_status.bat_status = 1; //欠压
         }

+ 10 - 0
Application_CBD/readme.md

@@ -1,7 +1,17 @@
+# 2025-08-08 更新说明
+	#define VERSION_HK          "1.58.41(HK)"            //4.0海康-1200W
+    #define VERSION_HK_2000W    "1.58.40(2000W)"         //4.0水稻
+	#define VERSION_ZP          "1.58.1(ZP)"            //1.0转盘
+	#define VERSION_GK          "1.58.1(GK)"            //1.0高空
+	1. 针对雨控触发的更新:
+		触发雨控后的解除时间调整:检测到雨控解除持续5分钟后,打开上仓门后关闭上仓门,加热5分钟,打开下仓门,震动,执行清扫;
+		雨控触发过程中无法手动执行清扫;
+	2. 工作流程优化,震动之后进入收集模式,拍照清扫并行执行,工作状态下拍照后自动执行清扫;
 # 2025-07-31 更新说明
 	1. 优化DTU串口发送
 	2. 雨控触发立即关闭上仓门
 	3. 修复设置温湿度没有free
+	4. 启用定时重启
 # 2025-07-23 更新说明
 	1. 定制:水稻版本更新1.56dz.40(2000W)
 	2. 8:20后触发雨控当天不再解除隔天解除;

BIN
Application_cbd_apm32f1/Debug/rtthread.rbl