|
|
@ -68,7 +68,7 @@ void SpindleLaser::init() { |
|
|
|
SET_PWM(SPINDLE_LASER_PWM_PIN); |
|
|
|
set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // Set to lowest speed
|
|
|
|
#endif |
|
|
|
#if ENABLED(HAL_CAN_SET_PWM_FREQ) && defined(SPINDLE_LASER_FREQUENCY) |
|
|
|
#if ENABLED(HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY |
|
|
|
set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_FREQUENCY); |
|
|
|
TERN_(MARLIN_DEV_MODE, frequency = SPINDLE_LASER_FREQUENCY); |
|
|
|
#endif |
|
|
@ -78,9 +78,7 @@ void SpindleLaser::init() { |
|
|
|
#if ENABLED(AIR_ASSIST) |
|
|
|
OUT_WRITE(AIR_ASSIST_PIN, !AIR_ASSIST_ACTIVE); // Init Air Assist OFF
|
|
|
|
#endif |
|
|
|
#if ENABLED(I2C_AMMETER) |
|
|
|
ammeter.init(); // Init I2C Ammeter
|
|
|
|
#endif |
|
|
|
TERN_(I2C_AMMETER, ammeter.init()); // Init I2C Ammeter
|
|
|
|
} |
|
|
|
|
|
|
|
#if ENABLED(SPINDLE_LASER_USE_PWM) |
|
|
@ -90,7 +88,7 @@ void SpindleLaser::init() { |
|
|
|
* @param ocr Power value |
|
|
|
*/ |
|
|
|
void SpindleLaser::_set_ocr(const uint8_t ocr) { |
|
|
|
#if NEEDS_HARDWARE_PWM && SPINDLE_LASER_FREQUENCY |
|
|
|
#if ENABLED(HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY |
|
|
|
set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), TERN(MARLIN_DEV_MODE, frequency, SPINDLE_LASER_FREQUENCY)); |
|
|
|
#endif |
|
|
|
set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF); |
|
|
|