yf_zjb 2 年 前
親
コミット
1bc539a486

BIN
Application_CBD/Debug/Application_CBD.bin


BIN
Application_CBD/Debug/Application_CBD.elf


ファイルの差分が大きいため隠しています
+ 1344 - 1341
Application_CBD/Debug/Application_CBD.map


BIN
Application_CBD/Debug/applications/beep.o


BIN
Application_CBD/Debug/applications/control.o


BIN
Application_CBD/Debug/applications/dtu_uart2.o


BIN
Application_CBD/Debug/applications/hmi.o


BIN
Application_CBD/Debug/applications/main.o


BIN
Application_CBD/Debug/applications/sample_mb_master.o


BIN
Application_CBD/Debug/applications/sht30_collect.o


BIN
Application_CBD/Debug/drivers/board.o


+ 35 - 26
Application_CBD/applications/control.c

@@ -1559,7 +1559,7 @@ void HK_TakePhoto(void)
     DTU_Write("%s",takephotojson);
     rt_free(takephotojson);
     //吸虫塔
-    if(device_status.version_type!=6)
+    if(device_status.version_type!=6&&device_status.version_type!=8)
     {
         ctr_led(ON);
         if(device_status.version_type==48)
@@ -1631,7 +1631,7 @@ void ResetInit(void)
         if(device_status.run_sta==0)
             ctr_turn(0, 0);
     }
-    if(device_status.version_type!=6&&device_status.version_type!=7)
+    if(device_status.version_type!=6&&device_status.version_type!=7&&device_status.version_type!=8)
     {
         device_status.work_done = 1;
            //1.打开路由器供电
@@ -2185,21 +2185,6 @@ void WorkTask_BZY(void)
 }
 
 
-void WorkTask_BZYV2(void)
-{
-    //打开采集风机
-    ctr_Collect_Fan(ON);
-    //打开胶带步进电机
-
-    //等待采集结束
-
-    //拍照
-
-    //打开相机供电
-    //打开补光灯
-    //滑台归位
-    //滑台启动
-}
 
 //工作任务流程s
 void WorkTask(void)
@@ -2453,25 +2438,46 @@ void WorkTask(void)
 //拍照性诱工作任务流程
 void WorkTask_XYV3(void)
 {
+    int int_a = 60;
+    int cal_n = device_status.cul_time * 60;
     LOG_I("工作状态:%d",device_status.work_status);
     LOG_I("开关机状态:%d",device_status.ds);
     while(device_status.work_status==1&&device_status.bat_status==0&&device_status.ds==1)
     {
         //高压板通电
         ctr_lamp(ON, 0);     //清扫-DC12v电机正反转
-        //拍照计数,发送指令
-        int cal_n = device_status.cul_time * 60;
-        while(cal_n!=0){
+        //拍照(?触发条件)计数?没有虫呢?定时
+        while(device_status.yc_ct==0){
             cal_n--;
+            LOG_I("诱虫检测计数剩余时间:%d S",cal_n);
+            if(cal_n==0){
+                cal_n = device_status.cul_time * 60;
+                //发送拍照计数指令
+                device_status.photo_ws = 2;
+            }
+            time_t time_take;
+            time(&time_take);
+            static struct tm alarm_takephpoto;
+            alarm_takephpoto =*localtime(&time_take);
+            if((alarm_takephpoto.tm_hour)==17&&(alarm_takephpoto.tm_min==00)&&(alarm_takephpoto.tm_sec==00))
+            {
+                break;
+            }
+            LOG_I("当前时间:%d:%d:%d",alarm_takephpoto.tm_hour,alarm_takephpoto.tm_min,alarm_takephpoto.tm_sec);
             rt_thread_delay(1000);
-            LOG("拍照计数剩余时间:%d S",cal_n);
         }
-        //发送拍照计数指令
-        DTU_Write(makeJson_ParsePhoto);
-        //等待计数返回结果
+        device_status.all_ycct +=  device_status.yc_ct;
+        device_status.yc_ct = 0;    //清零诱虫次数
+        while(1){
+            int_a--;
+            if(int_a<0) break;
 
-        //拍照(?触发条件)计数?没有虫呢?定时
-        //履带传送24V
+            rt_thread_delay(1000);
+            LOG_I("翻板倒计时:%d",int_a);
+        }
+        int_a = 60;
+        //翻板12V
+        device_status.clear_status=10;
     }
 }
 
@@ -2544,6 +2550,9 @@ static void Control_Clear_thread_entry(void *parameter)
             if(ctr_clear(1200)==0)
             ctr_TG_Clear(400);
         }
+        if(device_status.clear_status==10){
+            ctr_turn(90,0);
+        }
         rt_thread_delay(100);
         #endif
         #endif

+ 2 - 0
Application_CBD/applications/control.h

@@ -110,6 +110,8 @@ typedef struct  _packed
     uint8_t account_status;         //卡状态
     uint8_t test_flag;              //测试标志
     uint8_t sensor_485_sta;         //485传感器
+    uint8_t yc_ct;                //诱虫次数
+    uint8_t all_ycct;             //诱虫计数
     #if BOOT_ERR == 1
     uint8_t gps_inuse;
     uint8_t gps_view;

+ 14 - 3
Application_CBD/applications/dtu_uart2.c

@@ -755,7 +755,9 @@ char * makeJson()
         //cv 充电电压 单位:V 字符串类型
         cJSON_AddStringToObject(pSubJson,"cv","0.0");
         //volt_ct电击计数值
-        cJSON_AddStringToObject(pSubJson,"volt_ct","0");
+
+        rt_sprintf(utos, "%d",device_status.all_ycct);
+        cJSON_AddStringToObject(pSubJson,"volt_ct",utos);
         //清虫间隔
         cJSON_AddStringToObject(pSubJson,"clt_t","10");
         //主板温度
@@ -812,6 +814,7 @@ char * makeJson()
         return NULL;
     }
     cJSON_Delete(pJsonRoot);
+    device_status.all_ycct = 0;
     return p;
 }
 //JSON数据解析
@@ -881,6 +884,14 @@ int parseDtu(char *json_string)
                   DTU_Write("%s",photo);
                   rt_free(photo);
                   rt_thread_delay(2000);
+              }else if (strstr(item_cmd->valuestring,"ParsePhoto")!=RT_NULL) {
+                  device_status.photo_ws = 2;
+              }else if (strstr(item_cmd->valuestring,"photoinfo")!=RT_NULL) {
+                  cJSON* ct_p = cJSON_GetObjectItem(item_ext,"photo_ct");
+                  if(ct_p!=NULL){
+                      device_status.yc_ct = ct_p->valueint;
+                      LOG_I("拍照计数结果为:%d",device_status.yc_ct);
+                  }
               }
               else if (strstr(item_cmd->valuestring,"json_w_clock")!=RT_NULL) {
                   rt_kprintf("查询时间配置!\n");
@@ -1149,7 +1160,7 @@ int parseDtu(char *json_string)
                   sprintf(device_status.cpu_temp,"%s",value_commn->valuestring);
                   if(value_commn!=RT_NULL)
                   {
-                      HMI_WRITE("menu.cpu_temp.txt=\"%d.%d℃\"",atoi(value_commn->valuestring)/1000,atoi(value_commn->valuestring)%1000);
+                      HMI_WRITE("menu.cpu.txt=\"%d.%d\"",atoi(value_commn->valuestring)/1000,atoi(value_commn->valuestring)%1000);
 
                   }
                   if(strstr(device_status.imei,imei->valuestring)==RT_NULL)
@@ -1371,7 +1382,7 @@ int parseDtu(char *json_string)
                           cJSON* drop_sec = cJSON_GetObjectItem(item_ext,"drop_time");
 
                           if(work_tim!=RT_NULL){
-                              ts = cJSON_GetObjectItem(work_tim,"timctrl");
+                              device_status.timeSwitch = 1;
                               st = cJSON_GetObjectItem(work_tim,"st");
                               et = cJSON_GetObjectItem(work_tim,"et");
                           }

+ 34 - 28
Application_CBD/applications/hmi.c

@@ -211,20 +211,20 @@ static void HMI_Decode(void)
         HMI_WRITE("set.t1.txt=\"%d\"",tm.tm_min);
         HMI_WRITE("set.t2.txt=\"%d\"",tm.tm_sec);
         //更新电压
-        HMI_WRITE("workSta.vbat.txt=\"%s\"",device_status.voltage);
+        HMI_WRITE("menu.vbat.txt=\"%s\"",device_status.voltage);
         //更新电流
-         HMI_WRITE("workSta.power.txt=\"%s\"",device_status.power);
+         HMI_WRITE("menu.power.txt=\"%s\"",device_status.power);
         //更新温湿度数据
-        HMI_WRITE("workSta.envHum.val=%d",atoi(device_status.humidity));
-        HMI_WRITE("workSta.envTem.val=%d",atoi(device_status.tempture));
+        HMI_WRITE("menu.envHum.val=%d",atoi(device_status.humidity));
+        HMI_WRITE("menu.envTem.val=%d",atoi(device_status.tempture));
         //更新电池状态
-        HMI_WRITE("workSta.batStatus.val=%d",device_status.bat_status);
+        HMI_WRITE("menu.batStatus.val=%d",device_status.bat_status);
         //更新上仓门状态
         HMI_WRITE("workSta.upStatus.val=%d",device_status.up_status);
         //更新下仓门状态
         HMI_WRITE("workSta.downStatus.val=%d",device_status.down_status);
         //更新工作状态
-        HMI_WRITE("workSta.workStatus.val=%d",device_status.work_status);
+        HMI_WRITE("menu.workStatus.val=%d",device_status.work_status);
         //更新温控状态
         HMI_WRITE("workSta.tempStatus.val=%d",device_status.temp_status);
         //更新雨控状态
@@ -267,9 +267,19 @@ static void HMI_Decode(void)
         HMI_WRITE("menu.equipid.txt=\"%s\"",device_status.imei);
         //HMI_WRITE("workSta.equipid.txt=\"%s\"",device_status.imei);
         //数据上传间隔
-        HMI_WRITE("uploadSet.datt.val=%d",device_status.dattim);
+        HMI_WRITE("menu.datt.txt=\"%d\"",device_status.dattim);
+        HMI_WRITE("menu.next.txt=\"%d\"",device_status.num_updata);
         //语音音量
         HMI_WRITE("sysSet.vol.val=%d",device_status.vol);
+        //主板温度
+        HMI_WRITE("menu.bt.txt=\"%d.%d\"",Get_Temprate()/100,Get_Temprate()%100);
+        //
+        HMI_WRITE("menu.t4.txt=\"%d:00-%d:00\"",device_status.startBar,device_status.stopBar);
+        //
+        HMI_WRITE("menu.ct.txt=\"%d\"",device_status.all_ycct);
+        //
+        HMI_WRITE("menu.version.txt=\"%s\"",device_status.driver);
+        HMI_WRITE("menu.build.txt=\"%s\"",device_status.driver_compile);
         //更新熄屏时间
         if(device_status.thsp<60) device_status.thsp = device_status.thsp * 60;
         HMI_WRITE("thsp=%d",device_status.thsp);
@@ -1271,7 +1281,7 @@ static void Ctr_Mortor_entry(void* parameter)
    rt_uint16_t num_up_close = 200;   //
    rt_uint16_t num_down_open = 200;  //
    rt_uint16_t num_down_close = 200;  //
-   rt_int16_t photo_led_sec = 900;  //55S
+   rt_int16_t photo_led_sec = 900;  //90S
 
    //int current_t[200];
    /*孢子仪拍照数量*/
@@ -1421,21 +1431,10 @@ static void Ctr_Mortor_entry(void* parameter)
         //拍照
         if(device_status.photo_ws==1)
         {
+            photo_led_sec--;
             ctr_led(ON);
             //打开补光灯
-            if(photo_led_sec==300&&device_status.version_type==48)
-            {
-                DTU_Write("takephoto.mp3");
-                //延时
-                rt_thread_delay(1000);
-                LOG_I("测试拍照!");
-                Hk_Take_io();
-                char *takephotojson = makeJson_takephoto();
-                DTU_Write("%s",takephotojson);
-                rt_free(takephotojson);
-            }
-            //15S后执行拍照
-            else if (photo_led_sec==750&&device_status.version_type!=48)
+            if(photo_led_sec==890)
             {
                 DTU_Write("takephoto.mp3");
                 //延时
@@ -1446,8 +1445,8 @@ static void Ctr_Mortor_entry(void* parameter)
                 DTU_Write("%s",takephotojson);
                 rt_free(takephotojson);
             }
-            photo_led_sec--;
-            if(photo_led_sec==0&&device_status.version_type==48)    //4800W相机
+
+            if(photo_led_sec==600)    //4800W相机
             {
                 ctr_led(OFF);
                 photo_led_sec = 900;
@@ -1455,14 +1454,21 @@ static void Ctr_Mortor_entry(void* parameter)
                 HMI_WRITE("sysTest.switchPhoto.val=0");
                 HMI_WRITE("sysTest.switchFill.val=0");
             }
-            else if (photo_led_sec==550&&device_status.version_type!=48) {
-                ctr_led(OFF);
+
+        }else if(device_status.photo_ws ==2){
+            ctr_led(ON);
+            photo_led_sec--;
+            if(photo_led_sec==890){
+                DTU_Write("takephoto.mp3");
+                rt_thread_delay(2000);
+                DTU_Write(makeJson_ParsePhoto());
+            }else if(photo_led_sec==600){
                 photo_led_sec = 900;
+                ctr_led(OFF);
                 device_status.photo_ws = 0;
-                HMI_WRITE("sysTest.switchPhoto.val=0");
-                HMI_WRITE("sysTest.switchFill.val=0");
             }
         }
+
         /*对焦拍照*/
         if(device_status.autotakepic==1)
         {
@@ -1914,7 +1920,7 @@ void Check_ParamConfig(void)
         Control_clear();
         Control_heat();
         #endif
-        if(device_status.dtype!=7)
+        if(device_status.dtype!=7&&device_status.dtype!=8)
         {
             Control_clear();
             Control_heat();

+ 2 - 2
Application_CBD/applications/sht30_collect.c

@@ -153,7 +153,7 @@ static void Power_ReadCheck(void *parameter)
     while(1)
     {
         sprintf(device_status.power,"%.2f",(float)Read_Real_Current()/100*2.5);
-        if (Read_Real_Voltage()/100<12) {
+        if (Read_Real_Voltage()/100<8) {
                     //关闭外设
                     ctr_photo(OFF); //关闭相机供电
                     ctr_led(OFF);   //关闭补光灯
@@ -164,7 +164,7 @@ static void Power_ReadCheck(void *parameter)
                     ctr_cangmen_up(OFF);    //关闭上仓门输出(散热)
                     #endif
                 }
-        if(Read_Real_Voltage()/100<21)
+        if(Read_Real_Voltage()/100<10)
         {
             #if ROBOT_EN == 1
             ctr_led(OFF);

+ 4 - 2
Application_CBD/drivers/board.c

@@ -22,6 +22,7 @@ SPI_HandleTypeDef hspi1;
 void SystemClock_Config(void)
 {
 
+#if 1
     RCC_OscInitTypeDef RCC_OscInitStruct = {0};
     RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
     RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
@@ -61,8 +62,9 @@ void SystemClock_Config(void)
     //Enables the Clock Security System
 
     HAL_RCC_EnableCSS();
+#else
 ///////////////////////////////////////////////////////////////////////////////////
-    /*
+
     RCC_OscInitTypeDef RCC_OscInitStruct = {0};
       RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
       RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
@@ -104,7 +106,7 @@ void SystemClock_Config(void)
       //Enables the Clock Security System
 
       HAL_RCC_EnableCSS();
-      */
+#endif
 }
 /**
 * @brief TIM_Base MSP Initialization