yf_zjb 4 лет назад
Родитель
Сommit
12e929f32b

+ 7 - 0
Application_CBD/applications/control.c

@@ -113,6 +113,8 @@ void WorkTask_XCT(void)
     {
     {
         ctr_Motor_xichong(ON);
         ctr_Motor_xichong(ON);
         ctr_Motor_xifu(ON);
         ctr_Motor_xifu(ON);
+        //打开相机供电
+        ctr_Heat(ON);
         uint32_t photo_fre = 0;
         uint32_t photo_fre = 0;
         photo_fre = device_status.dattim * 60;
         photo_fre = device_status.dattim * 60;
         while(photo_fre!=0)
         while(photo_fre!=0)
@@ -125,6 +127,11 @@ void WorkTask_XCT(void)
         ctr_JD_Clear();
         ctr_JD_Clear();
         //拍照
         //拍照
         HK_TakePhoto();
         HK_TakePhoto();
+        //关闭吸附风机
+        ctr_Motor_xichong(ON);
+        ctr_Motor_xifu(ON);
+        //关闭相机供电
+        ctr_Heat(OFF);
         //卷带
         //卷带
         ctr_JD_Clear();
         ctr_JD_Clear();
         //震动
         //震动

+ 1 - 1
Application_CBD/applications/control.h

@@ -25,7 +25,7 @@
 #define VERSION_HK_2000W    "1.41.4(2000W)"         //4.0水稻
 #define VERSION_HK_2000W    "1.41.4(2000W)"         //4.0水稻
 #define VERSION_ZP          "1.38.1(ZP)"            //1.0转盘
 #define VERSION_ZP          "1.38.1(ZP)"            //1.0转盘
 #define VERSION_GK          "1.38.1(GK)"            //1.0高空
 #define VERSION_GK          "1.38.1(GK)"            //1.0高空
-#define VERSION_XCT         "1.6.6(HK)"             //吸虫塔-海康
+#define VERSION_XCT         "1.9.6(HK)"             //吸虫塔-海康
 #define VERSION_V5          "1.2.5(HK)"             //5.0
 #define VERSION_V5          "1.2.5(HK)"             //5.0
 #define CompileTime         rt_sprintf(device_status.driver_compile,"%s-%s",__DATE__,__TIME__)              //编译时间,每次更新代码修改
 #define CompileTime         rt_sprintf(device_status.driver_compile,"%s-%s",__DATE__,__TIME__)              //编译时间,每次更新代码修改
 /*********************************************************************/
 /*********************************************************************/

+ 17 - 1
Application_CBD/applications/dtu_uart2.c

@@ -111,6 +111,7 @@ static void dtu_thread_entry_recv(void *parameter)
     struct rx_msg msg;
     struct rx_msg msg;
     rt_err_t result;
     rt_err_t result;
     rt_uint32_t rx_length;
     rt_uint32_t rx_length;
+    rt_uint32_t rx_err = 0;
     static char str_check[2]={'{','}'};
     static char str_check[2]={'{','}'};
     static char rx_buffer[512];
     static char rx_buffer[512];
     static char rx_buffer_tmp[512];
     static char rx_buffer_tmp[512];
@@ -156,7 +157,22 @@ static void dtu_thread_entry_recv(void *parameter)
                    }
                    }
                    //rt_kprintf("%s",rx_buffer);
                    //rt_kprintf("%s",rx_buffer);
                  }
                  }
-            }
+         }
+         else {
+                    rx_err ++;
+                    if(rx_err==54000)//90分钟未接收到数据
+                    {
+                        if(device_status.version_type==6)
+                        {
+                            rt_kprintf("RK3399 transter Error!\n");
+                            ctr_photo(OFF);
+                        }
+                    }
+                    else if (rx_err==54100) {
+                        rx_err = 0;
+                        ctr_photo(ON);
+                    }
+               }
             //rt_kprintf("%s\n",rx_json_buffer);
             //rt_kprintf("%s\n",rx_json_buffer);
             // 将内容写回到串口1
             // 将内容写回到串口1
             //rt_device_write(dtuserial, 0, &rx_json_buffer[0], rx_length);
             //rt_device_write(dtuserial, 0, &rx_json_buffer[0], rx_length);

+ 27 - 38
Application_CBD/applications/sht30_collect.c

@@ -71,63 +71,52 @@ int UART_485_INIT(void)
 static void sht30_collect_thread_entry(void *parameter)
 static void sht30_collect_thread_entry(void *parameter)
 {
 {
 
 
-    //sht3x_device_t  sht3x_device;
+    sht3x_device_t  sht3x_device;
     static int checklightnum = 0;
     static int checklightnum = 0;
     static int checknightnum = 0;
     static int checknightnum = 0;
-    //sht3x_device = sht3x_init("i2c1", 0x44);
+    sht3x_device = sht3x_init("i2c1", 0x44);
     //此处需要短暂的延时,否则会出现连续读取失败的问题
     //此处需要短暂的延时,否则会出现连续读取失败的问题
     rt_thread_mdelay(150);
     rt_thread_mdelay(150);
     while (1)
     while (1)
     {
     {
-//        if(sht3x_device)
-//        {
-//            if(RT_EOK == sht3x_read_singleshot(sht3x_device))
-//            {
-//                hum_value = sht3x_device->humidity;
-//                tem_value = sht3x_device->temperature;
-//                if(hum_value!=0)
-//                {
-//                    rt_sprintf(device_status.humidity,"%d.%d",(int)sht3x_device->humidity, (uint)(sht3x_device->humidity * 10) % 10);
-//                    rt_sprintf(device_status.tempture,"%d.%d",(int)sht3x_device->temperature, (uint)(sht3x_device->temperature * 10) % 10);
-//                }
-//                else {
-//                    if(device_status.sensor_sta==0)
-//                    {
-//                        rt_sprintf(device_status.humidity,"30.0");
-//                        rt_sprintf(device_status.tempture,"25.0");
-//                    }
-//                }
-//                if(tem_value>=device_status.tph||tem_value<=device_status.tpl)
-//                {
-//                    device_status.temp_status = 1;
-//                }
-//                else if(tem_value>=(device_status.tpl+5)&&tem_value<=(device_status.tph-10)) {
-//                    device_status.temp_status = 0;
-//                }
-//            }
-//            else {
-//                sht3x_softreset(sht3x_device);
+        if(sht3x_device)
+        {
+            if(RT_EOK == sht3x_read_singleshot(sht3x_device))
+            {
+                hum_value = sht3x_device->humidity;
+                tem_value = sht3x_device->temperature;
+                if(hum_value!=0)
+                {
+                    rt_sprintf(device_status.humidity,"%d.%d",(int)sht3x_device->humidity, (uint)(sht3x_device->humidity * 10) % 10);
+                    rt_sprintf(device_status.tempture,"%d.%d",(int)sht3x_device->temperature, (uint)(sht3x_device->temperature * 10) % 10);
+                }
+                else {
+                    rt_kprintf("sht3x_read_singleshot eRR:%d",hum_value);
+                }
+            }
+            else {
+                sht3x_softreset(sht3x_device);
 //                if(device_status.sensor_sta==0)
 //                if(device_status.sensor_sta==0)
 //                {
 //                {
 //                    rt_sprintf(device_status.humidity,"30.0");
 //                    rt_sprintf(device_status.humidity,"30.0");
 //                    rt_sprintf(device_status.tempture,"25.0");
 //                    rt_sprintf(device_status.tempture,"25.0");
 //                }
 //                }
-//            }
+            }
 ////          rt_kprintf("sht30 humidity   : %d.%d  ", (int)sht3x_device->humidity, (int)(sht3x_device->humidity * 10) % 10);
 ////          rt_kprintf("sht30 humidity   : %d.%d  ", (int)sht3x_device->humidity, (int)(sht3x_device->humidity * 10) % 10);
 ////          rt_kprintf("temperature: %d.%d\n", (int)sht3x_device->temperature, (int)(sht3x_device->temperature * 10) % 10);
 ////          rt_kprintf("temperature: %d.%d\n", (int)sht3x_device->temperature, (int)(sht3x_device->temperature * 10) % 10);
-//        }
-//        else
+        }
+        else
         {
         {
 //            if(device_status.sensor_sta==0)
 //            if(device_status.sensor_sta==0)
 //            {
 //            {
 //                rt_sprintf(device_status.humidity,"30.0");
 //                rt_sprintf(device_status.humidity,"30.0");
 //                rt_sprintf(device_status.tempture,"25.0");
 //                rt_sprintf(device_status.tempture,"25.0");
 //            }
 //            }
-//            rt_kprintf("read sht3x fail.\r\n");
-//            //重新初始化
-//            sht3x_deinit(sht3x_device);
-//            sht3x_device = sht3x_init("i2c1", 0x44);
-//            rt_thread_mdelay(150);
+            rt_kprintf("read sht3x fail.\r\n");
+            //重新初始化
+            sht3x_deinit(sht3x_device);
+            sht3x_device = sht3x_init("i2c1", 0x44);
+            rt_thread_mdelay(150);
         }
         }
         //rt_kprintf("the voltage is:%d.%02d\n",Read_Real_Voltage()/100,Read_Real_Voltage()%100);
         //rt_kprintf("the voltage is:%d.%02d\n",Read_Real_Voltage()/100,Read_Real_Voltage()%100);
         //sprintf(send_buf,"%.2f",(Read_Real_Current()/100.0*2.5)-20.0);
         //sprintf(send_buf,"%.2f",(Read_Real_Current()/100.0*2.5)-20.0);