| | |
| | | #define TAG_NUM_IN_SYS 25 |
| | | |
| | | #define TAG_KEEPTIMES 30 |
| | | #define REPORT_TAG_KEEPTIMES 3 |
| | | static uint16_t ancidlist_rec[TAG_NUM_IN_SYS],ancidlist_send[TAG_NUM_IN_SYS],rec_ancidlist[TAG_NUM_IN_SYS],rec_ancdistlist[TAG_NUM_IN_SYS]; |
| | | static u8 frame_seq_nb2,battary,button,uwb_losttimer,taglist_pos; |
| | | |
| | |
| | | // delay_ms(10); |
| | | } |
| | | uint8_t report_ancnum; |
| | | uint16_t report_ancdist[ANC_MAX_NUM],report_ancid[ANC_MAX_NUM]; |
| | | void TagListUpdate(void) |
| | | { |
| | | uint16_t i,j=0,temp[TAG_NUM_IN_SYS]; |
| | | uint16_t i,j=0,k=0,temp[TAG_NUM_IN_SYS]; |
| | | for(i=0;i<taglist_num;i++) |
| | | { |
| | | if(tagofflinetime[i]++<REPORT_TAG_KEEPTIMES) |
| | | { |
| | | report_ancid[k]=tagid_list[i]; |
| | | report_ancdist[k++]=tagdist_list[i]; |
| | | } |
| | | if(tagofflinetime[i]++<TAG_KEEPTIMES) |
| | | { |
| | | tagid_list[j]=tagid_list[i]; |
| | | tagdist_list[j] = tagdist_list[i]; |
| | | tagofflinetime[j++]=tagofflinetime[i]; |
| | | } |
| | | } |
| | | report_ancnum = k; |
| | | taglist_num=j; |
| | | } |
| | | uint16_t CmpTagInList(uint16_t tagid) |
| | |
| | | } |
| | | } |
| | | static u16 checksum; |
| | | u8 gps_state,gps_chafenlingqi,gps_satel_num,test_num; |
| | | u8 gps_state,gps_chafenlingqi,gps_satel_num; |
| | | double gps_jingdu,gps_weidu; |
| | | extern u8 bat_percent,stationary_flag; |
| | | int16_t sendcount = 0,tp1; |
| | |
| | | TagListUpdate(); |
| | | |
| | | LoraReportFreqPoll(); |
| | | taglist_num = test_num; |
| | | |
| | | SwitchLoraSettings(wg_report_freq,REPORT_CHANNEL_SF,g_com_map[LORA_POWER]); |
| | | lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGMSGTOWG_GPS; |
| | | lora_sendbuffer[MSG_LENGTH] = 4*taglist_num+30; |
| | | lora_sendbuffer[MSG_LENGTH] = 4*report_ancnum+30; |
| | | 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[GPS_STATE_IDX] = gps_state; |
| | | lora_sendbuffer[GPS_SATEL_NUM_IDX] = gps_satel_num; |
| | | lora_sendbuffer[GPS_CHAFENLINGQI] = gps_chafenlingqi; |
| | | lora_sendbuffer[ANCNUM_IDX] = taglist_num; |
| | | memcpy(&lora_sendbuffer[ANCID_IDX],tagid_list,taglist_num*2); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+taglist_num*2],tagdist_list,taglist_num*2); |
| | | checksum = Checksum_u16(lora_sendbuffer,4*taglist_num+ANCID_IDX); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+taglist_num*4],&checksum,2); |
| | | Radio.Send(lora_sendbuffer,ANCID_IDX+taglist_num*4+2); |
| | | lora_sendbuffer[ANCNUM_IDX] = report_ancnum; |
| | | memcpy(&lora_sendbuffer[ANCID_IDX],report_ancid,report_ancnum*2); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*2],report_ancdist,report_ancnum*2); |
| | | checksum = Checksum_u16(lora_sendbuffer,4*report_ancnum+ANCID_IDX); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*4],&checksum,2); |
| | | Radio.Send(lora_sendbuffer,ANCID_IDX+report_ancnum*4+2); |
| | | bat_percent=Get_Battary(); |
| | | |
| | | } |