zhunk hai 1 ano
pai
achega
f78c14c49d

+ 8 - 13
Application_CBD/applications/control.c

@@ -1568,23 +1568,18 @@ void HardWare_Init(uint8_t boot)
 void HK_TakePhoto(void)
 {
     //打开补光灯
+    ctr_led(ON);
+    //播放语音
     DTU_Write("takephoto.mp3");
-    rt_thread_delay(10000);
+    rt_thread_delay(1000);
+    //吸虫塔,水稻
+    if(device_status.version_type!=6&&device_status.version_type!=4)
+    {
+        rt_thread_delay(1000*15);
+    }
     char *takephotojson = makeJson_takephoto();
     DTU_Write("%s",takephotojson);
     rt_free(takephotojson);
-    //吸虫塔
-    if(device_status.version_type!=6)
-    {
-        ctr_led(ON);
-        if(device_status.version_type==48)
-        {
-            rt_thread_delay(1000*60);
-        }
-        else {
-            rt_thread_delay(1000*15);
-        }
-    }
     //触发海康相机拍照
     Hk_Take_io();
     if(device_status.version_type!=6)

+ 1 - 0
Application_CBD/applications/dtu_uart2.c

@@ -1162,6 +1162,7 @@ int parseDtu(char *json_string)
                   else if (strstr(type->valuestring,"led_off")!=RT_NULL)
                   {
                       ctr_led(OFF);
+                      device_status.photo_ws = 0;
                   }
               }
               //切换平台

+ 23 - 14
Application_CBD/applications/hmi.c

@@ -434,9 +434,15 @@ static void HMI_Decode(void)
     //拍照
     else if(strstr(rx_buffer,"putTest.switchPhoto=1")!=NULL) {
         device_status.photo_ws = 1;
+        char *photo = makeJson_Warn("takephoto","control");
+        DTU_Write("%s",photo);
+        rt_free(photo);
     }
     else if (strstr(rx_buffer,"putTest.switchPic=1")!=NULL) {
         device_status.photo_ws = 1;
+        char *photo = makeJson_Warn("takephoto","control");
+        DTU_Write("%s",photo);
+        rt_free(photo);
     }
     //转盘复位
     else if (strstr(rx_buffer,"turn_init")!=NULL) {
@@ -1424,7 +1430,7 @@ static void Ctr_Mortor_entry(void* parameter)
             ctr_Color_board(OPEN, 1000);
         }
         #endif
-        #if 0
+        #if 1
         time_t time_reset12V;
         time(&time_reset12V);
         static struct tm alarm_reset12V;
@@ -1560,30 +1566,31 @@ static void Ctr_Mortor_entry(void* parameter)
             struct timeval tv;
             gettimeofday(&tv, NULL);
             device_status.photo_stamp = tv.tv_sec-8*3600;
-            ctr_led(ON);
+            if(photo_led_sec==900)
+                ctr_led(ON);
+            DTU_Write("takephoto.mp3");
             //打开补光灯
-            if(photo_led_sec==300&&device_status.version_type==48)
+            if(device_status.version_type==4&&photo_led_sec==800)
             {
-                DTU_Write("takephoto.mp3");
-                //延时
-                rt_thread_delay(1000);
                 LOG_I("测试拍照!");
-                Hk_Take_io();
+                #if 1
                 char *takephotojson = makeJson_takephoto();
                 DTU_Write("%s",takephotojson);
                 rt_free(takephotojson);
+                #endif
+                rt_thread_delay(5000);  //延时
+
             }
             //15S后执行拍照
-            else if (photo_led_sec==750&&device_status.version_type!=48)
+            else if (photo_led_sec==750)
             {
-                DTU_Write("takephoto.mp3");
                 //延时
                 rt_thread_delay(1000);
                 LOG_I("测试拍照!");
                 Hk_Take_io();
-                char *takephotojson = makeJson_takephoto();
-                DTU_Write("%s",takephotojson);
-                rt_free(takephotojson);
+//                char *takephotojson = makeJson_takephoto();
+//                DTU_Write("%s",takephotojson);
+//                rt_free(takephotojson);
             }
             photo_led_sec--;
             if(photo_led_sec==300)    //
@@ -1601,6 +1608,8 @@ static void Ctr_Mortor_entry(void* parameter)
 //                HMI_WRITE("sysTest.switchPhoto.val=0");
 //                HMI_WRITE("sysTest.switchFill.val=0");
 //            }
+        }else{
+            photo_led_sec = 900;
         }
         /*对焦拍照*/
         if(device_status.autotakepic==1)
@@ -2209,7 +2218,7 @@ void ResetParamDefault(void)
         device_status.sunBar = 8;
         #endif
         device_status.tph = 70;         //高温保护阈值
-        device_status.tpl = -5;          //低温保护阈值
+        device_status.tpl = 5;          //低温保护阈值
         device_status.timeSwitch = 0;   //定时模式:光控
         device_status.heatvalue=100;    //加热温度
         ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time));
@@ -2263,7 +2272,7 @@ void ResetParamDefault_DC(void)
     device_status.sunBar = 4;
     #endif
     device_status.tph = 70;         //高温保护阈值
-    device_status.tpl = -5;          //低温保护阈值
+    device_status.tpl = 5;         //低温保护阈值
     device_status.timeSwitch = 0;   //定时模式
     device_status.heatvalue=100;
     device_status.ds = 1;           //设备状态开机

+ 7 - 0
Application_CBD/packages/ota_downloader-latest/src/ymodem_ota.c

@@ -137,6 +137,13 @@ void ymodem_ota(uint8_t argc, char **argv)
         rt_thread_delay(RT_TICK_PER_SECOND);
         rt_console_set_device("uart1");
         rt_kprintf("Update firmware fail.\n");
+        /* wait some time for terminal response finish */
+        rt_thread_delay(rt_tick_from_millisecond(200));
+        /* Reset the device, Start old firmware */
+        extern void rt_hw_cpu_reset(void);
+        rt_hw_cpu_reset();
+        /* wait some time for terminal response finish */
+        rt_thread_delay(rt_tick_from_millisecond(200));
     }
 
     return;