| | |
| | | } |
| | | return false; |
| | | } |
| | | uint8_t num1; |
| | | uint8_t pos_temp; |
| | | uint8_t motor_send_flag; |
| | | uint8_t Anchor_RecNearPoll(uint8_t ancrec_nearbasepos)//根据自己是否为新基站定制消息去发送,根据是否抢占判断 |
| | | { |
| | | temp_count2=poll_rx_en_start_u32; |
| | |
| | | memcpy(&send_buffer[ANCHOR_ID_IDX],&dev_id,2);//自身id |
| | | memcpy(&send_buffer[TAG_ID_IDX],&tag_id_recv,2);//接受者id |
| | | send_buffer[MESSAGE_TYPE_IDX]=MBX_RESPONSE; |
| | | if(tagdist_list[ancrec_nearbasepos]<=g_com_map[ALARM_DISTANCE1]) |
| | | send_buffer[RESP_MSG_TAG_MOTOR]=5;//下发标签5s震动 |
| | | else |
| | | if(tagdist_list[taglist_pos]<=g_com_map[ALARM_DISTANCE1]&&tagdist_list[taglist_pos]!=0) |
| | | {send_buffer[RESP_MSG_TAG_MOTOR]=5;//下发标签5s震动 |
| | | num1++; |
| | | }else{ |
| | | send_buffer[RESP_MSG_TAG_MOTOR]=0;//不震动 |
| | | |
| | | num1=0; |
| | | } |
| | | pos_temp=taglist_pos; |
| | | // if(rec_nearbase_num == ancrec_nearbasepos)//抢占模式自己为新基站 |
| | | // { |
| | | // random_time = (phy_timer_count_get()%100);//多基站抢占一个位置时避免一个也收不到的情况就每一个随机错开几十uS |
| | |
| | | temp_count3= phy_timer_count_get(); |
| | | flag_temp2=uwb_tx(send_buffer, 40,1 ,resp_tx_en_start_u32);//立即发送测试size大小 |
| | | tagofflinetime[taglist_pos] = 0;//更新标签通信 |
| | | // motor_send_flag=0; |
| | | // temp_count1=phy_timer_count_get(); |
| | | //while(mac_is_busy()); |
| | | //gpio_pin_clr(SCL_PIN); |
| | |
| | | { |
| | | memcpy(&tempid,&rx_buf[FZ_NEARBASEID_INDEX+i*2],2); |
| | | if(tempid==dev_id) |
| | | { |
| | | { |
| | | // if(tagdist_list[taglist_pos]<=g_com_map[ALARM_DISTANCE1]&&tagdist_list[taglist_pos]!=0) |
| | | // { |
| | | // motor_send_flag=1; |
| | | // }else{ |
| | | // motor_send_flag=0; |
| | | // } |
| | | Anchor_RecNearPoll(i); |
| | | tagdist_list[taglist_pos]=rec_ancdistlist[i]; |
| | | anchordata_bat[taglist_pos] = battary;//保存该基站电量 |