Просмотр исходного кода

修复flash参数丢失导致版本切换

zhunk 1 год назад
Родитель
Сommit
dd44c9ea0d
2 измененных файлов с 17 добавлено и 12 удалено
  1. 15 1
      Application_cbd_apm32f1/applications/control.c
  2. 2 11
      Application_cbd_apm32f1/applications/hmi.c

+ 15 - 1
Application_cbd_apm32f1/applications/control.c

@@ -1361,6 +1361,8 @@ uint16_t ctr_Motor86_move(uint32_t xdis,uint32_t pulse,uint8_t dir)
     pwm_motor86_enable(pulse);
     pwm_motor86_enable(pulse);
     while(rt_pin_read(MOTOR_86)==0)
     while(rt_pin_read(MOTOR_86)==0)
     {
     {
+
+        pwm_motor86_enable(pulse);
         limit_tm++;
         limit_tm++;
         rt_thread_delay(10);
         rt_thread_delay(10);
         if(limit_tm>=1000) break;
         if(limit_tm>=1000) break;
@@ -1402,6 +1404,7 @@ uint16_t ctr_Motor86_move(uint32_t xdis,uint32_t pulse,uint8_t dir)
  * */
  * */
 void WorkTask_CB5(void)
 void WorkTask_CB5(void)
 {
 {
+    static uint8_t guangshan_hand = 0;
     static int work_loop = 0;
     static int work_loop = 0;
     while(device_status.work_status==1&&device_status.temp_status==0&&device_status.bat_status==0&&device_status.rain_status==0&&device_status.ds==1)
     while(device_status.work_status==1&&device_status.temp_status==0&&device_status.bat_status==0&&device_status.rain_status==0&&device_status.ds==1)
     {
     {
@@ -1447,6 +1450,17 @@ void WorkTask_CB5(void)
             //光栅检测启动
             //光栅检测启动
             pin_guangshan_bind();
             pin_guangshan_bind();
             rt_thread_delay(1000);
             rt_thread_delay(1000);
+            while(rt_pin_read(GUANG_SHAN)==0)
+            {
+                guangshan_hand++;
+                rt_thread_delay(100);
+                if(guangshan_hand>5) break;
+            }
+            if(guangshan_hand>5)
+            {
+                guangshan_hand = 0;
+                device_status.autotakepic = 11;
+            }
         }
         }
         rt_thread_delay(1000);
         rt_thread_delay(1000);
     }
     }
@@ -1691,7 +1705,7 @@ static void t_shibie_callback(void *parameter)
 int rt_software_timer_init(void)
 int rt_software_timer_init(void)
 {
 {
     //启动拍照超时定时器
     //启动拍照超时定时器
-    timer_shibie = rt_timer_create("t_shibie",t_shibie_callback,RT_NULL, 5000, RT_TIMER_FLAG_ONE_SHOT|RT_TIMER_FLAG_HARD_TIMER);
+    timer_shibie = rt_timer_create("t_shibie",t_shibie_callback,RT_NULL,15000, RT_TIMER_FLAG_ONE_SHOT|RT_TIMER_FLAG_HARD_TIMER);
     if(timer_takephoto==RT_NULL)
     if(timer_takephoto==RT_NULL)
     {
     {
         LOG_E("rt_timer_create t_shibie failed!");
         LOG_E("rt_timer_create t_shibie failed!");

+ 2 - 11
Application_cbd_apm32f1/applications/hmi.c

@@ -474,15 +474,6 @@ static void HMI_Decode(void)
         LOG_I("散热风机已关闭!");
         LOG_I("散热风机已关闭!");
     }
     }
 
 
-    //开始对焦拍照
-    else if(strstr(rx_buffer,"putTest.switchAutopic=1")!=NULL){
-        device_status.autotakepic=1;
-        rt_kprintf("开始对焦拍照!\n");
-    }
-    //停止对焦拍照
-    else if(strstr(rx_buffer,"putTest.switchAutopic=0")!=NULL){
-        device_status.autotakepic=0;
-    }
     //粘附测试-开
     //粘附测试-开
     else if(strstr(rx_buffer,"putTest.switchFsl=1")!=NULL){
     else if(strstr(rx_buffer,"putTest.switchFsl=1")!=NULL){
         rt_kprintf("粘附测试开!\n");
         rt_kprintf("粘附测试开!\n");
@@ -1588,7 +1579,7 @@ void Check_ParamConfig(void)
         device_status.iSave=FLASH_FLAG;
         device_status.iSave=FLASH_FLAG;
         /*设备类型,7孢子仪,3测报灯,默认设置测报灯*/
         /*设备类型,7孢子仪,3测报灯,默认设置测报灯*/
         device_status.dtype = 3;
         device_status.dtype = 3;
-        device_status.version_type = 4; //4.0
+        device_status.version_type = 5; //4.0
         device_status.Power_Type = 0;   //0-交流供电;1-直流供电
         device_status.Power_Type = 0;   //0-交流供电;1-直流供电
         device_status.clt_time = 10;    //收集时间
         device_status.clt_time = 10;    //收集时间
         device_status.heattime = 10;    //加热时间
         device_status.heattime = 10;    //加热时间
@@ -1617,7 +1608,7 @@ void Check_ParamConfig(void)
         device_status.cul_time = 1;
         device_status.cul_time = 1;
         device_status.run_sta = 0;
         device_status.run_sta = 0;
         device_status.handle_bugger = 0;    //默认排虫
         device_status.handle_bugger = 0;    //默认排虫
-        sprintf(device_status.driver, "%s",VERSION_HK);
+        sprintf(device_status.driver, "%s",VERSION_V5);
         sprintf(device_status.deviceId,"0");
         sprintf(device_status.deviceId,"0");
         rt_sprintf(device_status.tempture, "-15");
         rt_sprintf(device_status.tempture, "-15");
         rt_sprintf(device_status.humidity, "31");
         rt_sprintf(device_status.humidity, "31");