Browse Source

Fix G92.9 (thus PLR Z position) (#15625)

pull/1/head
Robby Candra 5 years ago
committed by Scott Lahteine
parent
commit
cf8541a7a7
  1. 21
      Marlin/src/gcode/geometry/G92.cpp

21
Marlin/src/gcode/geometry/G92.cpp

@ -33,12 +33,7 @@
*/ */
void GcodeSuite::G92() { void GcodeSuite::G92() {
bool didE = false; bool sync_E = false, sync_XYZ = false;
#if IS_SCARA || !HAS_POSITION_SHIFT
bool didXYZ = false;
#else
constexpr bool didXYZ = false;
#endif
#if USE_GCODE_SUBCODES #if USE_GCODE_SUBCODES
const uint8_t subcode_G92 = parser.subcode; const uint8_t subcode_G92 = parser.subcode;
@ -64,11 +59,7 @@ void GcodeSuite::G92() {
LOOP_XYZE(i) { LOOP_XYZE(i) {
if (parser.seenval(axis_codes[i])) { if (parser.seenval(axis_codes[i])) {
current_position[i] = parser.value_axis_units((AxisEnum)i); current_position[i] = parser.value_axis_units((AxisEnum)i);
#if IS_SCARA || !HAS_POSITION_SHIFT if (i == E_AXIS) sync_E = true; else sync_XYZ = true;
if (i == E_AXIS) didE = true; else didXYZ = true;
#elif HAS_POSITION_SHIFT
if (i == E_AXIS) didE = true;
#endif
} }
} }
} break; } break;
@ -81,11 +72,11 @@ void GcodeSuite::G92() {
d = v - current_position[i]; d = v - current_position[i];
if (!NEAR_ZERO(d)) { if (!NEAR_ZERO(d)) {
#if IS_SCARA || !HAS_POSITION_SHIFT #if IS_SCARA || !HAS_POSITION_SHIFT
if (i == E_AXIS) didE = true; else didXYZ = true; if (i == E_AXIS) sync_E = true; else sync_XYZ = true;
current_position[i] = v; // Without workspaces revert to Marlin 1.0 behavior current_position[i] = v; // Without workspaces revert to Marlin 1.0 behavior
#elif HAS_POSITION_SHIFT #elif HAS_POSITION_SHIFT
if (i == E_AXIS) { if (i == E_AXIS) {
didE = true; sync_E = true;
current_position.e = v; // When using coordinate spaces, only E is set directly current_position.e = v; // When using coordinate spaces, only E is set directly
} }
else { else {
@ -105,8 +96,8 @@ void GcodeSuite::G92() {
coordinate_system[active_coordinate_system] = position_shift; coordinate_system[active_coordinate_system] = position_shift;
#endif #endif
if (didXYZ) sync_plan_position(); if (sync_XYZ) sync_plan_position();
else if (didE) sync_plan_position_e(); else if (sync_E) sync_plan_position_e();
report_current_position(); report_current_position();
} }

Loading…
Cancel
Save