From 4cf8adc0dd1286f8585d0be7a2bf367bb8119cdc Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期二, 06 四月 2021 16:16:38 +0800 Subject: [PATCH] V2.16 测试完成WIFI串口功能。 --- 源码/核心板/Src/application/dw_app.c | 31 +++++++++++++++++++------------ 1 files changed, 19 insertions(+), 12 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 1f0e5fe..088b3aa 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" @@ -918,11 +918,13 @@ uint32_t time_monitor[10]; extern uint16_t configremotetagID; extern u8 remotetag_paralen; -u8 misdist_num[TAG_NUM_IN_SYS],seize_anchor,waittagconfig_reponse; +u8 finalsend=0; +u8 misdist_num[TAG_NUM_IN_SYS],seize_anchor,waittagconfig_reponse,motorstate=0; u8 Anchor_RecNearPoll(u8 ancrec_nearbasepos) //0 mainbase 1 first near_base { - u8 motorstate; + tmp_time=TIM3->CNT; + memcpy(&tx_nearresp_msg[NR_NEARSWITCH_DISTANCE],&g_com_map[NEARSWITCH_DISTANCE_INDEX],2); memcpy(&tx_nearresp_msg[ANCTIMEMS],&sync_timer,2); memcpy(&tx_nearresp_msg[ANCTIMEUS],&tmp_time,2); memcpy(&tx_nearresp_msg[TAGSLOTPOS],&taglist_pos,2); @@ -946,6 +948,7 @@ tx_nearresp_msg[MESSAGE_TYPE_IDX]=NEAR_RESPONSE; tx_nearresp_msg[MOTORSTATE_INDEX]=(remotesend_state<<4)|motorstate; waittagconfig_reponse=0; + finalsend = 0; if(pwtag.remain_time>0) {uint8_t i; for(i=0;i<pwtag.groupnum;i++) @@ -960,16 +963,19 @@ remotetag_para[2] = 2; memcpy(&remotetag_para[3],&pwtag.group_interval[i],2); 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);//设定发送长度 + dwt_writetxdata(24+remotetag_paralen, tx_nearresp_msg, 0);//写入发送数据 + dwt_writetxfctrl(24+remotetag_paralen, 0);//设定发送长度 remotesend_state=0; + finalsend = 1; break; } } + } - }else{ - dwt_writetxdata(22, tx_nearresp_msg, 0);//写入发送数据 - dwt_writetxfctrl(22, 0);//设定发送长度 + if(finalsend == 0) + { + dwt_writetxdata(24, tx_nearresp_msg, 0);//写入发送数据 + dwt_writetxfctrl(24, 0);//设定发送长度 } // if(remotesend_state&&tag_id_recv==configremotetagID) @@ -1082,9 +1088,9 @@ misdist_num[taglist_pos]++; } } - if(rx_buffer[TAGCONFIGSUCCESS_INDEX]==1&&waittagconfig_reponse) + if(rx_buffer[TAGCONFIGSUCCESS_INDEX]==1) { - waittagconfig_reponse = 0; + remotesend_state = 0; usart_send[2] = 7;//正常模式 usart_send[3] = 5;//数据段长度 @@ -1177,7 +1183,7 @@ case REG_POLL: for(i=0;i<MAX_REGTAGNUM;i++) { - if(tag_id_recv==regtag_map.tagid[i]) + if(tag_id_recv==regtag_map.tagid[i]&®tag_map.remain_time[i]>0) { tx_near_msg[REGR_TAGSLOTPOS_INDEX]=regtag_map.tag_slotpos[i]; tx_near_msg[REGR_TAGFREQ_INDEX] = regtag_map.tag_frequency[i]; @@ -1192,6 +1198,7 @@ dwt_writetxfctrl(send_len, 0);//设置超宽带发送数据长度 dwt_starttx(DWT_START_TX_IMMEDIATE); regtag_map.tagid[i] = 0; + break; } } @@ -1231,7 +1238,7 @@ GPIO_WriteBit(GPIOB, GPIO_Pin_10, Bit_SET); if(anc_id_recv==dev_id) { - Anchor_RecNearPoll(0); + Anchor_RecNearPoll(rec_nearbase_num); }else{ for(i=0;i<rec_nearbase_num;i++) @@ -1241,7 +1248,7 @@ { seize_anchor=0; //非抢占。已存在列表中 - Anchor_RecNearPoll(i+1); + Anchor_RecNearPoll(i); break; } } -- Gitblit v1.9.3