Fix non-PWM spindle/laser compile (#18311)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com> Co-authored-by: Luu Lac <45380455+shitcreek@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0b30de1b8e
commit
23806aeb3c
@ -67,8 +67,12 @@
|
||||
*/
|
||||
void GcodeSuite::M3_M4(const bool is_M4) {
|
||||
auto get_s_power = [] {
|
||||
if (parser.seen('S'))
|
||||
cutter.unitPower = cutter.power_to_range(cutter_power_t(round(parser.value_float())));
|
||||
if (parser.seenval('S')) {
|
||||
const float spwr = parser.value_float();
|
||||
cutter.unitPower = TERN(SPINDLE_LASER_PWM,
|
||||
cutter.power_to_range(cutter_power_t(round(spwr))),
|
||||
spwr > 0 ? 255 : 0);
|
||||
}
|
||||
else
|
||||
cutter.unitPower = cutter.cpwr_to_upwr(SPEED_POWER_STARTUP);
|
||||
return cutter.unitPower;
|
||||
@ -86,7 +90,7 @@ void GcodeSuite::M3_M4(const bool is_M4) {
|
||||
else
|
||||
cutter.inline_power(cutter.upower_to_ocr(get_s_power()));
|
||||
#else
|
||||
cutter.inline_enabled(true);
|
||||
cutter.set_inline_enabled(true);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -179,8 +179,10 @@ void GcodeSuite::get_destination_from_command() {
|
||||
|
||||
#if ENABLED(LASER_MOVE_POWER)
|
||||
// Set the laser power in the planner to configure this move
|
||||
if (parser.seen('S'))
|
||||
cutter.inline_power(cutter.power_to_range(cutter_power_t(round(parser.value_float()))));
|
||||
if (parser.seen('S')) {
|
||||
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));
|
||||
}
|
||||
else if (ENABLED(LASER_MOVE_G0_OFF) && parser.codenum == 0) // G0
|
||||
cutter.set_inline_enabled(false);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user