Browse Source

🔧 SPINDLE_LASER_PWM => SPINDLE_LASER_USE_PWM

Scott Lahteine 3 years ago
parent
commit
798a8a7a08

+ 18
- 12
Marlin/Configuration_adv.h View File

3323
 //#define SPINDLE_FEATURE
3323
 //#define SPINDLE_FEATURE
3324
 //#define LASER_FEATURE
3324
 //#define LASER_FEATURE
3325
 #if EITHER(SPINDLE_FEATURE, LASER_FEATURE)
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
   //#define AIR_EVACUATION                     // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11
3334
   //#define AIR_EVACUATION                     // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11
3333
   #if ENABLED(AIR_EVACUATION)
3335
   #if ENABLED(AIR_EVACUATION)
3383
      * Speed/Power = (PWMDC / 255 * 100 - SPEED_POWER_INTERCEPT) / SPEED_POWER_SLOPE
3385
      * Speed/Power = (PWMDC / 255 * 100 - SPEED_POWER_INTERCEPT) / SPEED_POWER_SLOPE
3384
      * PWMDC = (spdpwr - SPEED_POWER_MIN) / (SPEED_POWER_MAX - SPEED_POWER_MIN) / SPEED_POWER_SLOPE
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
   #else
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
     // Define the minimum and maximum test pulse time values for a laser test fire function
3404
     // Define the minimum and maximum test pulse time values for a laser test fire function
3399
     #define LASER_TEST_PULSE_MIN           1   // Used with Laser Control Menu
3405
     #define LASER_TEST_PULSE_MIN           1   // Used with Laser Control Menu

+ 2
- 2
Marlin/src/HAL/AVR/inc/SanityCheck.h View File

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

+ 1
- 1
Marlin/src/HAL/LINUX/inc/SanityCheck.h View File

26
  */
26
  */
27
 
27
 
28
 // Emulating RAMPS
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
   #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
30
   #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
31
 #endif
31
 #endif
32
 
32
 

+ 1
- 1
Marlin/src/HAL/LPC1768/inc/SanityCheck.h View File

67
  * Test LPC176x-specific configuration values for errors at compile-time.
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
 //  #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
71
 //  #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
72
 //#endif
72
 //#endif
73
 
73
 

+ 1
- 1
Marlin/src/HAL/NATIVE_SIM/inc/SanityCheck.h View File

26
  */
26
  */
27
 
27
 
28
 // Emulating RAMPS
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
   #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
30
   #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
31
 #endif
31
 #endif
32
 
32
 

+ 1
- 1
Marlin/src/HAL/STM32/inc/SanityCheck.h View File

24
 /**
24
 /**
25
  * Test STM32-specific configuration values for errors at compile-time.
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
 //  #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
28
 //  #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
29
 //#endif
29
 //#endif
30
 
30
 

+ 4
- 4
Marlin/src/feature/spindle_laser.cpp View File

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

+ 8
- 8
Marlin/src/feature/spindle_laser.h View File

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

+ 3
- 3
Marlin/src/gcode/control/M3-M5.cpp View File

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

215
     // Set the laser power in the planner to configure this move
215
     // Set the laser power in the planner to configure this move
216
     if (parser.seen('S')) {
216
     if (parser.seen('S')) {
217
       const float spwr = parser.value_float();
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
     else if (ENABLED(LASER_MOVE_G0_OFF) && parser.codenum == 0) // G0
220
     else if (ENABLED(LASER_MOVE_G0_OFF) && parser.codenum == 0) // G0
221
       cutter.set_inline_enabled(false);
221
       cutter.set_inline_enabled(false);

+ 1
- 1
Marlin/src/inc/Conditionals_adv.h View File

658
 #endif
658
 #endif
659
 
659
 
660
 // Add features that need hardware PWM here
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
   #define NEEDS_HARDWARE_PWM 1
662
   #define NEEDS_HARDWARE_PWM 1
663
 #endif
663
 #endif
664
 
664
 

+ 10
- 8
Marlin/src/inc/SanityCheck.h View File

593
   #error "ARC_SUPPORT no longer uses ARC_SEGMENTS_PER_R."
593
   #error "ARC_SUPPORT no longer uses ARC_SEGMENTS_PER_R."
594
 #elif ENABLED(ARC_SUPPORT) && (!defined(MIN_ARC_SEGMENT_MM) || !defined(MAX_ARC_SEGMENT_MM))
594
 #elif ENABLED(ARC_SUPPORT) && (!defined(MIN_ARC_SEGMENT_MM) || !defined(MAX_ARC_SEGMENT_MM))
595
   #error "ARC_SUPPORT now requires MIN_ARC_SEGMENT_MM and MAX_ARC_SEGMENT_MM."
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
 #endif
598
 #endif
597
 
599
 
598
 #if MOTHERBOARD == BOARD_DUE3DOM_MINI && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
600
 #if MOTHERBOARD == BOARD_DUE3DOM_MINI && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
3558
       #error "LASER_MOVE_G0_OFF requires LASER_MOVE_POWER."
3560
       #error "LASER_MOVE_G0_OFF requires LASER_MOVE_POWER."
3559
     #endif
3561
     #endif
3560
     #if ENABLED(LASER_POWER_INLINE_TRAPEZOID)
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
       #elif ENABLED(S_CURVE_ACCELERATION)
3565
       #elif ENABLED(S_CURVE_ACCELERATION)
3564
         //#ifndef LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN
3566
         //#ifndef LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN
3565
         //  #define LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN
3567
         //  #define LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN
3591
     #error "(SPINDLE|LASER)_FEATURE requires SPINDLE_LASER_ENA_PIN or SPINDLE_SERVO to control the power."
3593
     #error "(SPINDLE|LASER)_FEATURE requires SPINDLE_LASER_ENA_PIN or SPINDLE_SERVO to control the power."
3592
   #elif ENABLED(SPINDLE_CHANGE_DIR) && !PIN_EXISTS(SPINDLE_DIR)
3594
   #elif ENABLED(SPINDLE_CHANGE_DIR) && !PIN_EXISTS(SPINDLE_DIR)
3593
     #error "SPINDLE_DIR_PIN is required for SPINDLE_CHANGE_DIR."
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
     #if !defined(SPINDLE_LASER_PWM_PIN) || SPINDLE_LASER_PWM_PIN < 0
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
     #elif !_TEST_PWM(SPINDLE_LASER_PWM_PIN)
3599
     #elif !_TEST_PWM(SPINDLE_LASER_PWM_PIN)
3598
       #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin."
3600
       #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin."
3599
     #elif !defined(SPINDLE_LASER_PWM_INVERT)
3601
     #elif !defined(SPINDLE_LASER_PWM_INVERT)
3600
       #error "SPINDLE_LASER_PWM_INVERT is required for (SPINDLE|LASER)_FEATURE."
3602
       #error "SPINDLE_LASER_PWM_INVERT is required for (SPINDLE|LASER)_FEATURE."
3601
     #elif !(defined(SPEED_POWER_INTERCEPT) && defined(SPEED_POWER_MIN) && defined(SPEED_POWER_MAX) && defined(SPEED_POWER_STARTUP))
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
     #elif _PIN_CONFLICT(X_MIN)
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
     #elif _PIN_CONFLICT(X_MAX)
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
     #elif _PIN_CONFLICT(Z_STEP)
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
     #elif _PIN_CONFLICT(CASE_LIGHT)
3611
     #elif _PIN_CONFLICT(CASE_LIGHT)
3610
       #error "SPINDLE_LASER_PWM_PIN conflicts with CASE_LIGHT_PIN."
3612
       #error "SPINDLE_LASER_PWM_PIN conflicts with CASE_LIGHT_PIN."
3611
     #elif _PIN_CONFLICT(E0_AUTO_FAN)
3613
     #elif _PIN_CONFLICT(E0_AUTO_FAN)

+ 1
- 1
Marlin/src/lcd/menu/menu_spindle_laser.cpp View File

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

+ 2
- 2
Marlin/src/module/stepper.cpp View File

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

+ 3
- 3
Marlin/src/module/stepper.h View File

372
         uint8_t cur_power;  // Current laser power
372
         uint8_t cur_power;  // Current laser power
373
         bool cruise_set;    // Power set up for cruising?
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
           uint32_t last_step_count, // Step count from the last update
378
           uint32_t last_step_count, // Step count from the last update
377
                    acc_step_count;  // Bresenham counter for laser accel/decel
379
                    acc_step_count;  // Bresenham counter for laser accel/decel
378
-        #else
379
-          uint16_t till_update;     // Countdown to the next update
380
         #endif
380
         #endif
381
       } stepper_laser_t;
381
       } stepper_laser_t;
382
 
382
 

Loading…
Cancel
Save