|
@@ -981,6 +981,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) |
|
|
} |
|
|
} |
|
|
else if(PlsrRoute.decel_pulse_count > 0) |
|
|
else if(PlsrRoute.decel_pulse_count > 0) |
|
|
{ |
|
|
{ |
|
|
|
|
|
/*目标频率target_freq是设定的,part1_target_freq是计算的,如果统一标识能达到目标频率*/ |
|
|
if(PlsrRoute.section[PlsrRoute.current_section_num-1].target_freq == PlsrRoute.part1_target_freq && PlsrRoute.current_part == PLSR_PART_1) |
|
|
if(PlsrRoute.section[PlsrRoute.current_section_num-1].target_freq == PlsrRoute.part1_target_freq && PlsrRoute.current_part == PLSR_PART_1) |
|
|
{ |
|
|
{ |
|
|
PlsrRoute.current_freq = PlsrRoute.target_freq; |
|
|
PlsrRoute.current_freq = PlsrRoute.target_freq; |
|
@@ -1416,7 +1417,7 @@ uint8_t PLSR_Section_StartNewSection(PLSR_RouteConfig_t* route) |
|
|
current_section->actual_pulse = SectionUpdatePluse + current_section->target_pulse - PlsrTotalPulseCount; |
|
|
current_section->actual_pulse = SectionUpdatePluse + current_section->target_pulse - PlsrTotalPulseCount; |
|
|
else |
|
|
else |
|
|
current_section->actual_pulse = SectionUpdatePluse + (-current_section->target_pulse) - PlsrTotalPulseCount; |
|
|
current_section->actual_pulse = SectionUpdatePluse + (-current_section->target_pulse) - PlsrTotalPulseCount; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
current_section->actual_pulse += 1; |
|
|
current_section->actual_pulse += 1; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
@@ -1620,8 +1621,8 @@ void PLSR_SetupThreePartExecution(PLSR_RouteConfig_t* route) |
|
|
HAL_TIM_GenerateEvent(&htim10, TIM_EVENTSOURCE_UPDATE); |
|
|
HAL_TIM_GenerateEvent(&htim10, TIM_EVENTSOURCE_UPDATE); |
|
|
} |
|
|
} |
|
|
if(FirstFlag == 0 && route->current_freq != 0) //在这里第一次启动PWM输出避免发默认脉冲 |
|
|
if(FirstFlag == 0 && route->current_freq != 0) //在这里第一次启动PWM输出避免发默认脉冲 |
|
|
{ |
|
|
|
|
|
FirstFlag = 1; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
FirstFlag = 1; |
|
|
switch (route->output_port) |
|
|
switch (route->output_port) |
|
|
{ |
|
|
{ |
|
|
case 0: |
|
|
case 0: |
|
|