| | |
| | | }; |
| | | uint32_t dev_id; |
| | | uint8_t group_id; |
| | | |
| | | #ifdef DW1000 |
| | | /* Default communication configuration. */ |
| | | static struct mk_uwb_configure config = {//yuan |
| | | .phy_work_mode = (uint8_t)(PHY_TX | PHY_RX), |
| | | .phy_cfg.ch_num = 9, /* Channel number. */ |
| | | .phy_cfg.ch_num = UWB_CH_NUM, /* Channel number. */ |
| | | .phy_cfg.code_index = 9, /* TRX preamble code */ |
| | | .phy_cfg.mean_prf = MEAN_PRF_64M, /* Mean prf 64/128/256M */ |
| | | .phy_cfg.data_bit_rate = DATA_BR_6M8, /* Data rate 6.8M */ |
| | |
| | | extern double distance; |
| | | extern uint8_t bat_percent; |
| | | uint32_t count1,count2; |
| | | extern uint32_t reboot_num; |
| | | enum SIMPLE_FSM_T |
| | | { |
| | | SIMPLE_IDLE = 0, |
| | |
| | | { |
| | | tag_num_tosend = SEND_GROUP_MAX_NUM; |
| | | } |
| | | memcpy(&uwb_sendbuffer[7],&g_com_map[VERSION],2); |
| | | uwb_sendbuffer[GROUP_ID_IDX] = group_id; |
| | | memcpy(&uwb_sendbuffer[TAG_ID_IDX],&dev_id,2); |
| | | uwb_sendbuffer[BATTARY_IDX] = bat_percent; |
| | |
| | | memcpy(&uwb_sendbuffer[NEARBASEID_INDEX+tag_num_tosend*2],&taglist_dist[taglist_current_index],tag_num_tosend*2); |
| | | uwb_sendbuffer[MESSAGE_TYPE_IDX] = MBX_POLL; |
| | | memcpy(&uwb_sendbuffer[ANCHOR_ID_IDX],&mainbase_id,2); |
| | | |
| | | } |
| | | |
| | | static enum SIMPLE_FSM_T state = SIMPLE_IDLE; |
| | |
| | | sleep_timer_start(__MS_TO_32K_CNT(SLEEP_COUNT-rand_temp));//测试 |
| | | }else if (rx_buf[MESSAGE_TYPE_IDX] == MBX_RESPONSE&&!memcmp(&rx_buf[TAG_ID_IDX],&dev_id,2)&&rx_buf[GROUP_ID_IDX]==group_id) //判断接收到的数据是否是response数据 |
| | | { |
| | | reboot_num=0;//清0复位监测数值 |
| | | memcpy(&rec_nearbaseid,&rx_buf[ANCHOR_ID_IDX],2); |
| | | rec_tag_index = CmpTagInList(rec_nearbaseid);//当前新来的这包数据插入当前表中的位置索引 |
| | | //rec_nearbasepos=FindNearBasePos(rec_nearbaseid); |