Sfoglia il codice sorgente

修复不能连续自检问题

zhunk 2 anni fa
parent
commit
80036d738d

+ 38 - 29
Application_CBD/applications/control.c

@@ -1583,6 +1583,10 @@ void HardWare_Init(uint8_t boot)
     //关闭12V供电(海康相机,RTU)
     //关闭12V供电(海康相机,RTU)
     ctr_photo(OFF);
     ctr_photo(OFF);
 
 
+    //关闭清扫电机驱动
+    ctr_clear(OFF);
+
+
 }
 }
 //拍照
 //拍照
 void HK_TakePhoto(void)
 void HK_TakePhoto(void)
@@ -2702,38 +2706,43 @@ static void Control_Heat_thread_entry(void *parameter)
         }
         }
         else
         else
         {
         {
-            LOG_I("Not calorstat!");
-        }
-        if(device_status.work_status==1&&device_status.version_type==5)
-        {
-            var_clear++;
-            if(var_clear==300)
+            LOG_I("Not calorstat!-%d",device_status.selfcheck_ws);
+            if(device_status.selfcheck_ws==2)
             {
             {
-                var_clear = 0;
-                ctr_cangmen_down(ON);
-                rt_thread_mdelay(5000);
-                ctr_cangmen_down(OFF);
-                rt_thread_mdelay(500);
-                ctr_cangmen_down(ON);
-                rt_thread_mdelay(5000);
-                ctr_cangmen_down(OFF);
-            }
-        }
-        if(device_status.selfcheck_ws==2)
-        {
-            static int total_seconds = 200;
-            static int current_second = 0;
-            while(current_second <= total_seconds)
-            {
-                int process = (current_second * 100) / total_seconds;
-                device_status.process = process / 100.0;
-                LOG_I("process:%d",process);
-                HMI_WRITE("selfcheck.s106.val=%d",process);
-                rt_thread_delay(1000);
-                current_second++;
+                static int total_seconds = 200;
+                static int current_second = 0;
+                while(current_second <= total_seconds)
+                {
+                    int process = (current_second * 100) / total_seconds;
+                    device_status.process = process / 100.0;
+                    LOG_I("process:%d",process);
+                    HMI_WRITE("selfcheck.s106.val=%d",process);
+                    rt_thread_delay(1000);
+                    current_second++;
+                    if(device_status.selfcheck_ws==0)
+                    {
+                        HMI_WRITE("selfcheck.s106.val=1");
+                        break;
+                    }
+                }
             }
             }
-            device_status.selfcheck_ws = 0;
         }
         }
+//        if(device_status.work_status==1&&device_status.version_type==5)
+//        {
+//            var_clear++;
+//            if(var_clear==300)
+//            {
+//                var_clear = 0;
+//                ctr_cangmen_down(ON);
+//                rt_thread_mdelay(5000);
+//                ctr_cangmen_down(OFF);
+//                rt_thread_mdelay(500);
+//                ctr_cangmen_down(ON);
+//                rt_thread_mdelay(5000);
+//                ctr_cangmen_down(OFF);
+//            }
+//        }
+
         rt_thread_delay(1000);
         rt_thread_delay(1000);
         #endif
         #endif
         #endif
         #endif

+ 2 - 1
Application_CBD/applications/dtu_uart2.c

@@ -1082,7 +1082,6 @@ int parseDtu(char *json_string)
               LOG_I("补光灯报警状态:%d",device_status.led_sta);
               LOG_I("补光灯报警状态:%d",device_status.led_sta);
           }
           }
           if(photolink!=NULL){
           if(photolink!=NULL){
-              device_status.selfcheck_ws = 0;
               device_status.camsta = 0; //拍照正常
               device_status.camsta = 0; //拍照正常
               device_status.ctr_up_motor = 0;   //关闭
               device_status.ctr_up_motor = 0;   //关闭
               device_status.ctr_down_motor = 0; //关闭
               device_status.ctr_down_motor = 0; //关闭
@@ -1218,8 +1217,10 @@ int parseDtu(char *json_string)
                       }
                       }
                       else
                       else
                       {
                       {
+
                           device_status.selfcheck_ws = 2;
                           device_status.selfcheck_ws = 2;
                       }
                       }
+                      LOG_I("收到自检指令:%d",device_status.selfcheck_ws);
                   }
                   }
               }
               }
               //切换平台
               //切换平台

+ 0 - 1
Application_CBD/applications/hmi.c

@@ -1834,7 +1834,6 @@ static void Ctr_Mortor_entry(void* parameter)
         if(device_status.selfcheck_ws==2)
         if(device_status.selfcheck_ws==2)
         {
         {
             selfcheck(1);
             selfcheck(1);
-            device_status.selfcheck_ws = 0;
         }
         }
         rt_thread_delay(100);
         rt_thread_delay(100);
     }
     }

+ 2 - 0
Application_CBD/applications/selfcheck.c

@@ -260,6 +260,8 @@ int selfcheck(uint8_t type)
     DTU_Write("%s",js);
     DTU_Write("%s",js);
     free(js);
     free(js);
     LOG_I("重启线程workloop:%d",thread_restart_workloop());
     LOG_I("重启线程workloop:%d",thread_restart_workloop());
+    device_status.selfcheck_ws = 0;
+    device_status.process = 0.0;
 }
 }
 
 
 int rt_software_timer_init(void)
 int rt_software_timer_init(void)