Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x
This commit is contained in:
@ -74,7 +74,9 @@ inline void delay_for_power_down() { safe_delay(SPINDLE_LASER_POWERDOWN_DELAY);
|
||||
|
||||
inline void set_spindle_laser_ocr(const uint8_t ocr) {
|
||||
WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low)
|
||||
analogWrite(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr);
|
||||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
analogWrite(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
|
@ -33,9 +33,23 @@
|
||||
*/
|
||||
void GcodeSuite::G92() {
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
||||
switch (parser.subcode) {
|
||||
case 1:
|
||||
bool didE = false;
|
||||
#if IS_SCARA || !HAS_POSITION_SHIFT
|
||||
bool didXYZ = false;
|
||||
#else
|
||||
constexpr bool didXYZ = false;
|
||||
#endif
|
||||
|
||||
#if USE_GCODE_SUBCODES
|
||||
const uint8_t subcode_G92 = parser.subcode;
|
||||
#else
|
||||
constexpr uint8_t subcode_G92 = 0;
|
||||
#endif
|
||||
|
||||
switch (subcode_G92) {
|
||||
default: break;
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
||||
case 1: {
|
||||
// Zero the G92 values and restore current position
|
||||
#if !IS_SCARA
|
||||
LOOP_XYZ(i) {
|
||||
@ -46,44 +60,46 @@ void GcodeSuite::G92() {
|
||||
}
|
||||
}
|
||||
#endif // Not SCARA
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
||||
#define IS_G92_0 (parser.subcode == 0)
|
||||
#else
|
||||
#define IS_G92_0 true
|
||||
#endif
|
||||
|
||||
bool didE = false;
|
||||
#if IS_SCARA || !HAS_POSITION_SHIFT
|
||||
bool didXYZ = false;
|
||||
#else
|
||||
constexpr bool didXYZ = false;
|
||||
#endif
|
||||
|
||||
if (IS_G92_0) LOOP_XYZE(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
const float l = parser.value_axis_units((AxisEnum)i),
|
||||
v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i),
|
||||
d = v - current_position[i];
|
||||
if (!NEAR_ZERO(d)) {
|
||||
#if IS_SCARA || !HAS_POSITION_SHIFT
|
||||
if (i == E_AXIS) didE = true; else didXYZ = true;
|
||||
current_position[i] = v; // Without workspaces revert to Marlin 1.0 behavior
|
||||
#elif HAS_POSITION_SHIFT
|
||||
if (i == E_AXIS) {
|
||||
didE = true;
|
||||
current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
|
||||
} return;
|
||||
#endif
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
case 9: {
|
||||
LOOP_XYZE(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
current_position[i] = parser.value_axis_units((AxisEnum)i);
|
||||
#if IS_SCARA || !HAS_POSITION_SHIFT
|
||||
if (i == E_AXIS) didE = true; else didXYZ = true;
|
||||
#elif HAS_POSITION_SHIFT
|
||||
if (i == E_AXIS) didE = true;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
position_shift[i] += d; // Other axes simply offset the coordinate space
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
}
|
||||
} break;
|
||||
#endif
|
||||
case 0: {
|
||||
LOOP_XYZE(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
const float l = parser.value_axis_units((AxisEnum)i),
|
||||
v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i),
|
||||
d = v - current_position[i];
|
||||
if (!NEAR_ZERO(d)) {
|
||||
#if IS_SCARA || !HAS_POSITION_SHIFT
|
||||
if (i == E_AXIS) didE = true; else didXYZ = true;
|
||||
current_position[i] = v; // Without workspaces revert to Marlin 1.0 behavior
|
||||
#elif HAS_POSITION_SHIFT
|
||||
if (i == E_AXIS) {
|
||||
didE = true;
|
||||
current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
|
||||
}
|
||||
else {
|
||||
position_shift[i] += d; // Other axes simply offset the coordinate space
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
||||
|
@ -526,8 +526,9 @@ void gcode_line_error(PGM_P const err, const int8_t port) {
|
||||
|
||||
#endif // BINARY_FILE_TRANSFER
|
||||
|
||||
FORCE_INLINE bool is_M29(const char * const cmd) {
|
||||
return cmd[0] == 'M' && cmd[1] == '2' && cmd[2] == '9' && !WITHIN(cmd[3], '0', '9');
|
||||
FORCE_INLINE bool is_M29(const char * const cmd) { // matches "M29" & "M29 ", but not "M290", etc
|
||||
const char * const m29 = strstr_P(cmd, PSTR("M29"));
|
||||
return m29 && !NUMERIC(m29[3]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,9 +31,6 @@
|
||||
* M23: Open a file
|
||||
*/
|
||||
void GcodeSuite::M23() {
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
card.removeJobRecoveryFile();
|
||||
#endif
|
||||
// Simplify3D includes the size, so zero out all spaces (#7227)
|
||||
for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
|
||||
card.openFile(parser.string_arg, true);
|
||||
|
Reference in New Issue
Block a user