PWM frequency changed, start-up time modified and display inverted
This commit is contained in:
parent
afd9205225
commit
8af135d159
@ -388,7 +388,6 @@ int main(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
SleepMode_Func(disp_buf.screen_timeout, disp_buf.screen_brightness);
|
||||
if((flash_flag == true) && (disp_buf.motor_status != MOTOR_RUN)){
|
||||
flash_flag = false;
|
||||
FLASH_Update();
|
||||
@ -795,7 +794,7 @@ static void MX_TIM4_Init(void)
|
||||
|
||||
/* USER CODE END TIM4_Init 1 */
|
||||
htim4.Instance = TIM4;
|
||||
htim4.Init.Prescaler = 125-1;
|
||||
htim4.Init.Prescaler = 20-1;
|
||||
htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim4.Init.Period = 100-1;
|
||||
htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
@ -850,7 +849,7 @@ static void MX_TIM4_Init(void)
|
||||
|
||||
/* USER CODE END TIM4_Init 1 */
|
||||
htim4.Instance = TIM4;
|
||||
htim4.Init.Prescaler = 125-1;
|
||||
htim4.Init.Prescaler = 20-1;
|
||||
htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim4.Init.Period = 100-1;
|
||||
htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
@ -1089,7 +1088,20 @@ void Motor_Set_Func(uint8_t dir, uint16_t speed_val){
|
||||
static uint8_t increase = 0;
|
||||
static uint16_t pwm_persent = 0;
|
||||
increase++;
|
||||
if (increase >= 5){
|
||||
uint8_t motor_run_period = motor_mode[disp_buf.pattern].node[node_num].timeline;
|
||||
uint8_t pwm_update_interval = 0;
|
||||
switch(motor_run_period){
|
||||
case 1:
|
||||
pwm_update_interval = 8;
|
||||
break;
|
||||
case 3:
|
||||
pwm_update_interval = 15;
|
||||
break;
|
||||
case 10:
|
||||
pwm_update_interval = 30;
|
||||
break;
|
||||
}
|
||||
if (increase >= pwm_update_interval){
|
||||
increase = 0;
|
||||
if ((dir == CLOCKWISE) || (dir == COUNTERCLOCKWISE)){
|
||||
//if (SleepTickCnt != 0){
|
||||
|
@ -202,8 +202,8 @@ void ILI9341_Init(void) //Changed
|
||||
LCD_WR_REG(0x29); // Display turn on
|
||||
|
||||
LCD_WR_REG(0x36);
|
||||
LCD_WR_DATA(0x28);
|
||||
LCD_WR_REG(0x20);
|
||||
LCD_WR_DATA(0xE0);
|
||||
LCD_WR_REG(0x21);
|
||||
//-------------------------------
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user