variable bed pwm frequency fix (input value is 7bit, not 8bit)

This commit is contained in:
Robert Pelnar 2019-05-07 15:35:34 +02:00
parent 58683da2fb
commit 85806a0f38
2 changed files with 2 additions and 2 deletions

View File

@ -481,7 +481,7 @@ your extruder heater takes 2 minutes to hit the target on heating.
#define FAN_SOFT_PWM_BITS 4 //PWM bit resolution = 4bits, freq = 62.5Hz
// Bed soft pwm
#define HEATER_BED_SOFT_PWM_BITS 5 //PWM bit resolution = 5bits, freq = 32Hz
#define HEATER_BED_SOFT_PWM_BITS 5 //PWM bit resolution = 5bits, freq = 31.25Hz
// Incrementing this by 1 will double the software PWM frequency,
// affecting heaters, and the fan if FAN_SOFT_PWM is enabled.

View File

@ -1697,7 +1697,7 @@ ISR(TIMER0_COMPB_vect)
#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
if ((pwm_count & ((1 << HEATER_BED_SOFT_PWM_BITS) - 1)) == 0)
{
soft_pwm_b = soft_pwm_bed / (1 << (8 - HEATER_BED_SOFT_PWM_BITS));
soft_pwm_b = soft_pwm_bed >> (7 - HEATER_BED_SOFT_PWM_BITS);
#ifndef SYSTEM_TIMER_2
if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1); else WRITE(HEATER_BED_PIN,0);
#endif //SYSTEM_TIMER_2