From 54a0b191c9e60a63562bff03b73d04c707be46e3 Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期五, 17 九月 2021 15:52:08 +0800
Subject: [PATCH] V1.54 测试通过

---
 源码/核心板/Src/application/beep_logic_app.c |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)

diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/beep_logic_app.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/beep_logic_app.c"
index 702660a..70c5716 100644
--- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/beep_logic_app.c"
+++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/beep_logic_app.c"
@@ -12,7 +12,18 @@
 
 #define ONTIME3 5   // 500ms
 #define OFFTIME3 5  // 500ms
+uint8_t send485_delayon[10] = {0xFE,0x0F,0x00,0x00,0x00,0x04,0x01,0xFF,0x31,0xD2 };
+uint8_t send485_delayoff[10] = {0xFE,0x0F,0x00,0x00,0x00,0x04,0x01,0x0,0x71,0x92 };
+void Send385ControlDelay(u8 state)
+{
+    if(state)
+    {	
+	UART_PushFrame(send485_delayon, 10);	
+    }else{
+        UART_PushFrame(send485_delayoff, 10);
+    }
 
+}
 uint16_t min_dist1,min_dist2;
 extern u16 JDQ_time;
 void Relay1Task(u16 min_dist)
@@ -21,8 +32,8 @@
     static uint8_t beep_state,timer_state,beep_timer,beep_ontime,beep_offtime;
          if (min_dist <= g_com_map[ALARM_DISTANCE2]+distoffset1)
                 {
-                    beep_ontime = JDQ_time;
-                    beep_offtime = JDQ_time;
+                    beep_ontime = 1;
+                    beep_offtime = 0;
                     beep_state=2;
                     distoffset1=0;
                     distoffset2=0;
@@ -48,6 +59,7 @@
                         if(beep_timer++ < beep_ontime)
                         {
                             RELAY1_ON;
+                            Send385ControlDelay(1);
                            		
                         }else{
                             timer_state=0;
@@ -57,6 +69,7 @@
                         if(beep_timer++ < beep_offtime)
                             {
                                 RELAY1_OFF;
+                                Send385ControlDelay(0);
                        
                             }else{
                                     timer_state=1;
@@ -64,6 +77,10 @@
                             }
                         
                     }
+                }else {
+                    RELAY1_OFF;
+                    Send385ControlDelay(0);
+                 //    RELAY2_OFF;
                 }
 }
 void Relay2Task(u16 min_dist)
@@ -72,8 +89,8 @@
     static uint8_t beep_state2,timer_state2,beep_timer2,beep_ontime2,beep_offtime2;
          if (min_dist <= g_com_map[RELAY2_DISTANCE2]+distoffset12)
                 {
-                    beep_ontime2 = JDQ_time;
-                    beep_offtime2 = JDQ_time;
+                    beep_ontime2 = 1;
+                    beep_offtime2 = 0;
                     beep_state2=2;
                     distoffset12=0;
                     distoffset22=0;
@@ -115,6 +132,9 @@
                             }
                         
                     }
+                }else {
+                   // RELAY1_OFF;
+                     RELAY2_OFF;
                 }
 }
 void main_logic(void)	//主逻辑在这里执行
@@ -122,7 +142,7 @@
 	uint16_t i;
 	//除UWB之外的其他代码...
 	static uint16_t beep_judge_cnt = 0;
-    if(g_com_map[ALARM_DISTANCE1]!=0||g_com_map[ALARM_DISTANCE2]!=0||g_com_map[ALARM_DISTANCE3]!=0)
+    if(g_com_map[ALARM_DISTANCE1]!=0||g_com_map[ALARM_DISTANCE2]!=0||g_com_map[ALARM_DISTANCE3]!=0||g_com_map[RELAY2_DISTANCE1]!=0||g_com_map[RELAY2_DISTANCE2]!=0||g_com_map[RELAY2_DISTANCE3]!=0)
     {
             if(beep_judge_cnt++ >= 100)
             {	
@@ -149,9 +169,11 @@
         if(g_com_map[RELAY1ON_INDEX]==1)
             {
              RELAY1_ON;
+                Send385ControlDelay(1);
             }else if(g_com_map[RELAY1ON_INDEX]==0)
             {
              RELAY1_OFF;
+                Send385ControlDelay(0);
             }
         if(g_com_map[RELAY2ON_INDEX]==1)
             {

--
Gitblit v1.9.3