Explorar el Código

addd hmi status

yf_zjb hace 3 años
padre
commit
6da519472d

BIN
Application_CBD/.settings/.rtmenus


+ 27 - 15
Application_CBD/applications/control.c

@@ -1149,7 +1149,7 @@ void Hk_Take_io(void)
 
 
 void calorstat(uint16_t heat_time)
 void calorstat(uint16_t heat_time)
 {
 {
-    //uint8_t heat_up_cnt = 0;
+    uint8_t heat_up_cnt = 0;
     uint16_t n = 0;
     uint16_t n = 0;
     uint16_t delay_heat = 60;
     uint16_t delay_heat = 60;
     FlagStatus heat_flg = RESET;
     FlagStatus heat_flg = RESET;
@@ -1167,6 +1167,7 @@ void calorstat(uint16_t heat_time)
             {
             {
                 delay_heat --;
                 delay_heat --;
                 rt_kprintf("正在恒温加热!!!:%d",delay_heat);
                 rt_kprintf("正在恒温加热!!!:%d",delay_heat);
+                HMI_WRITE("workSta.g0.txt=\"正在恒温加热!!!:%d\"",delay_heat);
                 rt_thread_delay(1000);
                 rt_thread_delay(1000);
             }
             }
             delay_heat = 60;
             delay_heat = 60;
@@ -1175,24 +1176,24 @@ void calorstat(uint16_t heat_time)
         }
         }
         if(device_status.heattem < (device_status.heatvalue - 5)&&heat_flg == SET)
         if(device_status.heattem < (device_status.heatvalue - 5)&&heat_flg == SET)
         {
         {
-            //heat_up_cnt = 0;
+            heat_up_cnt = 0;
             ctr_Heat(ON);
             ctr_Heat(ON);
         }
         }
-        else if (device_status.heattem>device_status.heatvalue&&heat_flg==SET)
+        else if (device_status.heattem>=device_status.heatvalue&&heat_flg==SET)
         {
         {
-//            if(heat_up_cnt==0)
-//            {
-//                UpLoad_Data();      //加热到设定温度的数据
-//                heat_up_cnt = 1;
-//            }
+            if(heat_up_cnt==0)
+            {
+                UpLoad_Data();      //加热到设定温度的数据
+                heat_up_cnt = 1;
+            }
             ctr_Heat(OFF);
             ctr_Heat(OFF);
         }
         }
         if((n % 60)==0)
         if((n % 60)==0)
         {
         {
             device_status.heat_time_min = device_status.heat_time_min + 1;
             device_status.heat_time_min = device_status.heat_time_min + 1;
-//            if(device_status.heat_time_min % 2 == 0)
+//            if(device_status.heat_time_min % 5 == 0)
 //            {
 //            {
-//                UpLoad_Data();      //从加热开始每两分钟上传的数据
+//                UpLoad_Data();      //从加热开始每5分钟上传的数据
 //            }
 //            }
         }
         }
         //如果触发异常退出加热
         //如果触发异常退出加热
@@ -1215,6 +1216,7 @@ void calorstat(uint16_t heat_time)
         }
         }
         rt_thread_delay(1000);
         rt_thread_delay(1000);
         rt_kprintf("=======正在加热======:%d-%d\n",n,heat_time);
         rt_kprintf("=======正在加热======:%d-%d\n",n,heat_time);
+        HMI_WRITE("workSta.g0.txt=\"正在加热!!!:%d-%d\"",n,heat_time);
     }
     }
     ctr_Heat(OFF);
     ctr_Heat(OFF);
     //UpLoad_Data();      //加热结束的数据
     //UpLoad_Data();      //加热结束的数据
@@ -1841,6 +1843,7 @@ void WorkTask(void)
                     ctr_Fan_PUT(OFF);
                     ctr_Fan_PUT(OFF);
                 #endif
                 #endif
                 rt_kprintf("正在收集.....剩余时间:%d分-%d秒\n",device_status.clt_time,clt_time);
                 rt_kprintf("正在收集.....剩余时间:%d分-%d秒\n",device_status.clt_time,clt_time);
+                HMI_WRITE("workSta.g0.txt=\"正在收集.....剩余时间:%d分-%d秒\"",device_status.clt_time,clt_time);
                 //如果触发异常
                 //如果触发异常
                 if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
                 if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
                 {
                 {
@@ -1853,6 +1856,7 @@ void WorkTask(void)
                     ctr_Fan_IN(OFF);
                     ctr_Fan_IN(OFF);
                     #endif
                     #endif
                     rt_kprintf("异常退出!!!\n");
                     rt_kprintf("异常退出!!!\n");
+                    HMI_WRITE("workSta.g0.txt=\"异常退出\"");
                     break;
                     break;
                 }
                 }
                 if(device_status.timeSwitch==0&&device_status.sun_status==1)
                 if(device_status.timeSwitch==0&&device_status.sun_status==1)
@@ -1866,6 +1870,7 @@ void WorkTask(void)
                     ctr_Fan_IN(OFF);
                     ctr_Fan_IN(OFF);
                     #endif
                     #endif
                     rt_kprintf("异常退出!!!\n");
                     rt_kprintf("异常退出!!!\n");
+                    HMI_WRITE("workSta.g0.txt=\"异常退出\"");
                     break;
                     break;
                 }
                 }
             }
             }
@@ -1881,6 +1886,7 @@ void WorkTask(void)
                 ctr_Fan_IN(OFF);
                 ctr_Fan_IN(OFF);
                 #endif
                 #endif
                 rt_kprintf("异常退出!!!\n");
                 rt_kprintf("异常退出!!!\n");
+                HMI_WRITE("workSta.g0.txt=\"异常退出\"");
                 break;
                 break;
             }
             }
             if(device_status.timeSwitch==0&&device_status.sun_status==1)
             if(device_status.timeSwitch==0&&device_status.sun_status==1)
@@ -1894,6 +1900,7 @@ void WorkTask(void)
                 ctr_Fan_IN(OFF);
                 ctr_Fan_IN(OFF);
                 #endif
                 #endif
                 rt_kprintf("异常退出!!!\n");
                 rt_kprintf("异常退出!!!\n");
+                HMI_WRITE("workSta.g0.txt=\"异常退出\"");
                 break;
                 break;
             }
             }
             #if LAMP_EN == 0
             #if LAMP_EN == 0
@@ -1902,6 +1909,7 @@ void WorkTask(void)
             //4.关闭上仓门
             //4.关闭上仓门
             device_status.ctr_up_motor = 2;
             device_status.ctr_up_motor = 2;
             rt_kprintf("关闭上仓门!!!\n");
             rt_kprintf("关闭上仓门!!!\n");
+            HMI_WRITE("workSta.g0.txt=\"关闭上仓门!\"");
 //        while(device_status.ctr_up_motor!=0)
 //        while(device_status.ctr_up_motor!=0)
 //        {
 //        {
 //            rt_thread_delay(100);
 //            rt_thread_delay(100);
@@ -1935,24 +1943,28 @@ void WorkTask(void)
             {
             {
                 rt_thread_delay(100);
                 rt_thread_delay(100);
                 rt_kprintf("等待下仓门打开!!!\n");
                 rt_kprintf("等待下仓门打开!!!\n");
+                HMI_WRITE("workSta.g0.txt=\"等待下仓门打开!\"");
             }
             }
             rt_thread_delay(3000);
             rt_thread_delay(3000);
             //关闭下仓门
             //关闭下仓门
             device_status.ctr_down_motor = 2;
             device_status.ctr_down_motor = 2;
-            //2022-04-12add:
-            rt_kprintf("打开上仓门!!!\n");
-            device_status.ctr_up_motor = 1;
             while(device_status.ctr_down_motor!=0)
             while(device_status.ctr_down_motor!=0)
             {
             {
                 rt_thread_delay(100);
                 rt_thread_delay(100);
                 rt_kprintf("等待下仓门关闭!!!\n");
                 rt_kprintf("等待下仓门关闭!!!\n");
+                HMI_WRITE("workSta.g0.txt=\"等待下仓门关闭!\"");
             }
             }
+            //2022-04-12add:
+             LOG_I("打开上仓门!!!");
+             HMI_WRITE("workSta.g0.txt=\"打开上仓门!\"");
+             device_status.ctr_up_motor = 1;
             if(device_status.version_type==4||device_status.version_type==41)
             if(device_status.version_type==4||device_status.version_type==41)
             {
             {
                 //震动
                 //震动
                 ctr_shake(ON, 1);
                 ctr_shake(ON, 1);
                 //补光&&拍照
                 //补光&&拍照
-                rt_kprintf("拍照!!!\n");
+                LOG_I("拍照!!!");
+                HMI_WRITE("workSta.g0.txt=\"拍照!\"");
                 HK_TakePhoto();
                 HK_TakePhoto();
                 //清扫
                 //清扫
                 device_status.clear_status=1;
                 device_status.clear_status=1;
@@ -1989,9 +2001,9 @@ void WorkTask(void)
         if(device_status.work_done==0&&device_status.work_status==0)
         if(device_status.work_done==0&&device_status.work_status==0)
         {
         {
             DTU_Write("workdone");
             DTU_Write("workdone");
+            HMI_WRITE("workSta.g0.txt=\"工作任务已完成!\"");
             ResetInit();
             ResetInit();
         }
         }
-
         rt_kprintf("***not work-device status:%d\n",device_status.ds);
         rt_kprintf("***not work-device status:%d\n",device_status.ds);
 }
 }
 /* 入口函数-工作状态检测 */
 /* 入口函数-工作状态检测 */

+ 1 - 1
Application_CBD/applications/control.h

@@ -30,7 +30,7 @@
 #define VERSION_V5          "1.2.5(HK)"             //5.0
 #define VERSION_V5          "1.2.5(HK)"             //5.0
 #define VERSION_Robot       "1.0(robot)"            //展厅机器人
 #define VERSION_Robot       "1.0(robot)"            //展厅机器人
 
 
-#define VERSION_BZY         "2.0"                   //孢子仪
+#define VERSION_BZY         "2.1"                   //孢子仪
 
 
 #define CompileTime         rt_sprintf(device_status.driver_compile,"%s-%s",__DATE__,__TIME__)              //编译时间,每次更新代码修改
 #define CompileTime         rt_sprintf(device_status.driver_compile,"%s-%s",__DATE__,__TIME__)              //编译时间,每次更新代码修改
 /*********************************************************************/
 /*********************************************************************/

+ 3 - 0
Application_CBD/applications/dtu_uart2.c

@@ -437,6 +437,9 @@ char * makeJson()
     else {
     else {
         device_status.lamp_status = 0;
         device_status.lamp_status = 0;
     }
     }
+    if(atoi(device_status.power)>7000)
+        rt_sprintf(device_status.power,"0.01");
+
     makejson_sta = 1;
     makejson_sta = 1;
     time_t stamp=time(RT_NULL);
     time_t stamp=time(RT_NULL);
     static struct tm tm;
     static struct tm tm;