|
|
@ -123,7 +123,7 @@ public: |
|
|
|
FORCE_INLINE static void refresh() { apply_power(power); } |
|
|
|
FORCE_INLINE static void set_power(const uint8_t upwr) { power = upwr; refresh(); } |
|
|
|
|
|
|
|
#if ENABLED(SPINDLE_LASER_PWM) |
|
|
|
#if ENABLED(SPINDLE_LASER_USE_PWM) |
|
|
|
|
|
|
|
private: |
|
|
|
|
|
|
@ -186,7 +186,7 @@ public: |
|
|
|
} |
|
|
|
return upwr; |
|
|
|
} |
|
|
|
#endif // SPINDLE_LASER_PWM
|
|
|
|
#endif // SPINDLE_LASER_USE_PWM
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enable/Disable spindle/laser |
|
|
@ -195,7 +195,7 @@ public: |
|
|
|
static inline void set_enabled(const bool enable) { |
|
|
|
uint8_t value = 0; |
|
|
|
if (enable) { |
|
|
|
#if ENABLED(SPINDLE_LASER_PWM) |
|
|
|
#if ENABLED(SPINDLE_LASER_USE_PWM) |
|
|
|
if (power) |
|
|
|
value = power; |
|
|
|
else if (unitPower) |
|
|
@ -249,7 +249,7 @@ public: |
|
|
|
#if HAS_LCD_MENU |
|
|
|
static inline void enable_with_dir(const bool reverse) { |
|
|
|
isReady = true; |
|
|
|
const uint8_t ocr = TERN(SPINDLE_LASER_PWM, upower_to_ocr(menuPower), 255); |
|
|
|
const uint8_t ocr = TERN(SPINDLE_LASER_USE_PWM, upower_to_ocr(menuPower), 255); |
|
|
|
if (menuPower) |
|
|
|
power = ocr; |
|
|
|
else |
|
|
@ -262,7 +262,7 @@ public: |
|
|
|
FORCE_INLINE static void enable_reverse() { enable_with_dir(true); } |
|
|
|
FORCE_INLINE static void enable_same_dir() { enable_with_dir(is_reverse()); } |
|
|
|
|
|
|
|
#if ENABLED(SPINDLE_LASER_PWM) |
|
|
|
#if ENABLED(SPINDLE_LASER_USE_PWM) |
|
|
|
static inline void update_from_mpower() { |
|
|
|
if (isReady) power = upower_to_ocr(menuPower); |
|
|
|
unitPower = menuPower; |
|
|
@ -308,14 +308,14 @@ public: |
|
|
|
isReady = false; |
|
|
|
unitPower = menuPower = 0; |
|
|
|
planner.laser_inline.status.isPlanned = false; |
|
|
|
TERN(SPINDLE_LASER_PWM, inline_ocr_power, inline_power)(0); |
|
|
|
TERN(SPINDLE_LASER_USE_PWM, inline_ocr_power, inline_power)(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Set the power for subsequent movement blocks
|
|
|
|
static void inline_power(const cutter_power_t upwr) { |
|
|
|
unitPower = menuPower = upwr; |
|
|
|
#if ENABLED(SPINDLE_LASER_PWM) |
|
|
|
#if ENABLED(SPINDLE_LASER_USE_PWM) |
|
|
|
#if ENABLED(SPEED_POWER_RELATIVE) && !CUTTER_UNIT_IS(RPM) // relative mode does not turn laser off at 0, except for RPM
|
|
|
|
planner.laser_inline.status.isEnabled = true; |
|
|
|
planner.laser_inline.power = upower_to_ocr(upwr); |
|
|
@ -332,7 +332,7 @@ public: |
|
|
|
|
|
|
|
static inline void inline_direction(const bool) { /* never */ } |
|
|
|
|
|
|
|
#if ENABLED(SPINDLE_LASER_PWM) |
|
|
|
#if ENABLED(SPINDLE_LASER_USE_PWM) |
|
|
|
static inline void inline_ocr_power(const uint8_t ocrpwr) { |
|
|
|
isReady = ocrpwr > 0; |
|
|
|
planner.laser_inline.status.isEnabled = ocrpwr > 0; |
|
|
|