zhunk 3 дней назад
Родитель
Сommit
2c4119c0f8

+ 31 - 29
Application_cbd_apm32f1/applications/control.c

@@ -584,7 +584,7 @@ void pin_guangshan_unbind(void)
 void WorkTask_XYV3(void)
 {
     static uint8_t gaoya_on = 0;
-    static uint8_t gaoya_on_sec = 0;
+    uint8_t tick_100ms = 0;
     rt_uint32_t cal_n = device_status.cul_time * 60;
     LOG_I("工作状态:%d",device_status.work_status);
     LOG_I("开关机状态:%d",device_status.ds);
@@ -597,47 +597,50 @@ void WorkTask_XYV3(void)
     {
         //高压通电
         ctr_gaoya_12v(ON);
+        gaoya_on = 1;
         //光栅传感器通电
         pin_guangshan_bind();
         //拍照(?触发条件)计数?没有虫呢?定时
+        tick_100ms = 0;
         while(1){
-            cal_n--;
-            LOG_I("诱虫检测计数剩余时间:%d S",cal_n);
-            if(cal_n==0){
-                //拍照时关闭高压
-                //发送拍照计数指令
-                device_status.photo_ws = 2;
-                cal_n = device_status.cul_time * 60;
+            //高压1Hz输出:通电100ms,断电900ms(每100ms为一个节拍)
+            if(tick_100ms==0){
+                if(gaoya_on==0){
+                    ctr_gaoya_12v(ON);
+                    gaoya_on = 1;
+                }
             }
-            if(cal_n%2==0)    //每隔2S钟高压通电5S
-            {
-//                ctr_router(ON);
-//                ctr_RTU_12V(ON);
-                ctr_gaoya_12v(ON);
-                gaoya_on = 1;
+            else if(gaoya_on==1){
+                ctr_gaoya_12v(OFF);
+                gaoya_on = 0;
             }
-            if(device_status.sleep_mode==1){
-                if(cal_n==100){
-                    ctr_RTU_12V(ON);
-                }
-                else if (cal_n==3400) {
-                    ctr_RTU_12V(OFF);
+            tick_100ms++;
+            if(tick_100ms>=10){    //满1S,处理秒级任务
+                tick_100ms = 0;
+                cal_n--;
+                LOG_I("诱虫检测计数剩余时间:%d S",cal_n);
+                if(cal_n==0){
+                    //拍照时关闭高压
+                    //发送拍照计数指令
+                    device_status.photo_ws = 2;
+                    cal_n = device_status.cul_time * 60;
                 }
-            }
-            if(gaoya_on){
-                gaoya_on_sec++;
-                if(gaoya_on_sec>5){
-                    gaoya_on=0;
-                    gaoya_on_sec = 0;
-                    ctr_gaoya_12v(OFF);
+                if(device_status.sleep_mode==1){
+                    if(cal_n==100){
+                        ctr_RTU_12V(ON);
+                    }
+                    else if (cal_n==3400) {
+                        ctr_RTU_12V(OFF);
+                    }
                 }
             }
             if(device_status.temp_status==1 || device_status.bat_status==1 || device_status.work_status==0){
                 ctr_gaoya_12v(OFF);
+                gaoya_on = 0;
                 device_status.photo_ws = 2;
                 break;
             }
-            rt_thread_delay(1000);
+            rt_thread_delay(100);
         }
         rt_thread_delay(10000);
     }
@@ -723,7 +726,6 @@ static void Check_gaoya_thread_entry(void *parameter)
             gaoya_cnt = 0;
             gaoya_hand = TRUE;
             LOG_I("高压触发:[%d,%d]",gaoya_value1,gaoya_value2);
-            rt_thread_delay(1000);
             ctr_clear();
             device_status.gaoya_count++;   //2026-07-02
         }

+ 1 - 1
Application_cbd_apm32f1/applications/control.h

@@ -22,7 +22,7 @@
 #define V2000W_EN        0            //拍照性诱: 2000W
 ////////////////////////////////////////////////////////////////
 
-#define VERSION  "3.13.1"
+#define VERSION  "3.13.2"
 
 extern rt_event_t event_485_play;
 

+ 1 - 2
Application_cbd_apm32f1/applications/dtu_uart2.c

@@ -1556,10 +1556,9 @@ int parseDtu(char *json_string)
               {
                   char * readinfo = makeJson_ReadInfo();
                   DTU_Write("%s",readinfo);
-                  rt_kprintf("%s\n",readinfo);
                   rt_free(readinfo);
                   device_status.hmi_fresh = 2;
-                  device_status.refresh_num = 15;
+                  device_status.refresh_num = 0;
               }
               else if (strstr(item_cmd->valuestring,"poweron")!=RT_NULL)
               {

+ 20 - 11
Application_cbd_apm32f1/applications/hmi.c

@@ -580,7 +580,7 @@ static void HMI_Decode(void)
     gmtime_r(&now, &tm);
     static char *json_temp;
     static char *var;
-    if(device_status.refresh_num==0)  device_status.refresh_num = 10;
+    if(device_status.refresh_num==0)  device_status.refresh_num = 5;
     if(strstr(rx_buffer,"getFullData") != NULL){
         /* ★ 换页/唤醒后的强制全量刷新。
          * 本工程屏幕没有"换页"通知指令(只有周期性的 getFullData),而内容去重会让
@@ -605,17 +605,25 @@ static void HMI_Decode(void)
            期间其它线程的 HMI_WRITE 仍走立即发送(见 hmi_batch_owned)。 */
         HMI_BATCH_BEGIN();
         freq_refresh_cb0++;
-        char *readinfo =  makeJson_ReadInfo();
         if(device_status.refresh_num==5)
         {
-            device_status.refresh_num = 15;
-            DTU_Write("%s",readinfo);
-            //list_mem();
-            device_status.hmi_fresh = 1;
-            rt_thread_delay(100);
+           device_status.refresh_num = 0;
+           char *readinfo =  makeJson_ReadInfo();
+           DTU_Write("%s",readinfo);
+           rt_free(readinfo);
+           /* 2026-10-15 修复:不得覆盖云端 read 触发的待补发上报标志(hmi_fresh==2)。
+            * 原实现无条件置 1,会把 read→getinfo→sync→补发上报 链路上的待办请求吃掉:
+            * 本屏幕刷新周期(refresh_num==5)恰好落在 RTU 应答 synchronization 的
+            * 1.5~2.2s 窗口内时,==2 判定失效 → 补发被吞 → read 无应答、RTU 等待超时
+            * (设备实测 2026-10-15:read 后数百 ms 内即被覆盖)。 */
+           if(device_status.hmi_fresh!=2)
+           {
+               device_status.hmi_fresh = 1;
+           }
+           rt_thread_delay(100);
         }
-        //在解析getinfo中清除超时
-        if(device_status.refresh_timeout==30)
+        //在解析getinfo中清除超时0
+        if(device_status.refresh_timeout==15)
         {
               rt_sprintf(device_status.sim,"1");
               rt_sprintf(device_status.net,"1");
@@ -623,9 +631,10 @@ static void HMI_Decode(void)
               device_status.camsta = 1;
               device_status.link_sta=0;
               device_status.refresh_timeout=0;
+              HMI_WRITE("menu.warn.txt=\"%s\"","[RTU/4G模块]通信失败,检查连接/固件!");
         }
-        rt_free(readinfo);
-        device_status.refresh_num--;
+
+        device_status.refresh_num++;
         device_status.refresh_timeout++;
         if(1)
         {

+ 18 - 0
Application_cbd_apm32f1/readme.md

@@ -1,3 +1,21 @@
+# 2026-11-24 更新说明
+	1、取消高压触发后1S的延迟再执行扫虫
+# 2026-11-23 更新说明
+	#版本:3.13.2
+	1、高压包 12V 输出改为脉冲通断,频率 1Hz:通电 100ms、断电 900ms
+		(原为“每 2S 通电一次、持续 5S”):
+		① WorkTask_XYV3 内层循环节拍由 rt_thread_delay(1000) 改为 100ms,
+		   新增 tick_100ms 计数,满 10 拍(1S)回零;
+		② 第 0 拍开高压、第 1~9 拍保持关闭,构成 1S 周期(100ms 通 + 900ms 断);
+		③ 原秒级任务(cal_n 倒计时、剩余时间日志、cal_n==0 触发拍照、
+		   sleep_mode 下 RTU 12V 定时开关)全部移入“满 1S”分支,时序与原逻辑一致;
+		④ 删除 gaoya_on_sec 的 5S 计时;gaoya_on 仅作状态缓存,只在状态切换时写引脚,
+		   避免每 100ms 重复写同一电平;
+		⑤ 温控/电池/停止工作的退出分支同步置 gaoya_on=0,防止下次进入时状态残留。
+	2、注意:ctr_gaoya_12v() 内部带 LOG_W 打印,通断变为 1Hz 后约每秒 2 条日志,
+	   如需减少日志可去掉该函数内的打印。
+	3、上机待验:高压包 12V 应为 1Hz、高电平 100ms(示波器/万用表确认);
+	   诱虫与拍照时序正常;低功耗(sleep_mode)下 RTU 12V 定时开关时间点不变。
 # 2026-11-19 更新说明
 	#版本:3.13.1
 	1、修复无法设置开关机问题,原因是加了dtype判断,当前性诱是8,判断的是3