| | |
| | | checksum = Checksum_u16(lora_sendbuffer,9+data_length); |
| | | memcpy(&lora_sendbuffer[9+data_length],&checksum,2); |
| | | Radio.Send(lora_sendbuffer,data_length+11); |
| | | Delay_Ms(60); |
| | | Delay_Ms(160); |
| | | } |
| | | static uint8_t rec_index; |
| | | uint16_t rec_value; |
| | |
| | | //方法是将新注册的标签添加到下次发送的标签列表头部,其他标签依次向后挪动。 |
| | | uint16_t AddNewTagIntoList(uint16_t tagid) |
| | | { |
| | | u16 newindex_cal = taglist_current_index+25; |
| | | u16 newindex_cal = taglist_current_index+25;//当前索引+25,为下次索引要发出的值的最大值,如果总数小于这个值,即可放到最后面。 |
| | | if(newindex_cal>=taglist_total_num) //如果当前索引是最后一包,那么就加到总索引的后面,如果不是就加到下一次起始索引位置。 |
| | | { |
| | | newindex_cal = taglist_total_num; |
| | | |
| | | }else{ |
| | | for(u16 i=taglist_total_num;i>newindex_cal+1;i--) //从后往前挪地方 |
| | | for(u16 i=taglist_total_num;i>newindex_cal;i--) //从后往前挪地方 |
| | | { |
| | | taglist_id[i]=taglist_id[i-1]; |
| | | taglist_dist[i]=taglist_dist[i-1]; |
| | |
| | | extern float bat_volt; |
| | | uint16_t AD_value[500],ti; |
| | | extern float Height; |
| | | u8 rec_tag_num,temp_tag_num,kp1; |
| | | void MBXANCPoll(void) //将要发的标签序号,在列表中的位置 |
| | | { |
| | | |
| | | temp_tag_num = 0; |
| | | tag_num_tosend = taglist_total_num-taglist_current_index; |
| | | if(tag_num_tosend>25) |
| | | { |
| | |
| | | rec_tag_index = CmpTagInList(rec_nearbaseid); |
| | | temp_index =rec_tag_index -taglist_current_index; |
| | | SetANCTimestap(temp_index,&rx_buffer[RESP_MSG_POLL_RX_TS_IDX],&rx_buffer[RESP_MSG_RESP_TX_TS_IDX],resp_rx_ts,&rx_buffer[RESP_MSG_ANC_DISTOFFSET]); |
| | | temp_tag_num++; |
| | | } |
| | | |
| | | }else{ |
| | |
| | | dwt_rxenable(0); |
| | | |
| | | } |
| | | } |
| | | } |
| | | LED_TB_OFF; |
| | | dwt_forcetrxoff(); |
| | | rec_tag_num = temp_tag_num; |
| | | CalculateDists(); |
| | | TagListUpdate(); |
| | | dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR| SYS_STATUS_TXFRS |SYS_STATUS_RXFCG); |
| | |
| | | bat_volt = 3*(float)verfint_cal/AD_value[21]-0.1; |
| | | bat_percent=bat_volt*100-200; |
| | | } |
| | | for(uint8_t i=0;i<taglist_total_num;i++) |
| | | { |
| | | if(taglist_id[i] == 0x33) |
| | | { |
| | | kp1 = taglist_keeptime[i]; |
| | | } |
| | | } |
| | | #ifdef _USE_BAR_ |
| | | //if(taglist_total_num>0) |
| | | { |