From 5305c5dddc995ab4d2c18f5909802fefc6c4cc6a Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期一, 25 三月 2024 10:28:32 +0800 Subject: [PATCH] V1.6,加入钟工最新标签逻辑,修复休眠无法唤醒bug --- Src/application/dw_mbx_tag.c | 46 +++++++++++++++++++++++++--------------------- 1 files changed, 25 insertions(+), 21 deletions(-) diff --git a/Src/application/dw_mbx_tag.c b/Src/application/dw_mbx_tag.c index 71fb9f8..37f1018 100644 --- a/Src/application/dw_mbx_tag.c +++ b/Src/application/dw_mbx_tag.c @@ -217,8 +217,8 @@ } if(i==rec_nearbase_num&&taglist_pos==taglist_num)//当基站不在标签列表中,标签也不在基站列表中时,随机找个时间片回复基站。 { - //Anchor_RecNearPoll(rec_nearbase_num+start_time%2); - Anchor_RecNearPoll(rec_nearbase_num); + Anchor_RecNearPoll(rec_nearbase_num+start_time%5); +// Anchor_RecNearPoll(rec_nearbase_num); } } @@ -287,9 +287,11 @@ memcpy(&lora_sendbuffer[14],&checksum,2); Radio.Send(lora_sendbuffer,16); } -uint16_t heatbeat_count = 590; +#define HEATBEAT_UPDATE_TIME 3600 +uint16_t heatbeat_count = HEATBEAT_UPDATE_TIME-10; int16_t intheight; -#define HEATBEAT_UPDATE_TIME 600 +#define LORA_REPORT_MAXANC_NUM 7 +u8 tarray[20]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}; extern float Height; void LoraReportPoll(void) { @@ -315,6 +317,25 @@ LoraHeartBeartPoll(); return; } + for(u16 i=0; i<report_ancnum-1; i++) + { + for(u16 j=0; j<report_ancnum-1-i; j++) + { + if(report_ancdist[j]>report_ancdist[j+1]) + { + u16 id,dist; + u8 bat; + id = report_ancid[j]; + dist = report_ancdist[j]; + report_ancid[j] = report_ancid[j+1]; + report_ancdist[j] = report_ancdist[j+1]; + report_ancid[j+1] = id; + report_ancdist[j+1] = dist; + } + } + } + if(report_ancnum>LORA_REPORT_MAXANC_NUM) //考虑lora传输时间,最多发送10个基站数据。 + report_ancnum = LORA_REPORT_MAXANC_NUM; #ifdef USE_GPS lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGMSGTOWG_GPS; lora_sendbuffer[MSG_LENGTH] = 4*report_ancnum+ANCID_IDX; @@ -337,23 +358,6 @@ lora_sendbuffer[GPS_SPOWER_IDX] = gps_signalpower; lora_sendbuffer[GPS_CHAFENLINGQI] = gps_chafenlingqi; #endif - for(u16 i=0; i<report_ancnum-1; i++) - { - for(u16 j=0; j<report_ancnum-1-i; j++) - { - if(report_ancdist[j]>report_ancdist[j+1]) - { - u16 id,dist; - u8 bat; - id = report_ancid[j]; - dist = report_ancdist[j]; - report_ancid[j] = report_ancid[j+1]; - report_ancdist[j] = report_ancdist[j+1]; - report_ancid[j+1] = id; - report_ancdist[j+1] = dist; - } - } - } memcpy(&lora_sendbuffer[BAR_HEIGHT_IDX],&intheight,2); lora_sendbuffer[ANCNUM_IDX] = report_ancnum; memcpy(&lora_sendbuffer[ANCID_IDX],report_ancid,report_ancnum*2); -- Gitblit v1.9.3