zhunk hai 1 ano
pai
achega
43088262ce

+ 20 - 5
Application_cbd_apm32f1/applications/control.c

@@ -1308,7 +1308,7 @@ void WorkCheck(void)
 //拍照性诱工作任务流程
 void WorkTask_XYV3(void)
 {
-    int cal_n = device_status.cul_time * 60;
+    rt_uint32_t 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&&
@@ -1316,20 +1316,35 @@ void WorkTask_XYV3(void)
             device_status.ds==1&&
             device_status.temp_status==0)
     {
+        ctr_router(ON);
+        ctr_RTU_DTU(ON);
         //高压板通电
         ctr_lamp(ON, 1);     //清扫-DC12v电机正反转
+        rt_thread_delay(10000);
+        ctr_lamp(OFF, 1);     //清扫-DC12v电机正反转
         //光栅传感器通电
         ctr_photo(ON);
         //拍照(?触发条件)计数?没有虫呢?定时
-        while(device_status.sleep_mode==0){
+        while(1){
             cal_n--;
             LOG_I("诱虫检测计数剩余时间:%d S",cal_n);
             if(cal_n==0){
+                ctr_lamp(OFF, 1);   //拍照时关闭高压
                 //发送拍照计数指令
                 device_status.photo_ws = 2;
                 cal_n = device_status.cul_time * 60;
             }
-            if(device_status.temp_status==1 || device_status.bat_status==1 ||device_status.work_status==0) break;
+            if(cal_n%1200==0)    //每隔20分钟高压通电30S
+            {
+                ctr_lamp(ON, 1);
+            }else if (cal_n%1230==0) {
+                ctr_lamp(OFF, 1);
+            }
+            if(device_status.temp_status==1 || device_status.bat_status==1 || device_status.work_status==0){
+                ctr_lamp(OFF, 1);
+                device_status.photo_ws = 2;
+                break;
+            }
             rt_thread_delay(1000);
         }
         rt_thread_delay(10000);
@@ -1498,8 +1513,8 @@ static void Control_Heat_thread_entry(void *parameter) {
                 // 执行关闭高压操作(示例函数)
                 ctr_lamp(OFF, 1);
                 // 可选:自动复位保护
-                rt_thread_mdelay(10000);    // 等待10秒
-                ctr_lamp(ON, 1);
+//                rt_thread_mdelay(10000);    // 等待10秒
+//                ctr_lamp(ON, 1);
                 highPressureDuration = 0;
             }
         }

+ 3 - 7
Application_cbd_apm32f1/applications/control.h

@@ -19,17 +19,13 @@
 
 #define LAMP_EN          0             //李新3灯管:0关闭,1打开
 #define PCB_V1           1             //1-旧PCB,0-新PCB(模块化)
-#define MATCH_DEVICE     0             //比赛设备
+
 #define SENSOR_EN        1             //温湿度:0关闭,1打开
 
-#if MATCH_DEVICE == 1
-#define LAMP_CURRENT    800
-#else
-#define LAMP_CURRENT    400
-#endif
+
 ////////////////////////////////////////////////////////////////
 
-#define VERSION  "2.2.5"
+#define VERSION  "2.3.5"
 
 
 extern rt_event_t event_485_play;

+ 15 - 33
Application_cbd_apm32f1/applications/dtu_uart2.c

@@ -284,24 +284,6 @@ void setSystemTime(struct tm *timeinfo) {
     }
 }
 
-// 函数定义:判断数组中是否有大于 100 的元素
-int hasElementGreaterThan400(uint16_t arr[], int size) {
-    for (int i = 0; i < size; i++) {
-        if (arr[i] < LAMP_CURRENT) {
-            return 1; // 找到大于 100 的元素,返回 1
-        }
-    }
-    return 0; // 遍历完数组,没有找到大于 100 的元素,返回 0
-}
-
-int hasElementGreater_lessThan400(uint16_t arr[], int size) {
-    for (int i = 0; i < size; i++) {
-        if (arr[i] > LAMP_CURRENT) {
-            return 1; // 找到大于 100 的元素,返回 1
-        }
-    }
-    return 0; // 遍历完数组,没有找到大于 100 的元素,返回 0
-}
 
 /*入口函数-指令发送*/
 static void dtu_thread_entry_send(void *parameter)
@@ -340,15 +322,15 @@ static void dtu_thread_entry_send(void *parameter)
                 {
                     HMI_WRITE("sleep=%d",1);
                 }
-                if(device_status.sleep_mode == 1) {
-                    LOG_I("启动联网模块剩余:%d -120",device_status.num_updata);
-                    if(device_status.num_updata==120&&device_status.work_status==0)
-                    {
-                        device_status.dattim = 120;     //省电,设置上传间隔为2H
-                        ctr_router(ON);
-                        ctr_RTU_DTU(ON);
-                    }
-                }
+//                if(device_status.sleep_mode == 1) {
+//                    LOG_I("启动联网模块剩余:%d -120",device_status.num_updata);
+//                    if(device_status.num_updata==120&&device_status.work_status==0)
+//                    {
+//                        device_status.dattim = 120;     //省电,设置上传间隔为2H
+//                        ctr_router(ON);
+//                        ctr_RTU_DTU(ON);
+//                    }
+//                }
             }
             else {
                 char *readinfo =  makeJson_ReadInfo();
@@ -371,12 +353,12 @@ static void dtu_thread_entry_send(void *parameter)
         }
     else {
             wait_i ++;
-            if(device_status.sleep_mode == 1){
-                if(wait_i==3500){
-                    ctr_router(ON);
-                    ctr_RTU_DTU(ON);
-                }
-            }
+//            if(device_status.sleep_mode == 1){
+//                if(wait_i==3500){
+//                    ctr_router(ON);
+//                    ctr_RTU_DTU(ON);
+//                }
+//            }
             LOG_I("wait connect internet......%d",wait_i);
         }
         rt_thread_mdelay(1000);

+ 1 - 3
Application_cbd_apm32f1/applications/hmi.c

@@ -1195,7 +1195,7 @@ void Check_ParamConfig(void)
         rt_sprintf(device_status.net,"1");
         rt_sprintf(device_status.csq,"0");
         rt_sprintf(device_status.sim,"1");
-
+        ctr_RTU_DTU(ON);
         ctr_router(ON);
         Hmi_Fresh();
         Control_clear();
@@ -1212,8 +1212,6 @@ void Check_ParamConfig(void)
         while(atoi(device_status.net)==1)
         {
             device_status.num_updata = 0;
-            if(Read_Real_Voltage()/100>5&&device_status.power_status==0)
-            ctr_RTU_DTU(ON);
             char *readinfo =  makeJson_ReadInfo();
             DTU_Write("%s",readinfo);
             rt_free(readinfo);

+ 13 - 41
Application_cbd_apm32f1/packages/syswatch-latest/src/syswatch.c

@@ -402,55 +402,27 @@ static void syswatch_thread_entry(void *parameter)
         }
 
 
-        if((alarm_new.tm_hour==11) ||
-                (alarm_new.tm_hour==13) ||
-                (alarm_new.tm_hour==15))
-
-        {
-            if((alarm_new.tm_hour==17) &&(alarm_new.tm_min==0) && (alarm_new.tm_sec==0))
-            {
-                ctr_router(ON);
-                ctr_RTU_DTU(ON);
-            }
-        }
-
-        if((alarm_new.tm_hour)==11 ||
-                (alarm_new.tm_hour==13) ||
-                (alarm_new.tm_hour==15) ||
-                (alarm_new.tm_hour==17))
+        if((alarm_new.tm_hour==00) ||
+                (alarm_new.tm_hour==01) ||
+                (alarm_new.tm_hour==02) ||
+                (alarm_new.tm_hour==03) ||
+                (alarm_new.tm_hour==04) ||
+                (alarm_new.tm_hour==23))
         {
-            if((alarm_new.tm_min==04)&&(alarm_new.tm_sec==0))
+            if((alarm_new.tm_min==01)&&(alarm_new.tm_sec==0))
             {
-                if(device_status.sleep_mode==1){
-                    device_status.photo_ws = 2;
-                }
-            }
-        }
-
-        if((alarm_new.tm_hour==11) ||
-                (alarm_new.tm_hour==13) ||
-                (alarm_new.tm_hour==15) ||
-                (alarm_new.tm_hour==17))
-        {
-            if((alarm_new.tm_min==10)&&(alarm_new.tm_sec==0))
-            {
-                if(device_status.sleep_mode==1){
-                    ctr_router(OFF);
-                    ctr_RTU_DTU(OFF);
-                }
+                ctr_router(OFF);
+                ctr_RTU_DTU(OFF);
             }
 
         }
-
-        if((alarm_new.tm_hour==9) || (alarm_new.tm_hour==18))
+        //
+        if((alarm_new.tm_hour==6) || (alarm_new.tm_hour==7))
         {
             if((alarm_new.tm_min==0) && (alarm_new.tm_sec==0))
             {
-                if(device_status.sleep_mode==1)
-                {
-                    ctr_router(OFF);
-                    ctr_RTU_DTU(OFF);
-                }
+                ctr_router(ON);
+                ctr_RTU_DTU(ON);
             }
         }
 

+ 4 - 0
Application_cbd_apm32f1/readme.md

@@ -1,3 +1,7 @@
+# 2025-08-08 更新说明
+	版本:2.3.5
+	1. 拍照过程关闭高压;
+	2. 0:00-5:00断电,其他时间通电,工作时间9-18,每20分钟高压通电30S;
 # 2025-07-23 更新说明
 	2.2.3
 	更新内容:

+ 9 - 1
Application_cbd_apm32f1/rt-thread/components/utilities/ymodem/ymodem.c

@@ -193,7 +193,7 @@ static rt_err_t _rym_do_handshake(
     rt_uint16_t recv_crc, cal_crc;
     rt_size_t data_sz;
     rt_tick_t tick;
-
+    rt_uint16_t update_timeout = 0;
     ctx->stage = RYM_STAGE_ESTABLISHING;
     /* send C every second, so the sender could know we are waiting for it. */
     for (i = 0; i < tm_sec; i++)
@@ -203,14 +203,22 @@ static rt_err_t _rym_do_handshake(
                               RYM_CHD_INTV_TICK);
         if (code == RYM_CODE_SOH)
         {
+            update_timeout = 0;
             data_sz = _RYM_SOH_PKG_SZ;
             break;
         }
         else if (code == RYM_CODE_STX)
         {
+            update_timeout = 0;
             data_sz = _RYM_STX_PKG_SZ;
             break;
         }
+        //超时重启
+        update_timeout++;
+        if(update_timeout==30)
+        {
+            rt_hw_cpu_reset();
+        }
     }
     if (i == tm_sec)
     {