From 02a500dc937da09595d10612e77b05d87a4a099f Mon Sep 17 00:00:00 2001 From: ellensp Date: Mon, 3 Aug 2020 13:16:12 +1200 Subject: [PATCH] Fix Spindle/Laser PWM DC (#18871) --- Marlin/src/feature/spindle_laser.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Marlin/src/feature/spindle_laser.cpp b/Marlin/src/feature/spindle_laser.cpp index 3dcf6e928..68261f2fc 100644 --- a/Marlin/src/feature/spindle_laser.cpp +++ b/Marlin/src/feature/spindle_laser.cpp @@ -66,6 +66,9 @@ void SpindleLaser::init() { void SpindleLaser::set_ocr(const uint8_t ocr) { WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ACTIVE_HIGH); // turn spindle on analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF); + #if NEEDS_HARDWARE_PWM && SPINDLE_LASER_FREQUENCY + set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF); + #endif } void SpindleLaser::ocr_off() { WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_HIGH); // Turn spindle off