| | |
| | | #include "dw_app.h" |
| | | #include "ADC.h" |
| | | #define TDFILTER |
| | | enum enumtagstate |
| | | { |
| | | DISCPOLL, |
| | |
| | | memcpy(&rec_tagpos_binary,&rx_buffer[NEARMSG_EMPTYSLOTPOS_INDEX],4); |
| | | if(temp_dist!=0x1ffff) |
| | | { |
| | | g_Resttimer=0; |
| | | #ifndef USART_INTEGRATE_OUTPUT |
| | | usart_send[2] = 1;//æ£å¸¸æ¨¡å¼ |
| | | usart_send[3] = 17;//æ°æ®æ®µé¿åº¦ |
| | |
| | | { |
| | | //LED0_ON; |
| | | dwt_forcetrxoff(); |
| | | g_Resttimer=0; |
| | | GPIO_WriteBit(GPIOA, GPIO_Pin_10, Bit_SET); |
| | | switch(tag_state) |
| | | { |
| | |
| | | tof = tof_dtu * DWT_TIME_UNITS; |
| | | distance = tof * SPEED_OF_LIGHT;//è·ç¦»=å
é*é£è¡æ¶é´ |
| | | dist_no_bias = distance - dwt_getrangebias(config.chan, (float)distance, config.prf); //è·ç¦»åå»ç«æ£ç³»æ° |
| | | dist_cm = dist_no_bias * 100; //dis 为åä½ä¸ºcmçè·ç¦» |
| | | dist_cm = dist_no_bias * 1000; //dis 为åä½ä¸ºcmçè·ç¦» |
| | | /*--------------------------以ä¸ä¸ºéæµè·é»è¾------------------------*/ |
| | | //dist_cm=33000; |
| | | getrange_success = 1; |
| | | g_Resttimer=0; |
| | | LED0_BLINK; //æ¯æå䏿¬¡é讯åéªç䏿¬¡ |
| | | dis_after_filter=dist_cm; |
| | | hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]; |
| | | hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]*10; |
| | | g_flag_Taggetdist[taglist_pos]=0; |
| | | if(hex_dist>-1000&&hex_dist<200000) |
| | | if(hex_dist>-10000&&hex_dist<2000000) |
| | | { |
| | | if(abs(hex_dist-his_dist[taglist_pos])<1500||misdist_num[taglist_pos]>3) |
| | | if(abs(hex_dist-his_dist[taglist_pos])<15000||misdist_num[taglist_pos]>3) |
| | | { |
| | | int32_t filter_dist; |
| | | #ifdef TDFILTER |
| | | NewTrackingDiffUpdate(taglist_pos, (float)hex_dist); |
| | | filter_dist=pos_predict[taglist_pos]/10; |
| | | #else |
| | | filter_dist=hex_dist/10; |
| | | #endif |
| | | misdist_num[taglist_pos]=0; |
| | | tagdist_list[taglist_pos] = hex_dist; |
| | | tagdist_list[taglist_pos] = filter_dist; |
| | | his_dist[taglist_pos]=hex_dist; |
| | | g_Tagdist[taglist_pos]=hex_dist; |
| | | g_Tagdist[taglist_pos]=filter_dist; |
| | | #ifndef USART_INTEGRATE_OUTPUT |
| | | usart_send[2] = 1;//æ£å¸¸æ¨¡å¼ |
| | | usart_send[3] = 17;//æ°æ®æ®µé¿åº¦ |
| | |
| | | // if (anchor_type == rx_buffer[ANC_TYPE_IDX]) |
| | | // Anchor_RecPoll(); |
| | | // break; |
| | | case SYNC: |
| | | g_Resttimer=0; |
| | | case SYNC: |
| | | memcpy(&rec_syncid,&rx_buffer[ANCHOR_ID_IDX],4); |
| | | if(rec_syncid<current_syncid) |
| | | { |
| | |
| | | } |
| | | break; |
| | | |
| | | case NEAR_POLL: |
| | | g_Resttimer=0; |
| | | case NEAR_POLL: |
| | | memcpy(&tag_id_recv,&rx_buffer[TAG_ID_IDX],2); |
| | | taglist_pos=CmpTagInList(tag_id_recv); |
| | | if(taglist_pos==taglist_num) |