🩹 Fix M3 uninitialized
warning (#26091)
This commit is contained in:
parent
a5e4b4bd7d
commit
709def5e7b
|
@ -32,21 +32,18 @@
|
||||||
* Laser:
|
* Laser:
|
||||||
* M3 - Laser ON/Power (Ramped power)
|
* M3 - Laser ON/Power (Ramped power)
|
||||||
* M4 - Laser ON/Power (Ramped power)
|
* M4 - Laser ON/Power (Ramped power)
|
||||||
* M5 - Set power output to 0 (leaving inline mode unchanged).
|
|
||||||
*
|
*
|
||||||
* M3I - Enable continuous inline power to be processed by the planner, with power
|
* M3I - Enable continuous inline power to be processed by the planner, with power
|
||||||
* calculated and set in the planner blocks, processed inline during stepping.
|
* calculated and set in the planner blocks, processed inline during stepping.
|
||||||
* 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.
|
* In 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.)
|
||||||
* M3I must be set before using planner-synced M3 inline S-Values (LASER_POWER_SYNC).
|
* M3I must be set before using planner-synced M3 inline S-Values (LASER_POWER_SYNC).
|
||||||
*
|
*
|
||||||
* M4I - Set dynamic mode which calculates laser power OCR based on the current feedrate.
|
* M4I - Set dynamic mode which calculates laser power OCR based on the current feedrate.
|
||||||
*
|
*
|
||||||
* M5I - Clear inline mode and set power to 0.
|
|
||||||
*
|
|
||||||
* Spindle:
|
* Spindle:
|
||||||
* M3 - Spindle ON (Clockwise)
|
* M3 - Spindle ON (Clockwise)
|
||||||
* M4 - Spindle ON (Counter-clockwise)
|
* M4 - Spindle ON (Counter-clockwise)
|
||||||
* M5 - Spindle OFF
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* S<power> - Set power. S0 will turn the spindle/laser off.
|
* S<power> - Set power. S0 will turn the spindle/laser off.
|
||||||
|
@ -92,19 +89,15 @@ void GcodeSuite::M3_M4(const bool is_M4) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto get_s_power = [] {
|
auto get_s_power = [] {
|
||||||
float u;
|
|
||||||
if (parser.seenval('S')) {
|
if (parser.seenval('S')) {
|
||||||
const float v = parser.value_float();
|
const float v = parser.value_float();
|
||||||
u = TERN(LASER_POWER_TRAP, v, cutter.power_to_range(v));
|
cutter.menuPower = cutter.unitPower = TERN(LASER_POWER_TRAP, v, cutter.power_to_range(v));
|
||||||
}
|
}
|
||||||
else if (cutter.cutter_mode == CUTTER_MODE_STANDARD)
|
else if (cutter.cutter_mode == CUTTER_MODE_STANDARD)
|
||||||
u = cutter.cpwr_to_upwr(SPEED_POWER_STARTUP);
|
cutter.menuPower = cutter.unitPower = cutter.cpwr_to_upwr(SPEED_POWER_STARTUP);
|
||||||
|
|
||||||
cutter.menuPower = cutter.unitPower = u;
|
|
||||||
|
|
||||||
// PWM not implied, power converted to OCR from unit definition and on/off if not PWM.
|
// PWM not implied, power converted to OCR from unit definition and on/off if not PWM.
|
||||||
cutter.power = TERN(SPINDLE_LASER_USE_PWM, cutter.upower_to_ocr(u), u > 0 ? 255 : 0);
|
cutter.power = TERN(SPINDLE_LASER_USE_PWM, cutter.upower_to_ocr(cutter.unitPower), cutter.unitPower > 0 ? 255 : 0);
|
||||||
return u;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS || cutter.cutter_mode == CUTTER_MODE_DYNAMIC) { // Laser power in inline mode
|
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) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M5 - Cutter OFF (when moves are complete)
|
* M5 - Cutter OFF (when moves are complete)
|
||||||
|
*
|
||||||
|
* Laser:
|
||||||
|
* M5 - Set power output to 0 (leaving inline mode unchanged).
|
||||||
|
* M5I - Clear inline mode and set power to 0.
|
||||||
|
*
|
||||||
|
* Spindle:
|
||||||
|
* M5 - Spindle OFF
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::M5() {
|
void GcodeSuite::M5() {
|
||||||
planner.synchronize();
|
planner.synchronize();
|
||||||
|
|
Loading…
Reference in a new issue