Browse Source

Fix Spindle/Laser PWM DC (#18871)

ellensp 4 years ago
parent
commit
5701387ab9
No account linked to committer's email address
1 changed files with 3 additions and 0 deletions
  1. 3
    0
      Marlin/src/feature/spindle_laser.cpp

+ 3
- 0
Marlin/src/feature/spindle_laser.cpp View File

@@ -66,6 +66,9 @@ void SpindleLaser::init() {
66 66
   void SpindleLaser::set_ocr(const uint8_t ocr) {
67 67
     WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ACTIVE_HIGH);        // turn spindle on
68 68
     analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF);
69
+    #if NEEDS_HARDWARE_PWM && SPINDLE_LASER_FREQUENCY
70
+      set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF);
71
+    #endif 
69 72
   }
70 73
   void SpindleLaser::ocr_off() {
71 74
     WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_HIGH);       // Turn spindle off

Loading…
Cancel
Save