V1.2
This commit is contained in:
@ -41,14 +41,16 @@ void PWM_control_init(TIM_HandleTypeDef* pg, TIM_HandleTypeDef* bat_cool, TIM_Ha
|
||||
DUTYCYCLE = 40000 * X/100
|
||||
*/
|
||||
void PWM_powerground_control(uint8_t percent){
|
||||
if (percent > 100) //something went wrong
|
||||
if (percent > 100){ //something went wrong
|
||||
__HAL_TIM_SET_COMPARE(powerground, TIM_CHANNEL_3, 0);
|
||||
__HAL_TIM_SET_COMPARE(powerground, TIM_CHANNEL_4, 0);
|
||||
return;
|
||||
}
|
||||
powerground_status = percent;
|
||||
|
||||
int ccr = 2000 + ((2000) * (percent/100.0));
|
||||
int ccr = 2000 + (20 * percent);
|
||||
__HAL_TIM_SET_COMPARE(powerground, TIM_CHANNEL_3, ccr);
|
||||
__HAL_TIM_SET_COMPARE(powerground, TIM_CHANNEL_4, ccr);
|
||||
//TIM15->CCR1 = (TIM15->ARR*POWERGROUND_MAX_DUTY_CYCLE-TIM15->ARR*POWERGROUND_MIN_DUTY_CYCLE) * (percent/100.0) + TIM15->ARR*POWERGROUND_MIN_DUTY_CYCLE;
|
||||
}
|
||||
|
||||
void PWM_set_throttle(){
|
||||
|
||||
Reference in New Issue
Block a user