From 5ee4fd97245fed0d45fb60d1aa38cca83e788ed5 Mon Sep 17 00:00:00 2001
From: zhangbo <zhangbo@qq.com>
Date: 星期二, 20 五月 2025 16:13:14 +0800
Subject: [PATCH] 修改了计步逻辑还有蓝牙上传逻辑

---
 keil/include/src/Radio/lora_1268.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/keil/include/src/Radio/lora_1268.c b/keil/include/src/Radio/lora_1268.c
index 3997f6b..3141d79 100644
--- a/keil/include/src/Radio/lora_1268.c
+++ b/keil/include/src/Radio/lora_1268.c
@@ -173,7 +173,7 @@
 extern uint8_t DMA_RXBuf_BT[200];
 extern uint8_t report_ancnum;
 extern uint8_t report_ancnum_bt;
-uint32_t BT_SEND_flag=0;
+uint32_t BT_SEND_lenth=0;
 uint8_t BT_NUM=0;
 extern uint16_t report_ancdist[ANC_MAX_NUM],report_ancid[ANC_MAX_NUM];
 extern uint8_t bat_percent;
@@ -188,6 +188,7 @@
 uint8_t step_count_rep;
 //extern u16_m f_step;
 extern uint8_t uwbled,gpsled,loraled,powerled;
+extern uint8_t exercise_state;
 void LoraReportPoll(void)
 {
     // delay_ms(100);
@@ -252,7 +253,8 @@
     memcpy(&lora_sendbuffer[SOURCE_ID_IDX],&g_com_map[DEV_ID],2);
     memcpy(&lora_sendbuffer[DEST_ID_IDX],&wg_report_id,2);
     lora_sendbuffer[SEQNUM_IDX] = seq_num++;
-    lora_sendbuffer[BAT_IDX] = bat_percent;
+    lora_sendbuffer[BAT_IDX] = bat_percent;//(uint8_t)(step_count % 256);
+//		lora_sendbuffer[BAT_IDX] = (uint8_t)(step_count % 256);
 		lora_sendbuffer[STATE_IDX] = !GET_USERKEY|stationary_flag<<1;
 		//GET_USERKEY这个是那个lora——busy那个引脚
 //		lora_sendbuffer[STATE_IDX]=0x01;
@@ -283,19 +285,21 @@
     memcpy(&lora_sendbuffer[LORA_RETRANSNUSSION_BT+1],&DMA_RXBuf_BT[0],BT_NUM*2+1); 									//基站ID
     memcpy(&lora_sendbuffer[LORA_RETRANSNUSSION_BT+BT_NUM*2+2],&DMA_RXBuf_BT[1+BT_NUM*2],BT_NUM*2);//基站距离		
 		lora_sendbuffer[MSG_LENGTH] = LORA_RETRANSNUSSION_BT+4*BT_NUM+2;
-		
+
+    //保留位3
 		if(step_count < 0)
 			step_count=0;
-//		lora_sendbuffer[STEP_COUNT] = (uint8_t)(step_count % 256);
-		
+		  lora_sendbuffer[STEP_COUNT] = (uint8_t)(step_count % 256);
+		  lora_sendbuffer[EXERCISE_STATE]=exercise_state;
+		  lora_sendbuffer[RESERVED_POSITION]=0;
 //		}
 //		if(lora_sendbuffer[LORA_RETRANSNUSSION_BT]==0x2D)
 //		{
 		checksum = Checksum_u16(lora_sendbuffer,4*BT_NUM+4*report_ancnum+BT_ANCID_IDX+3);
 		memcpy(&lora_sendbuffer[LORA_RETRANSNUSSION_BT+BT_NUM*4+2],&checksum,2);
-		BT_SEND_flag=BT_ANCID_IDX+report_ancnum*4+BT_NUM*4+5;
+		BT_SEND_lenth=BT_ANCID_IDX+report_ancnum*4+BT_NUM*4+5;
 		
-		Radio.Send(lora_sendbuffer,BT_SEND_flag);	
+		Radio.Send(lora_sendbuffer,BT_SEND_lenth);	
 		LORA_POLL_COUNT++;
 //		LORA_3029_SINGLE_SEND(lora_sendbuffer,ANCID_IDX+report_ancnum*4+BT_NUM*4+4,0);
 //		}

--
Gitblit v1.9.3