From f27624585858707f761f893d3b4020319c6a3e85 Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期五, 18 十二月 2020 16:56:36 +0800 Subject: [PATCH] V2.16 手动时间片,时钟同步精度提高到0.1ms --- Src/main.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Src/main.c b/Src/main.c index b4cea85..2afbd19 100644 --- a/Src/main.c +++ b/Src/main.c @@ -135,8 +135,7 @@ MOTOR_ON; }else{ MOTOR_OFF; - } - + } break; case 2: MOTOR_ON; @@ -211,7 +210,7 @@ u16 current_slotnum; extern int32_t offsettimeus; #define FIXSLOT -#define FIXSLOTPOS 1 +#define FIXSLOTPOS 2 u16 slotpos_intoatl; uint16_t bigslot_num; uint8_t fix_slotpos =FIXSLOTPOS; @@ -221,13 +220,14 @@ { #ifdef FIXSLOT - fix_slotpos =0;// g_com_map[ALARM_DISTANCE1]; +// fix_slotpos =FIXSLOTPOS; + fix_slotpos = g_com_map[ALARM_DISTANCE1]; slotpos = fix_slotpos; tagslotpos = fix_slotpos; #endif - if(current_slotnum>=tag_frequency) - current_slotnum-=tag_frequency; + while(current_slotnum>=tag_frequency) + { current_slotnum-=tag_frequency;} slotpos_intoatl = current_slotnum*bigslot_num+slotpos; if(current_slotnum==19) @@ -236,7 +236,7 @@ //if(target_time<90000) { - lptime=target_time-offsettimeus-10000; + lptime=target_time-offsettimeus+1200; lpcount = lptime/LPTIMER_LSB; if(lpcount>LPTIMER_1S_COUNT) lpcount-=LPTIMER_1S_COUNT; @@ -255,7 +255,7 @@ Usart1ParseDataCallback = UsartParseDataHandler; parameter_init(); //deca_sleep(1000); - g_com_map[VERSION] = 0x020f; + g_com_map[VERSION] = 0x0210; #ifdef DEBUG_MODE // g_com_map[DEV_ROLE]=1; // g_com_map[DEV_ID]=0x11; @@ -266,8 +266,8 @@ //g_com_map[COM_INTERVAL]=50; #endif //g_com_map[NOMOVESLEEP_TIME]=10; -// g_com_map[IMU_ENABLE]=0; -// g_com_map[COM_INTERVAL]=50; + g_com_map[IMU_ENABLE]=0; + g_com_map[COM_INTERVAL]=1000; active_flag = g_com_map[ACTIVE_INDEX]; if(active_flag==0) { g_com_map[COM_INTERVAL]=1000; -- Gitblit v1.9.3