🔧 SPINDLE_LASER_PWM => SPINDLE_LASER_USE_PWM

This commit is contained in:
Scott Lahteine 2021-09-13 16:28:12 -05:00
parent 59ad93560e
commit de4eed33e4
15 changed files with 57 additions and 49 deletions

View File

@ -3323,11 +3323,13 @@
//#define SPINDLE_FEATURE //#define SPINDLE_FEATURE
//#define LASER_FEATURE //#define LASER_FEATURE
#if EITHER(SPINDLE_FEATURE, LASER_FEATURE) #if EITHER(SPINDLE_FEATURE, LASER_FEATURE)
#define SPINDLE_LASER_ACTIVE_STATE LOW // Set to "HIGH" if the on/off function is active HIGH #define SPINDLE_LASER_ACTIVE_STATE LOW // Set to "HIGH" if SPINDLE_LASER_ENA_PIN is active HIGH
#define SPINDLE_LASER_PWM true // Set to "true" if your controller supports setting the speed/power
#define SPINDLE_LASER_PWM_INVERT false // Set to "true" if the speed/power goes up when you want it to go slower
#define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR and LPC) #define SPINDLE_LASER_USE_PWM // Enable if your controller supports setting the speed/power
#if ENABLED(SPINDLE_LASER_USE_PWM)
#define SPINDLE_LASER_PWM_INVERT false // Set to "true" if the speed/power goes up when you want it to go slower
#define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR and LPC)
#endif
//#define AIR_EVACUATION // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11 //#define AIR_EVACUATION // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11
#if ENABLED(AIR_EVACUATION) #if ENABLED(AIR_EVACUATION)
@ -3383,17 +3385,21 @@
* Speed/Power = (PWMDC / 255 * 100 - SPEED_POWER_INTERCEPT) / SPEED_POWER_SLOPE * Speed/Power = (PWMDC / 255 * 100 - SPEED_POWER_INTERCEPT) / SPEED_POWER_SLOPE
* PWMDC = (spdpwr - SPEED_POWER_MIN) / (SPEED_POWER_MAX - SPEED_POWER_MIN) / SPEED_POWER_SLOPE * PWMDC = (spdpwr - SPEED_POWER_MIN) / (SPEED_POWER_MAX - SPEED_POWER_MIN) / SPEED_POWER_SLOPE
*/ */
#define SPEED_POWER_INTERCEPT 0 // (%) 0-100 i.e., Minimum power percentage #if ENABLED(SPINDLE_LASER_USE_PWM)
#define SPEED_POWER_MIN 5000 // (RPM) #define SPEED_POWER_INTERCEPT 0 // (%) 0-100 i.e., Minimum power percentage
#define SPEED_POWER_MAX 30000 // (RPM) SuperPID router controller 0 - 30,000 RPM #define SPEED_POWER_MIN 5000 // (RPM)
#define SPEED_POWER_STARTUP 25000 // (RPM) M3/M4 speed/power default (with no arguments) #define SPEED_POWER_MAX 30000 // (RPM) SuperPID router controller 0 - 30,000 RPM
#define SPEED_POWER_STARTUP 25000 // (RPM) M3/M4 speed/power default (with no arguments)
#endif
#else #else
#define SPEED_POWER_INTERCEPT 0 // (%) 0-100 i.e., Minimum power percentage #if ENABLED(SPINDLE_LASER_USE_PWM)
#define SPEED_POWER_MIN 0 // (%) 0-100 #define SPEED_POWER_INTERCEPT 0 // (%) 0-100 i.e., Minimum power percentage
#define SPEED_POWER_MAX 100 // (%) 0-100 #define SPEED_POWER_MIN 0 // (%) 0-100
#define SPEED_POWER_STARTUP 80 // (%) M3/M4 speed/power default (with no arguments) #define SPEED_POWER_MAX 100 // (%) 0-100
#define SPEED_POWER_STARTUP 80 // (%) M3/M4 speed/power default (with no arguments)
#endif
// Define the minimum and maximum test pulse time values for a laser test fire function // Define the minimum and maximum test pulse time values for a laser test fire function
#define LASER_TEST_PULSE_MIN 1 // Used with Laser Control Menu #define LASER_TEST_PULSE_MIN 1 // Used with Laser Control Menu

View File

@ -35,7 +35,7 @@
/** /**
* Sanity checks for Spindle / Laser PWM * Sanity checks for Spindle / Laser PWM
*/ */
#if ENABLED(SPINDLE_LASER_PWM) #if ENABLED(SPINDLE_LASER_USE_PWM)
#include "../ServoTimers.h" // Needed to check timer availability (_useTimer3) #include "../ServoTimers.h" // Needed to check timer availability (_useTimer3)
#if SPINDLE_LASER_PWM_PIN == 4 || WITHIN(SPINDLE_LASER_PWM_PIN, 11, 13) #if SPINDLE_LASER_PWM_PIN == 4 || WITHIN(SPINDLE_LASER_PWM_PIN, 11, 13)
#error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by a system interrupt." #error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by a system interrupt."
@ -43,7 +43,7 @@
#error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by the servo system." #error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by the servo system."
#endif #endif
#elif defined(SPINDLE_LASER_FREQUENCY) #elif defined(SPINDLE_LASER_FREQUENCY)
#error "SPINDLE_LASER_FREQUENCY requires SPINDLE_LASER_PWM." #error "SPINDLE_LASER_FREQUENCY requires SPINDLE_LASER_USE_PWM."
#endif #endif
/** /**

View File

@ -26,7 +26,7 @@
*/ */
// Emulating RAMPS // Emulating RAMPS
#if ENABLED(SPINDLE_LASER_PWM) && !(SPINDLE_LASER_PWM_PIN == 4 || SPINDLE_LASER_PWM_PIN == 6 || SPINDLE_LASER_PWM_PIN == 11) #if ENABLED(SPINDLE_LASER_USE_PWM) && !(SPINDLE_LASER_PWM_PIN == 4 || SPINDLE_LASER_PWM_PIN == 6 || SPINDLE_LASER_PWM_PIN == 11)
#error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector" #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
#endif #endif

View File

@ -67,7 +67,7 @@ static_assert(!(NUM_SERVOS && ENABLED(FAST_PWM_FAN)), "BLTOUCH and Servos are in
* Test LPC176x-specific configuration values for errors at compile-time. * Test LPC176x-specific configuration values for errors at compile-time.
*/ */
//#if ENABLED(SPINDLE_LASER_PWM) && !(SPINDLE_LASER_PWM_PIN == 4 || SPINDLE_LASER_PWM_PIN == 6 || SPINDLE_LASER_PWM_PIN == 11) //#if ENABLED(SPINDLE_LASER_USE_PWM) && !(SPINDLE_LASER_PWM_PIN == 4 || SPINDLE_LASER_PWM_PIN == 6 || SPINDLE_LASER_PWM_PIN == 11)
// #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector" // #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
//#endif //#endif

View File

@ -26,7 +26,7 @@
*/ */
// Emulating RAMPS // Emulating RAMPS
#if ENABLED(SPINDLE_LASER_PWM) && !(SPINDLE_LASER_PWM_PIN == 4 || SPINDLE_LASER_PWM_PIN == 6 || SPINDLE_LASER_PWM_PIN == 11) #if ENABLED(SPINDLE_LASER_USE_PWM) && !(SPINDLE_LASER_PWM_PIN == 4 || SPINDLE_LASER_PWM_PIN == 6 || SPINDLE_LASER_PWM_PIN == 11)
#error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector" #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
#endif #endif

View File

@ -24,7 +24,7 @@
/** /**
* Test STM32-specific configuration values for errors at compile-time. * Test STM32-specific configuration values for errors at compile-time.
*/ */
//#if ENABLED(SPINDLE_LASER_PWM) && !(SPINDLE_LASER_PWM_PIN == 4 || SPINDLE_LASER_PWM_PIN == 6 || SPINDLE_LASER_PWM_PIN == 11) //#if ENABLED(SPINDLE_LASER_USE_PWM) && !(SPINDLE_LASER_PWM_PIN == 4 || SPINDLE_LASER_PWM_PIN == 6 || SPINDLE_LASER_PWM_PIN == 11)
// #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector" // #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
//#endif //#endif

View File

@ -64,7 +64,7 @@ void SpindleLaser::init() {
#if ENABLED(SPINDLE_CHANGE_DIR) #if ENABLED(SPINDLE_CHANGE_DIR)
OUT_WRITE(SPINDLE_DIR_PIN, SPINDLE_INVERT_DIR ? 255 : 0); // Init rotation to clockwise (M3) OUT_WRITE(SPINDLE_DIR_PIN, SPINDLE_INVERT_DIR ? 255 : 0); // Init rotation to clockwise (M3)
#endif #endif
#if ENABLED(SPINDLE_LASER_PWM) #if ENABLED(SPINDLE_LASER_USE_PWM)
SET_PWM(SPINDLE_LASER_PWM_PIN); SET_PWM(SPINDLE_LASER_PWM_PIN);
analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // Set to lowest speed analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // Set to lowest speed
#endif #endif
@ -83,7 +83,7 @@ void SpindleLaser::init() {
#endif #endif
} }
#if ENABLED(SPINDLE_LASER_PWM) #if ENABLED(SPINDLE_LASER_USE_PWM)
/** /**
* Set the cutter PWM directly to the given ocr value * Set the cutter PWM directly to the given ocr value
* *
@ -107,7 +107,7 @@ void SpindleLaser::init() {
WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Cutter OFF WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Cutter OFF
_set_ocr(0); _set_ocr(0);
} }
#endif // SPINDLE_LASER_PWM #endif // SPINDLE_LASER_USE_PWM
/** /**
* Apply power for laser/spindle * Apply power for laser/spindle
@ -121,7 +121,7 @@ void SpindleLaser::apply_power(const uint8_t opwr) {
if (opwr == last_power_applied) return; if (opwr == last_power_applied) return;
last_power_applied = opwr; last_power_applied = opwr;
power = opwr; power = opwr;
#if ENABLED(SPINDLE_LASER_PWM) #if ENABLED(SPINDLE_LASER_USE_PWM)
if (cutter.unitPower == 0 && CUTTER_UNIT_IS(RPM)) { if (cutter.unitPower == 0 && CUTTER_UNIT_IS(RPM)) {
ocr_off(); ocr_off();
isReady = false; isReady = false;

View File

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

View File

@ -72,7 +72,7 @@ void GcodeSuite::M3_M4(const bool is_M4) {
#if ENABLED(SPINDLE_SERVO) #if ENABLED(SPINDLE_SERVO)
cutter.unitPower = spwr; cutter.unitPower = spwr;
#else #else
cutter.unitPower = TERN(SPINDLE_LASER_PWM, cutter.unitPower = TERN(SPINDLE_LASER_USE_PWM,
cutter.power_to_range(cutter_power_t(round(spwr))), cutter.power_to_range(cutter_power_t(round(spwr))),
spwr > 0 ? 255 : 0); spwr > 0 ? 255 : 0);
#endif #endif
@ -86,7 +86,7 @@ void GcodeSuite::M3_M4(const bool is_M4) {
if (parser.seen('I') == DISABLED(LASER_POWER_INLINE_INVERT)) { if (parser.seen('I') == DISABLED(LASER_POWER_INLINE_INVERT)) {
// Laser power in inline mode // Laser power in inline mode
cutter.inline_direction(is_M4); // Should always be unused cutter.inline_direction(is_M4); // Should always be unused
#if ENABLED(SPINDLE_LASER_PWM) #if ENABLED(SPINDLE_LASER_USE_PWM)
if (parser.seen('O')) { if (parser.seen('O')) {
cutter.unitPower = cutter.power_to_range(parser.value_byte(), 0); cutter.unitPower = cutter.power_to_range(parser.value_byte(), 0);
cutter.inline_ocr_power(cutter.unitPower); // The OCR is a value from 0 to 255 (uint8_t) cutter.inline_ocr_power(cutter.unitPower); // The OCR is a value from 0 to 255 (uint8_t)
@ -105,7 +105,7 @@ void GcodeSuite::M3_M4(const bool is_M4) {
planner.synchronize(); // Wait for previous movement commands (G0/G0/G2/G3) to complete before changing power planner.synchronize(); // Wait for previous movement commands (G0/G0/G2/G3) to complete before changing power
cutter.set_reverse(is_M4); cutter.set_reverse(is_M4);
#if ENABLED(SPINDLE_LASER_PWM) #if ENABLED(SPINDLE_LASER_USE_PWM)
if (parser.seenval('O')) { if (parser.seenval('O')) {
cutter.unitPower = cutter.power_to_range(parser.value_byte(), 0); cutter.unitPower = cutter.power_to_range(parser.value_byte(), 0);
cutter.ocr_set_power(cutter.unitPower); // The OCR is a value from 0 to 255 (uint8_t) cutter.ocr_set_power(cutter.unitPower); // The OCR is a value from 0 to 255 (uint8_t)

View File

@ -215,7 +215,7 @@ void GcodeSuite::get_destination_from_command() {
// Set the laser power in the planner to configure this move // Set the laser power in the planner to configure this move
if (parser.seen('S')) { if (parser.seen('S')) {
const float spwr = parser.value_float(); const float spwr = parser.value_float();
cutter.inline_power(TERN(SPINDLE_LASER_PWM, cutter.power_to_range(cutter_power_t(round(spwr))), spwr > 0 ? 255 : 0)); cutter.inline_power(TERN(SPINDLE_LASER_USE_PWM, cutter.power_to_range(cutter_power_t(round(spwr))), spwr > 0 ? 255 : 0));
} }
else if (ENABLED(LASER_MOVE_G0_OFF) && parser.codenum == 0) // G0 else if (ENABLED(LASER_MOVE_G0_OFF) && parser.codenum == 0) // G0
cutter.set_inline_enabled(false); cutter.set_inline_enabled(false);

View File

@ -658,7 +658,7 @@
#endif #endif
// Add features that need hardware PWM here // Add features that need hardware PWM here
#if ANY(FAST_PWM_FAN, SPINDLE_LASER_PWM) #if ANY(FAST_PWM_FAN, SPINDLE_LASER_USE_PWM)
#define NEEDS_HARDWARE_PWM 1 #define NEEDS_HARDWARE_PWM 1
#endif #endif

View File

@ -593,6 +593,8 @@
#error "ARC_SUPPORT no longer uses ARC_SEGMENTS_PER_R." #error "ARC_SUPPORT no longer uses ARC_SEGMENTS_PER_R."
#elif ENABLED(ARC_SUPPORT) && (!defined(MIN_ARC_SEGMENT_MM) || !defined(MAX_ARC_SEGMENT_MM)) #elif ENABLED(ARC_SUPPORT) && (!defined(MIN_ARC_SEGMENT_MM) || !defined(MAX_ARC_SEGMENT_MM))
#error "ARC_SUPPORT now requires MIN_ARC_SEGMENT_MM and MAX_ARC_SEGMENT_MM." #error "ARC_SUPPORT now requires MIN_ARC_SEGMENT_MM and MAX_ARC_SEGMENT_MM."
#elif defined(SPINDLE_LASER_PWM)
#error "SPINDLE_LASER_PWM (true) is now set with SPINDLE_LASER_USE_PWM (enabled)."
#endif #endif
#if MOTHERBOARD == BOARD_DUE3DOM_MINI && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD) #if MOTHERBOARD == BOARD_DUE3DOM_MINI && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
@ -3558,8 +3560,8 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#error "LASER_MOVE_G0_OFF requires LASER_MOVE_POWER." #error "LASER_MOVE_G0_OFF requires LASER_MOVE_POWER."
#endif #endif
#if ENABLED(LASER_POWER_INLINE_TRAPEZOID) #if ENABLED(LASER_POWER_INLINE_TRAPEZOID)
#if DISABLED(SPINDLE_LASER_PWM) #if DISABLED(SPINDLE_LASER_USE_PWM)
#error "LASER_POWER_INLINE_TRAPEZOID requires SPINDLE_LASER_PWM to function." #error "LASER_POWER_INLINE_TRAPEZOID requires SPINDLE_LASER_USE_PWM to function."
#elif ENABLED(S_CURVE_ACCELERATION) #elif ENABLED(S_CURVE_ACCELERATION)
//#ifndef LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN //#ifndef LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN
// #define LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN // #define LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN
@ -3591,21 +3593,21 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#error "(SPINDLE|LASER)_FEATURE requires SPINDLE_LASER_ENA_PIN or SPINDLE_SERVO to control the power." #error "(SPINDLE|LASER)_FEATURE requires SPINDLE_LASER_ENA_PIN or SPINDLE_SERVO to control the power."
#elif ENABLED(SPINDLE_CHANGE_DIR) && !PIN_EXISTS(SPINDLE_DIR) #elif ENABLED(SPINDLE_CHANGE_DIR) && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN is required for SPINDLE_CHANGE_DIR." #error "SPINDLE_DIR_PIN is required for SPINDLE_CHANGE_DIR."
#elif ENABLED(SPINDLE_LASER_PWM) #elif ENABLED(SPINDLE_LASER_USE_PWM)
#if !defined(SPINDLE_LASER_PWM_PIN) || SPINDLE_LASER_PWM_PIN < 0 #if !defined(SPINDLE_LASER_PWM_PIN) || SPINDLE_LASER_PWM_PIN < 0
#error "SPINDLE_LASER_PWM_PIN is required for SPINDLE_LASER_PWM." #error "SPINDLE_LASER_PWM_PIN is required for SPINDLE_LASER_USE_PWM."
#elif !_TEST_PWM(SPINDLE_LASER_PWM_PIN) #elif !_TEST_PWM(SPINDLE_LASER_PWM_PIN)
#error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin." #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin."
#elif !defined(SPINDLE_LASER_PWM_INVERT) #elif !defined(SPINDLE_LASER_PWM_INVERT)
#error "SPINDLE_LASER_PWM_INVERT is required for (SPINDLE|LASER)_FEATURE." #error "SPINDLE_LASER_PWM_INVERT is required for (SPINDLE|LASER)_FEATURE."
#elif !(defined(SPEED_POWER_INTERCEPT) && defined(SPEED_POWER_MIN) && defined(SPEED_POWER_MAX) && defined(SPEED_POWER_STARTUP)) #elif !(defined(SPEED_POWER_INTERCEPT) && defined(SPEED_POWER_MIN) && defined(SPEED_POWER_MAX) && defined(SPEED_POWER_STARTUP))
#error "SPINDLE_LASER_PWM equation constant(s) missing." #error "SPINDLE_LASER_USE_PWM equation constant(s) missing."
#elif _PIN_CONFLICT(X_MIN) #elif _PIN_CONFLICT(X_MIN)
#error "SPINDLE_LASER_PWM pin conflicts with X_MIN_PIN." #error "SPINDLE_LASER_USE_PWM pin conflicts with X_MIN_PIN."
#elif _PIN_CONFLICT(X_MAX) #elif _PIN_CONFLICT(X_MAX)
#error "SPINDLE_LASER_PWM pin conflicts with X_MAX_PIN." #error "SPINDLE_LASER_USE_PWM pin conflicts with X_MAX_PIN."
#elif _PIN_CONFLICT(Z_STEP) #elif _PIN_CONFLICT(Z_STEP)
#error "SPINDLE_LASER_PWM pin conflicts with Z_STEP_PIN." #error "SPINDLE_LASER_USE_PWM pin conflicts with Z_STEP_PIN."
#elif _PIN_CONFLICT(CASE_LIGHT) #elif _PIN_CONFLICT(CASE_LIGHT)
#error "SPINDLE_LASER_PWM_PIN conflicts with CASE_LIGHT_PIN." #error "SPINDLE_LASER_PWM_PIN conflicts with CASE_LIGHT_PIN."
#elif _PIN_CONFLICT(E0_AUTO_FAN) #elif _PIN_CONFLICT(E0_AUTO_FAN)

View File

@ -41,7 +41,7 @@
START_MENU(); START_MENU();
BACK_ITEM(MSG_MAIN); BACK_ITEM(MSG_MAIN);
#if ENABLED(SPINDLE_LASER_PWM) #if ENABLED(SPINDLE_LASER_USE_PWM)
// Change the cutter's "current power" value without turning the cutter on or off // Change the cutter's "current power" value without turning the cutter on or off
// Power is displayed and set in units and range according to CUTTER_POWER_UNIT // Power is displayed and set in units and range according to CUTTER_POWER_UNIT
EDIT_ITEM_FAST(CUTTER_MENU_POWER_TYPE, MSG_CUTTER(POWER), &cutter.menuPower, EDIT_ITEM_FAST(CUTTER_MENU_POWER_TYPE, MSG_CUTTER(POWER), &cutter.menuPower,

View File

@ -2255,7 +2255,7 @@ uint32_t Stepper::block_phase_isr() {
} }
#else #else
if (stat.isPlanned) { // Planner controls the laser if (stat.isPlanned) { // Planner controls the laser
#if ENABLED(SPINDLE_LASER_PWM) #if ENABLED(SPINDLE_LASER_USE_PWM)
cutter.ocr_set_power( cutter.ocr_set_power(
stat.isEnabled ? current_block->laser.power : 0 // ON with power or OFF stat.isEnabled ? current_block->laser.power : 0 // ON with power or OFF
); );
@ -2303,7 +2303,7 @@ uint32_t Stepper::block_phase_isr() {
// This should mean ending file with 'M5 I' will stop the laser; thus the inline flag isn't needed // This should mean ending file with 'M5 I' will stop the laser; thus the inline flag isn't needed
const power_status_t stat = planner.laser_inline.status; const power_status_t stat = planner.laser_inline.status;
if (stat.isPlanned) { // Planner controls the laser if (stat.isPlanned) { // Planner controls the laser
#if ENABLED(SPINDLE_LASER_PWM) #if ENABLED(SPINDLE_LASER_USE_PWM)
cutter.ocr_set_power( cutter.ocr_set_power(
stat.isEnabled ? planner.laser_inline.power : 0 // ON with power or OFF stat.isEnabled ? planner.laser_inline.power : 0 // ON with power or OFF
); );

View File

@ -372,11 +372,11 @@ class Stepper {
uint8_t cur_power; // Current laser power uint8_t cur_power; // Current laser power
bool cruise_set; // Power set up for cruising? bool cruise_set; // Power set up for cruising?
#if DISABLED(LASER_POWER_INLINE_TRAPEZOID_CONT) #if ENABLED(LASER_POWER_INLINE_TRAPEZOID_CONT)
uint16_t till_update; // Countdown to the next update
#else
uint32_t last_step_count, // Step count from the last update uint32_t last_step_count, // Step count from the last update
acc_step_count; // Bresenham counter for laser accel/decel acc_step_count; // Bresenham counter for laser accel/decel
#else
uint16_t till_update; // Countdown to the next update
#endif #endif
} stepper_laser_t; } stepper_laser_t;