| | |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | uint16_t heatbeat_count = 3600; |
| | | int16_t intheight; |
| | | #define HEATBEAT_UPDATE_TIME 3600 |
| | | #define LORA_REPORT_MAXANC_NUM 7 |
| | | extern float Height; |
| | | u8 tarray[20]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}; |
| | | void LoraReportPoll(void) |
| | | { |
| | | // delay_ms(100); |
| | |
| | | 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+30; |
| | |
| | | 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],&bar_height,2); |
| | | lora_sendbuffer[ANCNUM_IDX] = report_ancnum; |
| | | memcpy(&lora_sendbuffer[ANCID_IDX],report_ancid,report_ancnum*2); |