SET_BIT(TIM1->CR2, TIM_CR2_CCPC); //Enable Capture/Compare Preloaded Control
__HAL_TIM_MOE_ENABLE(&htim1); //Enable the TIM main Output.
/* USER CODE BEGIN TIM1_Init 2 */
__HAL_TIM_CLEAR_FLAG(&htim1, TIM_FLAG_TRIGGER);
__HAL_TIM_ENABLE_IT(&htim1, TIM_FLAG_TRIGGER); //??Update??,??PI??