Parcourir la source

🔧 SPINDLE_LASER_PWM => SPINDLE_LASER_USE_PWM

Scott Lahteine il y a 3 ans
Parent
révision
798a8a7a08

+ 18
- 12
Marlin/Configuration_adv.h Voir le fichier

@@ -3323,11 +3323,13 @@
3323 3323
 //#define SPINDLE_FEATURE
3324 3324
 //#define LASER_FEATURE
3325 3325
 #if EITHER(SPINDLE_FEATURE, LASER_FEATURE)
3326
-  #define SPINDLE_LASER_ACTIVE_STATE    LOW    // Set to "HIGH" if the on/off function is active HIGH
3327
-  #define SPINDLE_LASER_PWM             true   // Set to "true" if your controller supports setting the speed/power
3328
-  #define SPINDLE_LASER_PWM_INVERT      false  // Set to "true" if the speed/power goes up when you want it to go slower
3326
+  #define SPINDLE_LASER_ACTIVE_STATE    LOW    // Set to "HIGH" if SPINDLE_LASER_ENA_PIN is active HIGH
3329 3327
 
3330
-  #define SPINDLE_LASER_FREQUENCY       2500   // (Hz) Spindle/laser frequency (only on supported HALs: AVR and LPC)
3328
+  #define SPINDLE_LASER_USE_PWM                // Enable if your controller supports setting the speed/power
3329
+  #if ENABLED(SPINDLE_LASER_USE_PWM)
3330
+    #define SPINDLE_LASER_PWM_INVERT    false  // Set to "true" if the speed/power goes up when you want it to go slower
3331
+    #define SPINDLE_LASER_FREQUENCY     2500   // (Hz) Spindle/laser frequency (only on supported HALs: AVR and LPC)
3332
+  #endif
3331 3333
 
3332 3334
   //#define AIR_EVACUATION                     // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11
3333 3335
   #if ENABLED(AIR_EVACUATION)
@@ -3383,17 +3385,21 @@
3383 3385
      * Speed/Power = (PWMDC / 255 * 100 - SPEED_POWER_INTERCEPT) / SPEED_POWER_SLOPE
3384 3386
      * PWMDC = (spdpwr - SPEED_POWER_MIN) / (SPEED_POWER_MAX - SPEED_POWER_MIN) / SPEED_POWER_SLOPE
3385 3387
      */
3386
-    #define SPEED_POWER_INTERCEPT         0    // (%) 0-100 i.e., Minimum power percentage
3387
-    #define SPEED_POWER_MIN            5000    // (RPM)
3388
-    #define SPEED_POWER_MAX           30000    // (RPM) SuperPID router controller 0 - 30,000 RPM
3389
-    #define SPEED_POWER_STARTUP       25000    // (RPM) M3/M4 speed/power default (with no arguments)
3388
+    #if ENABLED(SPINDLE_LASER_USE_PWM)
3389
+      #define SPEED_POWER_INTERCEPT       0    // (%) 0-100 i.e., Minimum power percentage
3390
+      #define SPEED_POWER_MIN          5000    // (RPM)
3391
+      #define SPEED_POWER_MAX         30000    // (RPM) SuperPID router controller 0 - 30,000 RPM
3392
+      #define SPEED_POWER_STARTUP     25000    // (RPM) M3/M4 speed/power default (with no arguments)
3393
+    #endif
3390 3394
 
3391 3395
   #else
3392 3396
 
3393
-    #define SPEED_POWER_INTERCEPT         0    // (%) 0-100 i.e., Minimum power percentage
3394
-    #define SPEED_POWER_MIN               0    // (%) 0-100
3395
-    #define SPEED_POWER_MAX             100    // (%) 0-100
3396
-    #define SPEED_POWER_STARTUP          80    // (%) M3/M4 speed/power default (with no arguments)
3397
+    #if ENABLED(SPINDLE_LASER_USE_PWM)
3398
+      #define SPEED_POWER_INTERCEPT       0    // (%) 0-100 i.e., Minimum power percentage
3399
+      #define SPEED_POWER_MIN             0    // (%) 0-100
3400
+      #define SPEED_POWER_MAX           100    // (%) 0-100
3401
+      #define SPEED_POWER_STARTUP        80    // (%) M3/M4 speed/power default (with no arguments)
3402
+    #endif
3397 3403
 
3398 3404
     // Define the minimum and maximum test pulse time values for a laser test fire function
3399 3405
     #define LASER_TEST_PULSE_MIN           1   // Used with Laser Control Menu

+ 2
- 2
Marlin/src/HAL/AVR/inc/SanityCheck.h Voir le fichier

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

+ 1
- 1
Marlin/src/HAL/LINUX/inc/SanityCheck.h Voir le fichier

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

+ 1
- 1
Marlin/src/HAL/LPC1768/inc/SanityCheck.h Voir le fichier

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

+ 1
- 1
Marlin/src/HAL/NATIVE_SIM/inc/SanityCheck.h Voir le fichier

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

+ 1
- 1
Marlin/src/HAL/STM32/inc/SanityCheck.h Voir le fichier

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

+ 4
- 4
Marlin/src/feature/spindle_laser.cpp Voir le fichier

@@ -64,7 +64,7 @@ void SpindleLaser::init() {
64 64
   #if ENABLED(SPINDLE_CHANGE_DIR)
65 65
     OUT_WRITE(SPINDLE_DIR_PIN, SPINDLE_INVERT_DIR ? 255 : 0);         // Init rotation to clockwise (M3)
66 66
   #endif
67
-  #if ENABLED(SPINDLE_LASER_PWM)
67
+  #if ENABLED(SPINDLE_LASER_USE_PWM)
68 68
     SET_PWM(SPINDLE_LASER_PWM_PIN);
69 69
     analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // Set to lowest speed
70 70
   #endif
@@ -83,7 +83,7 @@ void SpindleLaser::init() {
83 83
   #endif
84 84
 }
85 85
 
86
-#if ENABLED(SPINDLE_LASER_PWM)
86
+#if ENABLED(SPINDLE_LASER_USE_PWM)
87 87
   /**
88 88
    * Set the cutter PWM directly to the given ocr value
89 89
    *
@@ -107,7 +107,7 @@ void SpindleLaser::init() {
107 107
     WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Cutter OFF
108 108
     _set_ocr(0);
109 109
   }
110
-#endif // SPINDLE_LASER_PWM
110
+#endif // SPINDLE_LASER_USE_PWM
111 111
 
112 112
 /**
113 113
  * Apply power for laser/spindle
@@ -121,7 +121,7 @@ void SpindleLaser::apply_power(const uint8_t opwr) {
121 121
   if (opwr == last_power_applied) return;
122 122
   last_power_applied = opwr;
123 123
   power = opwr;
124
-  #if ENABLED(SPINDLE_LASER_PWM)
124
+  #if ENABLED(SPINDLE_LASER_USE_PWM)
125 125
     if (cutter.unitPower == 0 && CUTTER_UNIT_IS(RPM)) {
126 126
       ocr_off();
127 127
       isReady = false;

+ 8
- 8
Marlin/src/feature/spindle_laser.h Voir le fichier

@@ -123,7 +123,7 @@ public:
123 123
   FORCE_INLINE static void refresh() { apply_power(power); }
124 124
   FORCE_INLINE static void set_power(const uint8_t upwr) { power = upwr; refresh(); }
125 125
 
126
-  #if ENABLED(SPINDLE_LASER_PWM)
126
+  #if ENABLED(SPINDLE_LASER_USE_PWM)
127 127
 
128 128
     private:
129 129
 
@@ -186,7 +186,7 @@ public:
186 186
       }
187 187
       return upwr;
188 188
     }
189
-  #endif // SPINDLE_LASER_PWM
189
+  #endif // SPINDLE_LASER_USE_PWM
190 190
 
191 191
   /**
192 192
    * Enable/Disable spindle/laser
@@ -195,7 +195,7 @@ public:
195 195
   static inline void set_enabled(const bool enable) {
196 196
     uint8_t value = 0;
197 197
     if (enable) {
198
-      #if ENABLED(SPINDLE_LASER_PWM)
198
+      #if ENABLED(SPINDLE_LASER_USE_PWM)
199 199
         if (power)
200 200
           value = power;
201 201
         else if (unitPower)
@@ -249,7 +249,7 @@ public:
249 249
   #if HAS_LCD_MENU
250 250
     static inline void enable_with_dir(const bool reverse) {
251 251
       isReady = true;
252
-      const uint8_t ocr = TERN(SPINDLE_LASER_PWM, upower_to_ocr(menuPower), 255);
252
+      const uint8_t ocr = TERN(SPINDLE_LASER_USE_PWM, upower_to_ocr(menuPower), 255);
253 253
       if (menuPower)
254 254
         power = ocr;
255 255
       else
@@ -262,7 +262,7 @@ public:
262 262
     FORCE_INLINE static void enable_reverse() { enable_with_dir(true); }
263 263
     FORCE_INLINE static void enable_same_dir() { enable_with_dir(is_reverse()); }
264 264
 
265
-    #if ENABLED(SPINDLE_LASER_PWM)
265
+    #if ENABLED(SPINDLE_LASER_USE_PWM)
266 266
       static inline void update_from_mpower() {
267 267
         if (isReady) power = upower_to_ocr(menuPower);
268 268
         unitPower = menuPower;
@@ -308,14 +308,14 @@ public:
308 308
         isReady = false;
309 309
         unitPower = menuPower = 0;
310 310
         planner.laser_inline.status.isPlanned = false;
311
-        TERN(SPINDLE_LASER_PWM, inline_ocr_power, inline_power)(0);
311
+        TERN(SPINDLE_LASER_USE_PWM, inline_ocr_power, inline_power)(0);
312 312
       }
313 313
     }
314 314
 
315 315
     // Set the power for subsequent movement blocks
316 316
     static void inline_power(const cutter_power_t upwr) {
317 317
       unitPower = menuPower = upwr;
318
-      #if ENABLED(SPINDLE_LASER_PWM)
318
+      #if ENABLED(SPINDLE_LASER_USE_PWM)
319 319
         #if ENABLED(SPEED_POWER_RELATIVE) && !CUTTER_UNIT_IS(RPM) // relative mode does not turn laser off at 0, except for RPM
320 320
           planner.laser_inline.status.isEnabled = true;
321 321
           planner.laser_inline.power = upower_to_ocr(upwr);
@@ -332,7 +332,7 @@ public:
332 332
 
333 333
     static inline void inline_direction(const bool) { /* never */ }
334 334
 
335
-    #if ENABLED(SPINDLE_LASER_PWM)
335
+    #if ENABLED(SPINDLE_LASER_USE_PWM)
336 336
       static inline void inline_ocr_power(const uint8_t ocrpwr) {
337 337
         isReady = ocrpwr > 0;
338 338
         planner.laser_inline.status.isEnabled = ocrpwr > 0;

+ 3
- 3
Marlin/src/gcode/control/M3-M5.cpp Voir le fichier

@@ -72,7 +72,7 @@ void GcodeSuite::M3_M4(const bool is_M4) {
72 72
       #if ENABLED(SPINDLE_SERVO)
73 73
         cutter.unitPower = spwr;
74 74
       #else
75
-        cutter.unitPower = TERN(SPINDLE_LASER_PWM,
75
+        cutter.unitPower = TERN(SPINDLE_LASER_USE_PWM,
76 76
                               cutter.power_to_range(cutter_power_t(round(spwr))),
77 77
                               spwr > 0 ? 255 : 0);
78 78
       #endif
@@ -86,7 +86,7 @@ void GcodeSuite::M3_M4(const bool is_M4) {
86 86
     if (parser.seen('I') == DISABLED(LASER_POWER_INLINE_INVERT)) {
87 87
       // Laser power in inline mode
88 88
       cutter.inline_direction(is_M4); // Should always be unused
89
-      #if ENABLED(SPINDLE_LASER_PWM)
89
+      #if ENABLED(SPINDLE_LASER_USE_PWM)
90 90
         if (parser.seen('O')) {
91 91
           cutter.unitPower = cutter.power_to_range(parser.value_byte(), 0);
92 92
           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) {
105 105
   planner.synchronize();   // Wait for previous movement commands (G0/G0/G2/G3) to complete before changing power
106 106
   cutter.set_reverse(is_M4);
107 107
 
108
-  #if ENABLED(SPINDLE_LASER_PWM)
108
+  #if ENABLED(SPINDLE_LASER_USE_PWM)
109 109
     if (parser.seenval('O')) {
110 110
       cutter.unitPower = cutter.power_to_range(parser.value_byte(), 0);
111 111
       cutter.ocr_set_power(cutter.unitPower); // The OCR is a value from 0 to 255 (uint8_t)

+ 1
- 1
Marlin/src/gcode/gcode.cpp Voir le fichier

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

+ 1
- 1
Marlin/src/inc/Conditionals_adv.h Voir le fichier

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

+ 10
- 8
Marlin/src/inc/SanityCheck.h Voir le fichier

@@ -593,6 +593,8 @@
593 593
   #error "ARC_SUPPORT no longer uses ARC_SEGMENTS_PER_R."
594 594
 #elif ENABLED(ARC_SUPPORT) && (!defined(MIN_ARC_SEGMENT_MM) || !defined(MAX_ARC_SEGMENT_MM))
595 595
   #error "ARC_SUPPORT now requires MIN_ARC_SEGMENT_MM and MAX_ARC_SEGMENT_MM."
596
+#elif defined(SPINDLE_LASER_PWM)
597
+  #error "SPINDLE_LASER_PWM (true) is now set with SPINDLE_LASER_USE_PWM (enabled)."
596 598
 #endif
597 599
 
598 600
 #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)
3558 3560
       #error "LASER_MOVE_G0_OFF requires LASER_MOVE_POWER."
3559 3561
     #endif
3560 3562
     #if ENABLED(LASER_POWER_INLINE_TRAPEZOID)
3561
-      #if DISABLED(SPINDLE_LASER_PWM)
3562
-        #error "LASER_POWER_INLINE_TRAPEZOID requires SPINDLE_LASER_PWM to function."
3563
+      #if DISABLED(SPINDLE_LASER_USE_PWM)
3564
+        #error "LASER_POWER_INLINE_TRAPEZOID requires SPINDLE_LASER_USE_PWM to function."
3563 3565
       #elif ENABLED(S_CURVE_ACCELERATION)
3564 3566
         //#ifndef LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN
3565 3567
         //  #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)
3591 3593
     #error "(SPINDLE|LASER)_FEATURE requires SPINDLE_LASER_ENA_PIN or SPINDLE_SERVO to control the power."
3592 3594
   #elif ENABLED(SPINDLE_CHANGE_DIR) && !PIN_EXISTS(SPINDLE_DIR)
3593 3595
     #error "SPINDLE_DIR_PIN is required for SPINDLE_CHANGE_DIR."
3594
-  #elif ENABLED(SPINDLE_LASER_PWM)
3596
+  #elif ENABLED(SPINDLE_LASER_USE_PWM)
3595 3597
     #if !defined(SPINDLE_LASER_PWM_PIN) || SPINDLE_LASER_PWM_PIN < 0
3596
-      #error "SPINDLE_LASER_PWM_PIN is required for SPINDLE_LASER_PWM."
3598
+      #error "SPINDLE_LASER_PWM_PIN is required for SPINDLE_LASER_USE_PWM."
3597 3599
     #elif !_TEST_PWM(SPINDLE_LASER_PWM_PIN)
3598 3600
       #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin."
3599 3601
     #elif !defined(SPINDLE_LASER_PWM_INVERT)
3600 3602
       #error "SPINDLE_LASER_PWM_INVERT is required for (SPINDLE|LASER)_FEATURE."
3601 3603
     #elif !(defined(SPEED_POWER_INTERCEPT) && defined(SPEED_POWER_MIN) && defined(SPEED_POWER_MAX) && defined(SPEED_POWER_STARTUP))
3602
-      #error "SPINDLE_LASER_PWM equation constant(s) missing."
3604
+      #error "SPINDLE_LASER_USE_PWM equation constant(s) missing."
3603 3605
     #elif _PIN_CONFLICT(X_MIN)
3604
-      #error "SPINDLE_LASER_PWM pin conflicts with X_MIN_PIN."
3606
+      #error "SPINDLE_LASER_USE_PWM pin conflicts with X_MIN_PIN."
3605 3607
     #elif _PIN_CONFLICT(X_MAX)
3606
-      #error "SPINDLE_LASER_PWM pin conflicts with X_MAX_PIN."
3608
+      #error "SPINDLE_LASER_USE_PWM pin conflicts with X_MAX_PIN."
3607 3609
     #elif _PIN_CONFLICT(Z_STEP)
3608
-      #error "SPINDLE_LASER_PWM pin conflicts with Z_STEP_PIN."
3610
+      #error "SPINDLE_LASER_USE_PWM pin conflicts with Z_STEP_PIN."
3609 3611
     #elif _PIN_CONFLICT(CASE_LIGHT)
3610 3612
       #error "SPINDLE_LASER_PWM_PIN conflicts with CASE_LIGHT_PIN."
3611 3613
     #elif _PIN_CONFLICT(E0_AUTO_FAN)

+ 1
- 1
Marlin/src/lcd/menu/menu_spindle_laser.cpp Voir le fichier

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

+ 2
- 2
Marlin/src/module/stepper.cpp Voir le fichier

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

+ 3
- 3
Marlin/src/module/stepper.h Voir le fichier

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

Chargement…
Annuler
Enregistrer