From e5d499776ae8dbebdc2d11b4aab44a3f9314b4bc Mon Sep 17 00:00:00 2001
From: yincheng.zhong <634916154@qq.com>
Date: 星期二, 19 十一月 2024 15:03:41 +0800
Subject: [PATCH] V1.16 3秒触发一次

---
 Src/application/dw_app.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/Src/application/dw_app.c b/Src/application/dw_app.c
index c040cb8..c4d52e0 100644
--- a/Src/application/dw_app.c
+++ b/Src/application/dw_app.c
@@ -72,7 +72,7 @@
 #define FINAL_MSG_FINAL_TX_TS_IDX 18
 #define FINAL_MSG_TS_LEN 4
 
-#define _UWB_4G
+//#define _UWB_4G
 
 static dwt_config_t config = {
 #ifdef _UWB_4G
@@ -250,24 +250,33 @@
 typedef enum{	Next_Poll_RANGE,
                 Next_Poll_LORASYNC,
 }nextpoll_enum;
-nextpoll_enum next_poll_state;
+nextpoll_enum next_poll_state = Next_Poll_RANGE;
 extern uint8_t sync_lost_count;
+uint8_t send_count;
+#define FASONG_TIME 3
 void Tag_App(void)//发送模式(TAG标签)
 {  	
     SyncStateSwitch();
   if(next_poll_state==Next_Poll_RANGE)  //读取本次的工作状态 测距还是同步
   {
+    
     current_count=HAL_LPTIM_ReadCounter(&hlptim1);
-
+    if(send_count++%FASONG_TIME==0)
+    {    
     SwitchLoraSettings(UWB_CHANNEL_FRQ+g_com_map[GROUP_ID],5,g_com_map[LORA_POWER]); //切换lora接收频点  
 
     memcpy(&lora_start_poll_buff[ANC_ID_IDX],&g_com_map[DEV_ID],2);
+      LED_TB_ON;
+//      HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET);
     Radio.Send(lora_start_poll_buff, 4);
     UWB_Wkup();   
-    delay_us(700);
+    delay_us(1000);
     MBXANCPoll();
-	dwt_entersleep();
+//      HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_RESET);
+	dwt_entersleep();    
+    }
     next_poll_state = Next_Poll_LORASYNC;
+
   }else{
      LoraSyncRecPoll();
       if(GetRangeState())  //获取当前测距状态,是否开启。如果开启下次为测距,否为同步
@@ -285,7 +294,7 @@
 //          target_count = GetLoraSyncCount()-(18000)/LPTIMER_LSB+sync_lost_count*1000;
 //      }else
       {
-        target_count = GetLoraSyncCount()-(18000)/LPTIMER_LSB;  //比上次收到的lora提前17ms唤醒(lora接收大概17ms),如果在同步间隔内,则会快速进入休眠。
+        target_count = GetLoraSyncCount()-(23000)/LPTIMER_LSB;  //比上次收到的lora提前17ms唤醒(lora接收大概17ms),如果在同步间隔内,则会快速进入休眠。
       }
       if(target_count<0)
       target_count+=32768;

--
Gitblit v1.9.3