@@ -39,7 +39,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_LINEAR_AXES(i) {
|
||||
LOOP_NUM_AXES(i) {
|
||||
if (position_shift[i] != new_offset[i]) {
|
||||
position_shift[i] = new_offset[i];
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
|
@@ -29,7 +29,7 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* G92: Set the Current Position to the given X [Y [Z [A [B [C [E]]]]]] values.
|
||||
* G92: Set the Current Position to the given X [Y [Z [A [B [C [U [V [W ]]]]]]]] [E] values.
|
||||
*
|
||||
* Behind the scenes the G92 command may modify the Current Position
|
||||
* or the Position Shift depending on settings and sub-commands.
|
||||
@@ -37,14 +37,14 @@
|
||||
* Since E has no Workspace Offset, it is always set directly.
|
||||
*
|
||||
* Without Workspace Offsets (e.g., with NO_WORKSPACE_OFFSETS):
|
||||
* G92 : Set NATIVE Current Position to the given X [Y [Z [A [B [C [E]]]]]].
|
||||
* G92 : Set NATIVE Current Position to the given X [Y [Z [A [B [C [U [V [W ]]]]]]]] [E].
|
||||
*
|
||||
* Using Workspace Offsets (default Marlin behavior):
|
||||
* G92 : Modify Workspace Offsets so the reported position shows the given X [Y [Z [A [B [C [E]]]]]].
|
||||
* G92 : Modify Workspace Offsets so the reported position shows the given X [Y [Z [A [B [C [U [V [W ]]]]]]]] [E].
|
||||
* G92.1 : Zero XYZ Workspace Offsets (so the reported position = the native position).
|
||||
*
|
||||
* With POWER_LOSS_RECOVERY:
|
||||
* G92.9 : Set NATIVE Current Position to the given X [Y [Z [A [B [C [E]]]]]].
|
||||
* G92.9 : Set NATIVE Current Position to the given X [Y [Z [A [B [C [U [V [W ]]]]]]]] [E].
|
||||
*/
|
||||
void GcodeSuite::G92() {
|
||||
|
||||
@@ -64,7 +64,7 @@ void GcodeSuite::G92() {
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS) && !IS_SCARA
|
||||
case 1: // G92.1 - Zero the Workspace Offset
|
||||
LOOP_LINEAR_AXES(i) if (position_shift[i]) {
|
||||
LOOP_NUM_AXES(i) if (position_shift[i]) {
|
||||
position_shift[i] = 0;
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
}
|
||||
|
@@ -39,11 +39,17 @@
|
||||
*/
|
||||
void GcodeSuite::M206() {
|
||||
if (!parser.seen_any()) return M206_report();
|
||||
|
||||
LOOP_LINEAR_AXES(i)
|
||||
if (parser.seen(AXIS_CHAR(i)))
|
||||
set_home_offset((AxisEnum)i, parser.value_linear_units());
|
||||
|
||||
NUM_AXIS_CODE(
|
||||
if (parser.seen('X')) set_home_offset(X_AXIS, parser.value_linear_units()),
|
||||
if (parser.seen('Y')) set_home_offset(Y_AXIS, parser.value_linear_units()),
|
||||
if (parser.seen('Z')) set_home_offset(Z_AXIS, parser.value_linear_units()),
|
||||
if (parser.seen(AXIS4_NAME)) set_home_offset(I_AXIS, parser.TERN(AXIS4_ROTATES, value_float, value_linear_units)()),
|
||||
if (parser.seen(AXIS5_NAME)) set_home_offset(J_AXIS, parser.TERN(AXIS5_ROTATES, value_float, value_linear_units)()),
|
||||
if (parser.seen(AXIS6_NAME)) set_home_offset(K_AXIS, parser.TERN(AXIS6_ROTATES, value_float, value_linear_units)()),
|
||||
if (parser.seen(AXIS7_NAME)) set_home_offset(U_AXIS, parser.TERN(AXIS7_ROTATES, value_float, value_linear_units)()),
|
||||
if (parser.seen(AXIS8_NAME)) set_home_offset(V_AXIS, parser.TERN(AXIS8_ROTATES, value_float, value_linear_units)()),
|
||||
if (parser.seen(AXIS9_NAME)) set_home_offset(W_AXIS, parser.TERN(AXIS9_ROTATES, value_float, value_linear_units)())
|
||||
);
|
||||
#if ENABLED(MORGAN_SCARA)
|
||||
if (parser.seen('T')) set_home_offset(A_AXIS, parser.value_float()); // Theta
|
||||
if (parser.seen('P')) set_home_offset(B_AXIS, parser.value_float()); // Psi
|
||||
@@ -56,13 +62,16 @@ void GcodeSuite::M206_report(const bool forReplay/*=true*/) {
|
||||
report_heading_etc(forReplay, F(STR_HOME_OFFSET));
|
||||
SERIAL_ECHOLNPGM_P(
|
||||
#if IS_CARTESIAN
|
||||
LIST_N(DOUBLE(LINEAR_AXES),
|
||||
LIST_N(DOUBLE(NUM_AXES),
|
||||
PSTR(" M206 X"), LINEAR_UNIT(home_offset.x),
|
||||
SP_Y_STR, LINEAR_UNIT(home_offset.y),
|
||||
SP_Z_STR, LINEAR_UNIT(home_offset.z),
|
||||
SP_I_STR, LINEAR_UNIT(home_offset.i),
|
||||
SP_J_STR, LINEAR_UNIT(home_offset.j),
|
||||
SP_K_STR, LINEAR_UNIT(home_offset.k)
|
||||
SP_I_STR, I_AXIS_UNIT(home_offset.i),
|
||||
SP_J_STR, J_AXIS_UNIT(home_offset.j),
|
||||
SP_K_STR, K_AXIS_UNIT(home_offset.k),
|
||||
SP_U_STR, U_AXIS_UNIT(home_offset.u),
|
||||
SP_V_STR, V_AXIS_UNIT(home_offset.v),
|
||||
SP_W_STR, W_AXIS_UNIT(home_offset.w)
|
||||
)
|
||||
#else
|
||||
PSTR(" M206 Z"), LINEAR_UNIT(home_offset.z)
|
||||
@@ -85,7 +94,7 @@ void GcodeSuite::M428() {
|
||||
if (homing_needed_error()) return;
|
||||
|
||||
xyz_float_t diff;
|
||||
LOOP_LINEAR_AXES(i) {
|
||||
LOOP_NUM_AXES(i) {
|
||||
diff[i] = base_home_pos((AxisEnum)i) - current_position[i];
|
||||
if (!WITHIN(diff[i], -20, 20) && home_dir((AxisEnum)i) > 0)
|
||||
diff[i] = -current_position[i];
|
||||
@@ -97,7 +106,7 @@ void GcodeSuite::M428() {
|
||||
}
|
||||
}
|
||||
|
||||
LOOP_LINEAR_AXES(i) set_home_offset((AxisEnum)i, diff[i]);
|
||||
LOOP_NUM_AXES(i) set_home_offset((AxisEnum)i, diff[i]);
|
||||
report_current_position();
|
||||
LCD_MESSAGE(MSG_HOME_OFFSETS_APPLIED);
|
||||
OKAY_BUZZ();
|
||||
|
Reference in New Issue
Block a user