| | |
| | | { |
| | | nearbase_distlist[nearmsg_i] = 0x1ffff; |
| | | } |
| | | //mainbase_id = 0x9818; |
| | | //mainbase_id = 0x1; |
| | | memcpy(&tx_near_msg[ANCHOR_ID_IDX],&mainbase_id,2); |
| | | memcpy(&tx_near_msg[TAG_ID_IDX],&dev_id,2); |
| | | tx_near_msg[MESSAGE_TYPE_IDX] = POS_MSG; |
| | |
| | | tx_near_msg[BATTARY_IDX] = bat_percent; |
| | | tx_near_msg[BUTTON_IDX] = userkey_state|stationary_flag<<1|gotosleep_flag<<2|motor_flag<<5; |
| | | tx_near_msg[SEQUENCE_IDX] = frame_seq_nb; |
| | | tx_near_msg[SEQUENCEH_IDX] = (frame_seq_nb++)>>8; |
| | | tx_near_msg[SEQUENCEH_IDX] = (frame_seq_nb++)>>8; |
| | | tx_near_msg[NEARBASENUM_INDEX] = nearbase_num; |
| | | memcpy(&tx_near_msg[NEARBASEID_INDEX],&nearbaseid_list,nearbase_num*2); |
| | | memcpy(&tx_near_msg[NEARBASEID_INDEX+nearbase_num*2],&nearbase_distlist,nearbase_num*4+4); |
| | | memcpy(&tx_near_msg[NEARBASEID_INDEX+nearbase_num*6+4],&rec_anc_signalpower,nearbase_num*2+2); |
| | | memcpy(&tx_near_msg[NEARBASEID_INDEX+nearbase_num*2],&nearbase_distlist,nearbase_num*4+4); |
| | | memcpy(&tx_near_msg[NEARBASEID_INDEX+nearbase_num*6+4],&rec_anc_signalpower,nearbase_num*2+2); |
| | | |
| | | |
| | | if(intheight!=0) |
| | |
| | | #endif |
| | | }else if(mainbase_lost_count>5*tag_frequency) |
| | | { |
| | | // tag_state = DISCPOLL; |
| | | tag_state = DISCPOLL; |
| | | } |
| | | if(mainbase_lost_count!=0) |
| | | { |
| | |
| | | { |
| | | if( pack_index == MOTOR_ONTIME_INDEX) |
| | | { |
| | | // if(motor_keeptime==0) |
| | | if(motor_keeptime==0) |
| | | motor_keeptime = rec_remotepara[3]; |
| | | }else if( pack_index == 2*COM_INTERVAL) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | if(get_newdist>2) |
| | | if(get_newdist>=2) |
| | | { |
| | | notenoughdist_count = 0; |
| | | }else{ |
| | | if(notenoughdist_count++>3) |
| | | if(notenoughdist_count++>10) |
| | | { |
| | | notenoughdist_count = 0; |
| | | // tag_state = DISCPOLL; |
| | | tag_state = DISCPOLL; |
| | | } |
| | | } |
| | | for(i=0;i<nearbase_num;i++) |