From 73e460929836ec70336e8d6ba9523d2fb9af460e Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期四, 25 二月 2021 15:41:53 +0800 Subject: [PATCH] V2.21 修复刷新频率不正确BUG --- Src/application/dw_app.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Src/application/dw_app.c b/Src/application/dw_app.c index 82b941f..c102ec6 100644 --- a/Src/application/dw_app.c +++ b/Src/application/dw_app.c @@ -69,9 +69,8 @@ #define FINAL_MSG_FINAL_TX_TS_IDX 18 #define FINAL_MSG_TS_LEN 4 -#define STARTPOLL REGPOLL -#define SWITCHBASE_DIST -//#define SWITCHBASE_ZHUANDIAN +#define STARTPOLL REGPOLL//#define SWITCHBASE_DIST +#define SWITCHBASE_ZHUANDIAN enum enumtagstate { REGPOLL, @@ -647,6 +646,7 @@ uint32_t final_tx_time; u32 start_poll; u8 i,j,getsync_flag=0,timeout; + USART_putc(current_slotnum); dwt_setrxaftertxdelay(POLL_TX_TO_RESP_RX_DLY_UUS); //设置发送后开启接收,并设定延迟时间 dwt_setrxtimeout(RESP_RX_TIMEOUT_UUS); tag_succ_times = 0; @@ -766,7 +766,7 @@ } ancsync_time=((sync_timer)*1000+tmp_time); last_slotnum=current_slotnum; - current_slotnum=((float)(sync_timer*10)/(SLOTTIME_MS*bigslot_num))+1; + current_slotnum=((float)(sync_timer*10 - tagslotpos*SLOTTIME_MS)/(SLOTTIME_MS*bigslot_num))+1; if(current_slotnum==last_slotnum-1) {flag_getresponse=1;} lastsync_timer=sync_timer; @@ -809,6 +809,8 @@ } // dwt_write32bitreg(SYS_STATUS_ID,SYS_STATUS_RXFCG| SYS_STATUS_ALL_RX_ERR); } + if(flag_finalsend!=1) + {flag_finalsend = 2;} dwt_forcetrxoff(); dwt_write32bitreg(SYS_STATUS_ID,SYS_STATUS_RXFCG| SYS_STATUS_ALL_RX_ERR); @@ -840,9 +842,10 @@ pack_length = rec_remotepara[2]; if(pack_msgtype==2) { - if( pack_index == MOTOR_ONTIME_INDEX&&motor_keeptime==0) + if( pack_index == MOTOR_ONTIME_INDEX) { - motor_keeptime = rec_remotepara[3]; + if(motor_keeptime==0) + motor_keeptime = rec_remotepara[3]; }else{ memcpy((uint8_t*)&g_com_map + pack_index, &rec_remotepara[3], pack_length); //返回一个error状态 -- Gitblit v1.9.3