Przeglądaj źródła

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

Robert Pelnar 5 lat temu
rodzic
commit
85806a0f38
2 zmienionych plików z 2 dodań i 2 usunięć
  1. 1 1
      Firmware/Configuration.h
  2. 1 1
      Firmware/temperature.cpp

+ 1 - 1
Firmware/Configuration.h

@@ -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.

+ 1 - 1
Firmware/temperature.cpp

@@ -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