|
32 | 32 | * Laser:
|
33 | 33 | * M3 - Laser ON/Power (Ramped power)
|
34 | 34 | * M4 - Laser ON/Power (Ramped power)
|
35 |
| - * M5 - Set power output to 0 (leaving inline mode unchanged). |
36 | 35 | *
|
37 | 36 | * M3I - Enable continuous inline power to be processed by the planner, with power
|
38 | 37 | * calculated and set in the planner blocks, processed inline during stepping.
|
39 |
| - * Within inline mode M3 S-Values will set the power for the next moves e.g. G1 X10 Y10 powers on with the last S-Value. |
| 38 | + * In inline mode M3 S-Values will set the power for the next moves. |
| 39 | + * (e.g., G1 X10 Y10 powers on with the last S-Value.) |
40 | 40 | * M3I must be set before using planner-synced M3 inline S-Values (LASER_POWER_SYNC).
|
41 | 41 | *
|
42 | 42 | * M4I - Set dynamic mode which calculates laser power OCR based on the current feedrate.
|
43 | 43 | *
|
44 |
| - * M5I - Clear inline mode and set power to 0. |
45 |
| - * |
46 | 44 | * Spindle:
|
47 | 45 | * M3 - Spindle ON (Clockwise)
|
48 | 46 | * M4 - Spindle ON (Counter-clockwise)
|
49 |
| - * M5 - Spindle OFF |
50 | 47 | *
|
51 | 48 | * Parameters:
|
52 | 49 | * S<power> - Set power. S0 will turn the spindle/laser off.
|
@@ -92,19 +89,15 @@ void GcodeSuite::M3_M4(const bool is_M4) {
|
92 | 89 | #endif
|
93 | 90 |
|
94 | 91 | auto get_s_power = [] {
|
95 |
| - float u; |
96 | 92 | if (parser.seenval('S')) {
|
97 | 93 | const float v = parser.value_float();
|
98 |
| - u = TERN(LASER_POWER_TRAP, v, cutter.power_to_range(v)); |
| 94 | + cutter.menuPower = cutter.unitPower = TERN(LASER_POWER_TRAP, v, cutter.power_to_range(v)); |
99 | 95 | }
|
100 | 96 | else if (cutter.cutter_mode == CUTTER_MODE_STANDARD)
|
101 |
| - u = cutter.cpwr_to_upwr(SPEED_POWER_STARTUP); |
102 |
| - |
103 |
| - cutter.menuPower = cutter.unitPower = u; |
| 97 | + cutter.menuPower = cutter.unitPower = cutter.cpwr_to_upwr(SPEED_POWER_STARTUP); |
104 | 98 |
|
105 | 99 | // PWM not implied, power converted to OCR from unit definition and on/off if not PWM.
|
106 |
| - cutter.power = TERN(SPINDLE_LASER_USE_PWM, cutter.upower_to_ocr(u), u > 0 ? 255 : 0); |
107 |
| - return u; |
| 100 | + cutter.power = TERN(SPINDLE_LASER_USE_PWM, cutter.upower_to_ocr(cutter.unitPower), cutter.unitPower > 0 ? 255 : 0); |
108 | 101 | };
|
109 | 102 |
|
110 | 103 | if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS || cutter.cutter_mode == CUTTER_MODE_DYNAMIC) { // Laser power in inline mode
|
@@ -138,6 +131,13 @@ void GcodeSuite::M3_M4(const bool is_M4) {
|
138 | 131 |
|
139 | 132 | /**
|
140 | 133 | * M5 - Cutter OFF (when moves are complete)
|
| 134 | + * |
| 135 | + * Laser: |
| 136 | + * M5 - Set power output to 0 (leaving inline mode unchanged). |
| 137 | + * M5I - Clear inline mode and set power to 0. |
| 138 | + * |
| 139 | + * Spindle: |
| 140 | + * M5 - Spindle OFF |
141 | 141 | */
|
142 | 142 | void GcodeSuite::M5() {
|
143 | 143 | planner.synchronize();
|
|
0 commit comments