zhunk 1 rok temu
rodzic
commit
ac451c9717

+ 3 - 1
Application_cbd_apm32f1/applications/hmi.c

@@ -1368,6 +1368,7 @@ static int counter_sharpness_diff = 0;      //清晰度累计插值 次数变化
 
 
 void thread1_signal_handler(int sig)
 void thread1_signal_handler(int sig)
 {
 {
+    rt_timer_stop(timer_takephoto);
     LOG_I("[对焦] 清晰度值更新:%.2f", device_status.focus_value);
     LOG_I("[对焦] 清晰度值更新:%.2f", device_status.focus_value);
     slide_para.pulse_period = mapSpeed(1);  // 更新电机速度参数
     slide_para.pulse_period = mapSpeed(1);  // 更新电机速度参数
     maxIterations--;
     maxIterations--;
@@ -1556,7 +1557,7 @@ static void Ctr_Mortor_entry(void* parameter)
             DTU_Write("%s",photo);
             DTU_Write("%s",photo);
             rt_free(photo);
             rt_free(photo);
             device_status.autotakepic = 4;
             device_status.autotakepic = 4;
-
+            rt_timer_start(timer_takephoto);
         }
         }
         if(device_status.autotakepic == 4)
         if(device_status.autotakepic == 4)
         {
         {
@@ -1572,6 +1573,7 @@ static void Ctr_Mortor_entry(void* parameter)
 
 
             g_peak_counter = 0;
             g_peak_counter = 0;
             g_last_rising = false;
             g_last_rising = false;
+            //启动超时检测定时器
         }
         }
         if(device_status.fsl_sw==1)
         if(device_status.fsl_sw==1)
         {
         {

+ 7 - 7
Application_cbd_apm32f1/applications/selfcheck.c

@@ -14,6 +14,7 @@
 #include <hmi.h>
 #include <hmi.h>
 #include <dtu_uart2.h>
 #include <dtu_uart2.h>
 #include <sht30_collect.h>
 #include <sht30_collect.h>
+#include <beep.h>
 #define DBG_ENABLE
 #define DBG_ENABLE
 #define DBG_COLOR
 #define DBG_COLOR
 #define DBG_TAG "selfcheck"
 #define DBG_TAG "selfcheck"
@@ -37,13 +38,12 @@ static int calculate_average(int arr[], int n) {
 
 
 static void t_takephoto_callback(void *parameter)
 static void t_takephoto_callback(void *parameter)
 {
 {
-    rt_timer_delete(timer_takephoto);
     LOG_E("t_takephoto_callback");
     LOG_E("t_takephoto_callback");
-    device_status.C01 |= (1<<2);
-    device_status.C01 |= (1<<3);
-    HMI_WRITE("selfcheck.t4.bco=63488");
-    HMI_WRITE("selfcheck.t3.bco=63488");
-    HMI_WRITE("sysSet.va0.txt=\"拍照超时\"");
+    //关闭补光灯
+    ctr_led(OFF);
+    //关闭滑台驱动
+    slidelock();
+    Beep_Tip(5000);
 }
 }
 
 
 int selfcheck(uint8_t type)
 int selfcheck(uint8_t type)
@@ -289,7 +289,7 @@ int selfcheck(uint8_t type)
 int rt_software_timer_init(void)
 int rt_software_timer_init(void)
 {
 {
     //启动拍照超时定时器
     //启动拍照超时定时器
-    timer_takephoto = rt_timer_create("t_takephoto",t_takephoto_callback,RT_NULL, 100000, RT_TIMER_FLAG_ONE_SHOT|RT_TIMER_FLAG_HARD_TIMER);
+    timer_takephoto = rt_timer_create("t_takephoto",t_takephoto_callback,RT_NULL, 20000, 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_takephoto failed!");
         LOG_E("rt_timer_create t_takephoto failed!");