mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-29 23:07:42 +00:00
🚸 Revert M206 Home Offset behavior (#25996)
This commit is contained in:
parent
a0e3dea8b8
commit
9135e3f7d3
@ -3835,14 +3835,17 @@
|
||||
//#define REPETIER_GCODE_M360 // Add commands originally from Repetier FW
|
||||
|
||||
/**
|
||||
* Enable this option for a leaner build of Marlin that removes all
|
||||
* workspace offsets, simplifying coordinate transformations, leveling, etc.
|
||||
*
|
||||
* - M206 and M428 are disabled.
|
||||
* - G92 will revert to its behavior from Marlin 1.0.
|
||||
* Enable this option for a leaner build of Marlin that removes
|
||||
* workspace offsets to slightly optimize performance.
|
||||
* G92 will revert to its behavior from Marlin 1.0.
|
||||
*/
|
||||
//#define NO_WORKSPACE_OFFSETS
|
||||
|
||||
/**
|
||||
* Disable M206 and M428 if you don't need home offsets.
|
||||
*/
|
||||
//#define NO_HOME_OFFSETS
|
||||
|
||||
/**
|
||||
* CNC G-code options
|
||||
* Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc.
|
||||
|
@ -1337,7 +1337,7 @@ void setup() {
|
||||
SETUP_RUN(touchBt.init());
|
||||
#endif
|
||||
|
||||
TERN_(HAS_M206_COMMAND, current_position += home_offset); // Init current position based on home_offset
|
||||
TERN_(HAS_HOME_OFFSET, current_position += home_offset); // Init current position based on home_offset
|
||||
|
||||
sync_plan_position(); // Vital to init stepper/planner equivalent for current_position
|
||||
|
||||
|
@ -207,7 +207,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
||||
|
||||
TERN_(GCODE_REPEAT_MARKERS, info.stored_repeat = repeat);
|
||||
TERN_(HAS_HOME_OFFSET, info.home_offset = home_offset);
|
||||
TERN_(HAS_POSITION_SHIFT, info.position_shift = position_shift);
|
||||
TERN_(HAS_WORKSPACE_OFFSET, info.workspace_offset = workspace_offset);
|
||||
E_TERN_(info.active_extruder = active_extruder);
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
@ -552,10 +552,7 @@ void PrintJobRecovery::resume() {
|
||||
|
||||
TERN_(GCODE_REPEAT_MARKERS, repeat = info.stored_repeat);
|
||||
TERN_(HAS_HOME_OFFSET, home_offset = info.home_offset);
|
||||
TERN_(HAS_POSITION_SHIFT, position_shift = info.position_shift);
|
||||
#if HAS_HOME_OFFSET || HAS_POSITION_SHIFT
|
||||
LOOP_NUM_AXES(i) update_workspace_offset((AxisEnum)i);
|
||||
#endif
|
||||
TERN_(HAS_WORKSPACE_OFFSET, workspace_offset = info.workspace_offset);
|
||||
|
||||
// Relative axis modes
|
||||
gcode.axis_relative = info.axis_relative;
|
||||
@ -600,11 +597,11 @@ void PrintJobRecovery::resume() {
|
||||
DEBUG_EOL();
|
||||
#endif
|
||||
|
||||
#if HAS_POSITION_SHIFT
|
||||
DEBUG_ECHOPGM("position_shift: ");
|
||||
#if HAS_WORKSPACE_OFFSET
|
||||
DEBUG_ECHOPGM("workspace_offset: ");
|
||||
LOOP_NUM_AXES(i) {
|
||||
if (i) DEBUG_CHAR(',');
|
||||
DEBUG_ECHO(info.position_shift[i]);
|
||||
DEBUG_ECHO(info.workspace_offset[i]);
|
||||
}
|
||||
DEBUG_EOL();
|
||||
#endif
|
||||
|
@ -67,8 +67,8 @@ typedef struct {
|
||||
#if HAS_HOME_OFFSET
|
||||
xyz_pos_t home_offset;
|
||||
#endif
|
||||
#if HAS_POSITION_SHIFT
|
||||
xyz_pos_t position_shift;
|
||||
#if HAS_WORKSPACE_OFFSET
|
||||
xyz_pos_t workspace_offset;
|
||||
#endif
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
uint8_t active_extruder;
|
||||
|
@ -120,14 +120,7 @@
|
||||
* (Z is already at the right height)
|
||||
*/
|
||||
constexpr xy_float_t safe_homing_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT };
|
||||
#if HAS_HOME_OFFSET && DISABLED(Z_SAFE_HOMING_POINT_ABSOLUTE)
|
||||
xy_float_t okay_homing_xy = safe_homing_xy;
|
||||
okay_homing_xy -= home_offset;
|
||||
#else
|
||||
constexpr xy_float_t okay_homing_xy = safe_homing_xy;
|
||||
#endif
|
||||
|
||||
destination.set(okay_homing_xy, current_position.z);
|
||||
destination.set(safe_homing_xy, current_position.z);
|
||||
|
||||
TERN_(HOMING_Z_WITH_PROBE, destination -= probe.offset_xy);
|
||||
|
||||
|
@ -715,7 +715,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 204: M204(); break; // M204: Set acceleration
|
||||
case 205: M205(); break; // M205: Set advanced settings
|
||||
|
||||
#if HAS_M206_COMMAND
|
||||
#if HAS_HOME_OFFSET
|
||||
case 206: M206(); break; // M206: Set home offsets
|
||||
#endif
|
||||
|
||||
@ -881,7 +881,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 425: M425(); break; // M425: Tune backlash compensation
|
||||
#endif
|
||||
|
||||
#if HAS_M206_COMMAND
|
||||
#if HAS_HOME_OFFSET
|
||||
case 428: M428(); break; // M428: Apply current_position to home_offset
|
||||
#endif
|
||||
|
||||
|
@ -860,7 +860,7 @@ private:
|
||||
static void M205();
|
||||
static void M205_report(const bool forReplay=true);
|
||||
|
||||
#if HAS_M206_COMMAND
|
||||
#if HAS_HOME_OFFSET
|
||||
static void M206();
|
||||
static void M206_report(const bool forReplay=true);
|
||||
#endif
|
||||
@ -1043,7 +1043,7 @@ private:
|
||||
static void M425_report(const bool forReplay=true);
|
||||
#endif
|
||||
|
||||
#if HAS_M206_COMMAND
|
||||
#if HAS_HOME_OFFSET
|
||||
static void M428();
|
||||
#endif
|
||||
|
||||
|
@ -37,12 +37,7 @@ bool GcodeSuite::select_coordinate_system(const int8_t _new) {
|
||||
xyz_float_t new_offset{0};
|
||||
if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1))
|
||||
new_offset = coordinate_system[_new];
|
||||
LOOP_NUM_AXES(i) {
|
||||
if (position_shift[i] != new_offset[i]) {
|
||||
position_shift[i] = new_offset[i];
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
}
|
||||
}
|
||||
workspace_offset = new_offset;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -63,10 +63,7 @@ void GcodeSuite::G92() {
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS) && !IS_SCARA
|
||||
case 1: // G92.1 - Zero the Workspace Offset
|
||||
LOOP_NUM_AXES(i) if (position_shift[i]) {
|
||||
position_shift[i] = 0;
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
}
|
||||
workspace_offset.reset();
|
||||
break;
|
||||
#endif
|
||||
|
||||
@ -92,10 +89,9 @@ void GcodeSuite::G92() {
|
||||
v = TERN0(HAS_EXTRUDERS, i == E_AXIS) ? l : LOGICAL_TO_NATIVE(l, i), // Axis position in NATIVE space (applying the existing offset)
|
||||
d = v - current_position[i]; // How much is the current axis position altered by?
|
||||
if (!NEAR_ZERO(d)) {
|
||||
#if HAS_POSITION_SHIFT && NONE(IS_SCARA, POLARGRAPH) // When using workspaces...
|
||||
#if HAS_WORKSPACE_OFFSET && NONE(IS_SCARA, POLARGRAPH) // When using workspaces...
|
||||
if (TERN1(HAS_EXTRUDERS, i != E_AXIS)) {
|
||||
position_shift[i] += d; // ...most axes offset the workspace...
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
workspace_offset[i] += d; // ...most axes offset the workspace...
|
||||
}
|
||||
else {
|
||||
#if HAS_EXTRUDERS
|
||||
@ -120,7 +116,7 @@ void GcodeSuite::G92() {
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
||||
// Apply Workspace Offset to the active coordinate system
|
||||
if (WITHIN(active_coordinate_system, 0, MAX_COORDINATE_SYSTEMS - 1))
|
||||
coordinate_system[active_coordinate_system] = position_shift;
|
||||
coordinate_system[active_coordinate_system] = workspace_offset;
|
||||
#endif
|
||||
|
||||
if (sync_XYZE) sync_plan_position();
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_M206_COMMAND
|
||||
#if HAS_HOME_OFFSET
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/motion.h"
|
||||
@ -101,4 +101,4 @@ void GcodeSuite::M428() {
|
||||
OKAY_BUZZ();
|
||||
}
|
||||
|
||||
#endif // HAS_M206_COMMAND
|
||||
#endif // HAS_HOME_OFFSET
|
||||
|
@ -46,7 +46,7 @@ void mpe_settings_init() {
|
||||
mpe_settings.parking_xpos[0] = pex[0]; // M951 L
|
||||
mpe_settings.parking_xpos[1] = pex[1]; // M951 R
|
||||
mpe_settings.grab_distance = PARKING_EXTRUDER_GRAB_DISTANCE; // M951 I
|
||||
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, mpe_settings.grab_distance * -1));
|
||||
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, -mpe_settings.grab_distance));
|
||||
mpe_settings.slow_feedrate = MMM_TO_MMS(MPE_SLOW_SPEED); // M951 J
|
||||
mpe_settings.fast_feedrate = MMM_TO_MMS(MPE_FAST_SPEED); // M951 H
|
||||
mpe_settings.travel_distance = MPE_TRAVEL_DISTANCE; // M951 D
|
||||
@ -59,7 +59,7 @@ void GcodeSuite::M951() {
|
||||
if (parser.seenval('R')) mpe_settings.parking_xpos[1] = parser.value_linear_units();
|
||||
if (parser.seenval('I')) {
|
||||
mpe_settings.grab_distance = parser.value_linear_units();
|
||||
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, mpe_settings.grab_distance * -1));
|
||||
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, -mpe_settings.grab_distance));
|
||||
}
|
||||
if (parser.seenval('J')) mpe_settings.slow_feedrate = MMM_TO_MMS(parser.value_linear_units());
|
||||
if (parser.seenval('H')) mpe_settings.fast_feedrate = MMM_TO_MMS(parser.value_linear_units());
|
||||
|
@ -97,6 +97,7 @@
|
||||
#if !HAS_X_AXIS
|
||||
//#define LCD_SHOW_E_TOTAL
|
||||
#define NO_WORKSPACE_OFFSETS
|
||||
#define NO_HOME_OFFSETS
|
||||
#undef AUTOTEMP
|
||||
#undef CALIBRATION_MEASURE_LEFT
|
||||
#undef CALIBRATION_MEASURE_RIGHT
|
||||
|
@ -3140,13 +3140,13 @@
|
||||
#undef MOTOR_CURRENT
|
||||
#endif
|
||||
|
||||
// Updated G92 behavior shifts the workspace
|
||||
// G92 shifts the workspace
|
||||
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||
#define HAS_POSITION_SHIFT 1
|
||||
#define HAS_WORKSPACE_OFFSET 1
|
||||
#endif
|
||||
#if DISABLED(NO_HOME_OFFSETS)
|
||||
#if IS_CARTESIAN
|
||||
#define HAS_HOME_OFFSET 1 // The home offset also shifts the coordinate space
|
||||
#define HAS_WORKSPACE_OFFSET 1 // Cumulative offset to workspace to save some calculation
|
||||
#define HAS_M206_COMMAND 1 // M206 sets the home offset for Cartesian machines
|
||||
#define HAS_HOME_OFFSET 1 // M206 affects the Native Machine Space on G28
|
||||
#elif IS_SCARA
|
||||
#define HAS_SCARA_OFFSET 1 // The SCARA home offset applies only on G28
|
||||
#endif
|
||||
|
@ -695,7 +695,7 @@ void menu_advanced_settings() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_M206_COMMAND
|
||||
#if HAS_HOME_OFFSET
|
||||
// M428 - Set Home Offsets
|
||||
ACTION_ITEM(MSG_SET_HOME_OFFSETS, []{ queue.inject(F("M428")); ui.return_to_status(); });
|
||||
#endif
|
||||
|
@ -101,7 +101,7 @@ void recalc_delta_settings() {
|
||||
*
|
||||
* Suggested optimizations include:
|
||||
*
|
||||
* - Disable the home_offset (M206) and/or position_shift (G92)
|
||||
* - Disable the home_offset (M206) and/or workspace_offset (G92)
|
||||
* features to remove up to 12 float additions.
|
||||
*/
|
||||
|
||||
|
@ -64,7 +64,7 @@ void recalc_delta_settings();
|
||||
*
|
||||
* Suggested optimizations include:
|
||||
*
|
||||
* - Disable the home_offset (M206) and/or position_shift (G92)
|
||||
* - Disable the home_offset (M206) and/or workspace_offset (G92)
|
||||
* features to remove up to 12 float additions.
|
||||
*
|
||||
* - Use a fast-inverse-sqrt function and add the reciprocal.
|
||||
|
@ -177,16 +177,12 @@ xyz_pos_t cartes;
|
||||
* The workspace can be offset by some commands, or
|
||||
* these offsets may be omitted to save on computation.
|
||||
*/
|
||||
#if HAS_POSITION_SHIFT
|
||||
// The distance that XYZ has been offset by G92. Reset by G28.
|
||||
xyz_pos_t position_shift{0};
|
||||
#endif
|
||||
#if HAS_HOME_OFFSET
|
||||
// This offset is added to the configured home position.
|
||||
// Set by M206, M428, or menu item. Saved to EEPROM.
|
||||
xyz_pos_t home_offset{0};
|
||||
#endif
|
||||
#if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
|
||||
#if HAS_WORKSPACE_OFFSET
|
||||
// The above two are combined to save on computes
|
||||
xyz_pos_t workspace_offset{0};
|
||||
#endif
|
||||
@ -2468,7 +2464,7 @@ void set_axis_is_at_home(const AxisEnum axis) {
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
if (axis == X_AXIS && (active_extruder == 1 || dual_x_carriage_mode == DXC_DUPLICATION_MODE)) {
|
||||
current_position.x = x_home_pos(active_extruder);
|
||||
current_position.x = SUM_TERN(HAS_HOME_OFFSET, x_home_pos(active_extruder), home_offset.x);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -2478,7 +2474,7 @@ void set_axis_is_at_home(const AxisEnum axis) {
|
||||
#elif ENABLED(DELTA)
|
||||
current_position[axis] = (axis == Z_AXIS) ? DIFF_TERN(HAS_BED_PROBE, delta_height, probe.offset.z) : base_home_pos(axis);
|
||||
#else
|
||||
current_position[axis] = base_home_pos(axis);
|
||||
current_position[axis] = SUM_TERN(HAS_HOME_OFFSET, base_home_pos(axis), home_offset[axis]);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -2499,10 +2495,7 @@ void set_axis_is_at_home(const AxisEnum axis) {
|
||||
|
||||
TERN_(BABYSTEP_DISPLAY_TOTAL, babystep.reset_total(axis));
|
||||
|
||||
#if HAS_POSITION_SHIFT
|
||||
position_shift[axis] = 0;
|
||||
update_workspace_offset(axis);
|
||||
#endif
|
||||
TERN_(HAS_WORKSPACE_OFFSET, workspace_offset[axis] = 0);
|
||||
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
#if HAS_HOME_OFFSET
|
||||
@ -2513,20 +2506,11 @@ void set_axis_is_at_home(const AxisEnum axis) {
|
||||
}
|
||||
}
|
||||
|
||||
#if HAS_WORKSPACE_OFFSET
|
||||
void update_workspace_offset(const AxisEnum axis) {
|
||||
workspace_offset[axis] = home_offset[axis] + position_shift[axis];
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Axis ", AS_CHAR(AXIS_CHAR(axis)), " home_offset = ", home_offset[axis], " position_shift = ", position_shift[axis]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_M206_COMMAND
|
||||
#if HAS_HOME_OFFSET
|
||||
/**
|
||||
* Change the home offset for an axis.
|
||||
* Also refreshes the workspace offset.
|
||||
* Set the home offset for an axis.
|
||||
*/
|
||||
void set_home_offset(const AxisEnum axis, const_float_t v) {
|
||||
home_offset[axis] = v;
|
||||
update_workspace_offset(axis);
|
||||
}
|
||||
#endif
|
||||
|
@ -147,12 +147,6 @@ inline float home_bump_mm(const AxisEnum axis) {
|
||||
return pgm_read_any(&home_bump_mm_P[axis]);
|
||||
}
|
||||
|
||||
#if HAS_WORKSPACE_OFFSET
|
||||
void update_workspace_offset(const AxisEnum axis);
|
||||
#else
|
||||
inline void update_workspace_offset(const AxisEnum) {}
|
||||
#endif
|
||||
|
||||
#if HAS_HOTEND_OFFSET
|
||||
extern xyz_pos_t hotend_offset[HOTENDS];
|
||||
void reset_hotend_offsets();
|
||||
@ -484,32 +478,23 @@ void home_if_needed(const bool keeplev=false);
|
||||
|
||||
#define BABYSTEP_ALLOWED() ((ENABLED(BABYSTEP_WITHOUT_HOMING) || all_axes_trusted()) && (ENABLED(BABYSTEP_ALWAYS_AVAILABLE) || printer_busy()))
|
||||
|
||||
/**
|
||||
* Workspace offsets
|
||||
*/
|
||||
#if HAS_HOME_OFFSET || HAS_POSITION_SHIFT
|
||||
#if HAS_HOME_OFFSET
|
||||
extern xyz_pos_t home_offset;
|
||||
#endif
|
||||
#if HAS_POSITION_SHIFT
|
||||
extern xyz_pos_t position_shift;
|
||||
#endif
|
||||
#if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
|
||||
|
||||
/**
|
||||
* Workspace offsets
|
||||
*/
|
||||
#if HAS_WORKSPACE_OFFSET
|
||||
extern xyz_pos_t workspace_offset;
|
||||
#define _WS workspace_offset
|
||||
#elif HAS_HOME_OFFSET
|
||||
#define _WS home_offset
|
||||
#else
|
||||
#define _WS position_shift
|
||||
#endif
|
||||
#define NATIVE_TO_LOGICAL(POS, AXIS) ((POS) + _WS[AXIS])
|
||||
#define LOGICAL_TO_NATIVE(POS, AXIS) ((POS) - _WS[AXIS])
|
||||
FORCE_INLINE void toLogical(xy_pos_t &raw) { raw += _WS; }
|
||||
FORCE_INLINE void toLogical(xyz_pos_t &raw) { raw += _WS; }
|
||||
FORCE_INLINE void toLogical(xyze_pos_t &raw) { raw += _WS; }
|
||||
FORCE_INLINE void toNative(xy_pos_t &raw) { raw -= _WS; }
|
||||
FORCE_INLINE void toNative(xyz_pos_t &raw) { raw -= _WS; }
|
||||
FORCE_INLINE void toNative(xyze_pos_t &raw) { raw -= _WS; }
|
||||
#define NATIVE_TO_LOGICAL(POS, AXIS) ((POS) + workspace_offset[AXIS])
|
||||
#define LOGICAL_TO_NATIVE(POS, AXIS) ((POS) - workspace_offset[AXIS])
|
||||
FORCE_INLINE void toLogical(xy_pos_t &raw) { raw += workspace_offset; }
|
||||
FORCE_INLINE void toLogical(xyz_pos_t &raw) { raw += workspace_offset; }
|
||||
FORCE_INLINE void toLogical(xyze_pos_t &raw) { raw += workspace_offset; }
|
||||
FORCE_INLINE void toNative(xy_pos_t &raw) { raw -= workspace_offset; }
|
||||
FORCE_INLINE void toNative(xyz_pos_t &raw) { raw -= workspace_offset; }
|
||||
FORCE_INLINE void toNative(xyze_pos_t &raw) { raw -= workspace_offset; }
|
||||
#else
|
||||
#define NATIVE_TO_LOGICAL(POS, AXIS) (POS)
|
||||
#define LOGICAL_TO_NATIVE(POS, AXIS) (POS)
|
||||
@ -633,7 +618,7 @@ void home_if_needed(const bool keeplev=false);
|
||||
|
||||
#endif
|
||||
|
||||
#if HAS_M206_COMMAND
|
||||
#if HAS_HOME_OFFSET
|
||||
void set_home_offset(const AxisEnum axis, const_float_t v);
|
||||
#endif
|
||||
|
||||
|
@ -670,10 +670,7 @@ void MarlinSettings::postprocess() {
|
||||
#endif
|
||||
|
||||
// Software endstops depend on home_offset
|
||||
LOOP_NUM_AXES(i) {
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
update_software_endstops((AxisEnum)i);
|
||||
}
|
||||
LOOP_NUM_AXES(i) update_software_endstops((AxisEnum)i);
|
||||
|
||||
TERN_(ENABLE_LEVELING_FADE_HEIGHT, set_z_fade_height(new_z_fade_height, false)); // false = no report
|
||||
|
||||
@ -3701,7 +3698,7 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
// M206 Home Offset
|
||||
//
|
||||
TERN_(HAS_M206_COMMAND, gcode.M206_report(forReplay));
|
||||
TERN_(HAS_HOME_OFFSET, gcode.M206_report(forReplay));
|
||||
|
||||
//
|
||||
// M218 Hotend offsets
|
||||
|
@ -1417,19 +1417,13 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
#if ANY(TC_GCODE_USE_GLOBAL_X, TC_GCODE_USE_GLOBAL_Y, TC_GCODE_USE_GLOBAL_Z)
|
||||
// G0/G1/G2/G3/G5 moves are relative to the active tool.
|
||||
// Shift the workspace to make custom moves relative to T0.
|
||||
xyz_pos_t old_position_shift;
|
||||
xyz_pos_t old_workspace_offset;
|
||||
if (new_tool > 0) {
|
||||
old_position_shift = position_shift;
|
||||
old_workspace_offset = workspace_offset;
|
||||
const xyz_pos_t &he = hotend_offset[new_tool];
|
||||
#if ENABLED(TC_GCODE_USE_GLOBAL_X)
|
||||
position_shift.x -= he.x; update_workspace_offset(X_AXIS);
|
||||
#endif
|
||||
#if ENABLED(TC_GCODE_USE_GLOBAL_Y)
|
||||
position_shift.y -= he.y; update_workspace_offset(Y_AXIS);
|
||||
#endif
|
||||
#if ENABLED(TC_GCODE_USE_GLOBAL_Z)
|
||||
position_shift.z -= he.z; update_workspace_offset(Z_AXIS);
|
||||
#endif
|
||||
TERN_(TC_GCODE_USE_GLOBAL_X, workspace_offset.x -= he.x);
|
||||
TERN_(TC_GCODE_USE_GLOBAL_Y, workspace_offset.y -= he.y);
|
||||
TERN_(TC_GCODE_USE_GLOBAL_Z, workspace_offset.z -= he.z);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1462,12 +1456,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
}
|
||||
|
||||
#if ANY(TC_GCODE_USE_GLOBAL_X, TC_GCODE_USE_GLOBAL_Y, TC_GCODE_USE_GLOBAL_Z)
|
||||
if (new_tool > 0) {
|
||||
position_shift = old_position_shift;
|
||||
TERN_(TC_GCODE_USE_GLOBAL_X, update_workspace_offset(X_AXIS));
|
||||
TERN_(TC_GCODE_USE_GLOBAL_Y, update_workspace_offset(Y_AXIS));
|
||||
TERN_(TC_GCODE_USE_GLOBAL_Z, update_workspace_offset(Z_AXIS));
|
||||
}
|
||||
if (new_tool > 0) workspace_offset = old_workspace_offset;
|
||||
#endif
|
||||
|
||||
// If using MECHANICAL_SWITCHING extruder/nozzle, set HOTEND_OFFSET in Z axis after running EVENT_GCODE_TOOLCHANGE
|
||||
|
@ -318,7 +318,7 @@ PARK_HEAD_ON_PAUSE = build_src_filter=+<src/gcode/feature/pa
|
||||
FILAMENT_LOAD_UNLOAD_GCODES = build_src_filter=+<src/gcode/feature/pause/M701_M702.cpp>
|
||||
CNC_WORKSPACE_PLANES = build_src_filter=+<src/gcode/geometry/G17-G19.cpp>
|
||||
CNC_COORDINATE_SYSTEMS = build_src_filter=+<src/gcode/geometry/G53-G59.cpp>
|
||||
HAS_M206_COMMAND = build_src_filter=+<src/gcode/geometry/M206_M428.cpp>
|
||||
HAS_HOME_OFFSET = build_src_filter=+<src/gcode/geometry/M206_M428.cpp>
|
||||
EXPECTED_PRINTER_CHECK = build_src_filter=+<src/gcode/host/M16.cpp>
|
||||
HOST_KEEPALIVE_FEATURE = build_src_filter=+<src/gcode/host/M113.cpp>
|
||||
AUTO_REPORT_POSITION = build_src_filter=+<src/gcode/host/M154.cpp>
|
||||
|
Loading…
Reference in New Issue
Block a user