From 95e97a5cd0aa1bfd7c87e2bd66a9afbdd086e34e Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期六, 12 九月 2020 15:01:58 +0800 Subject: [PATCH] 增加基站远程修改标签配置功能,未充分测试 --- 源码/核心板/Src/application/dw_app.c | 42 +++++++++++++++++++++++++++++------------- 1 files changed, 29 insertions(+), 13 deletions(-) diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" index fd7fc57..aa958c2 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" @@ -611,13 +611,13 @@ } // printf("%d,%d",temp_sync_timer2,temp_sync_timer1); -// #ifdef USART_INTEGRATE_OUTPUT -// usart_send[2] = 4;//正常模式 -// usart_send[3] = report_num*6+2;//正常模式 -// checksum = Checksum_u16(&usart_send[2],report_num*6+2); -// memcpy(&usart_send[4+report_num*6],&checksum,2); -// UART_PushFrame(usart_send,6+report_num*6); -// #endif + #ifdef USART_INTEGRATE_OUTPUT + usart_send[2] = 4;//正常模式 + usart_send[3] = report_num*6+2;//正常模式 + checksum = Checksum_u16(&usart_send[2],report_num*6+2); + memcpy(&usart_send[4+report_num*6],&checksum,2); + UART_PushFrame(usart_send,6+report_num*6); + #endif // if(mainbase_lost_count>5) // { // //tag_state=DISCPOLL; @@ -816,7 +816,9 @@ dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR); } } -u8 misdist_num[TAG_NUM_IN_SYS],seize_anchor; +extern uint16_t configremotetagID; +extern u8 remotetag_paralen; +u8 misdist_num[TAG_NUM_IN_SYS],seize_anchor,waittagconfig_reponse; u8 Anchor_RecNearPoll(u8 ancrec_nearbasepos) //0 mainbase 1 first near_base { u8 motorstate; @@ -855,11 +857,13 @@ tx_nearresp_msg[MAINBASE_INDEX]=flag_syncbase; tx_nearresp_msg[MESSAGE_TYPE_IDX]=NEAR_RESPONSE; tx_nearresp_msg[MOTORSTATE_INDEX]=(remotesend_state<<4)|motorstate; - if(remotesend_state) + waittagconfig_reponse=0; + if(remotesend_state&&!memcmp(&rx_buffer[TAG_ID_IDX],&configremotetagID,2)) { - memcpy(&tx_nearresp_msg[REMOTEPARA_INDEX],remotetag_para,REMOTEPARA_LEN); - dwt_writetxdata(22+REMOTEPARA_LEN, tx_nearresp_msg, 0);//写入发送数据 - dwt_writetxfctrl(22+REMOTEPARA_LEN, 0);//设定发送长度 + memcpy(&tx_nearresp_msg[REMOTEPARA_INDEX],remotetag_para,remotetag_paralen); + dwt_writetxdata(22+remotetag_paralen, tx_nearresp_msg, 0);//写入发送数据 + dwt_writetxfctrl(22+remotetag_paralen, 0);//设定发送长度 + waittagconfig_reponse=1; }else{ dwt_writetxdata(22, tx_nearresp_msg, 0);//写入发送数据 dwt_writetxfctrl(22, 0);//设定发送长度 @@ -918,7 +922,7 @@ dis_after_filter=dist_cm; hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]; g_flag_Taggetdist[taglist_pos]=0; - if(hex_dist>-1000&&hex_dist<100000) + if(hex_dist>-1000&&hex_dist<200000) { if(abs(hex_dist-his_dist[taglist_pos])<1500||misdist_num[taglist_pos]>3) { @@ -948,6 +952,18 @@ misdist_num[taglist_pos]++; } } + if(rx_buffer[TAGCONFIGSUCCESS_INDEX]==1&&waittagconfig_reponse) + { + waittagconfig_reponse = 0; + remotesend_state = 0; + usart_send[2] = 7;//正常模式 + usart_send[3] = 5;//数据段长度 + memcpy(&usart_send[4],&tag_id_recv,2); + usart_send[6] = 1;//数据段长度 + checksum = Checksum_u16(&usart_send[2],5); + memcpy(&usart_send[7],&checksum,2); + UART_PushFrame(usart_send,9); + } } }else{ //printf("%x/n",status_reg); -- Gitblit v1.9.3