|
@@ -33,12 +33,7 @@
|
33
|
33
|
*/
|
34
|
34
|
void GcodeSuite::G92() {
|
35
|
35
|
|
36
|
|
- bool didE = false;
|
37
|
|
- #if IS_SCARA || !HAS_POSITION_SHIFT
|
38
|
|
- bool didXYZ = false;
|
39
|
|
- #else
|
40
|
|
- constexpr bool didXYZ = false;
|
41
|
|
- #endif
|
|
36
|
+ bool sync_E = false, sync_XYZ = false;
|
42
|
37
|
|
43
|
38
|
#if USE_GCODE_SUBCODES
|
44
|
39
|
const uint8_t subcode_G92 = parser.subcode;
|
|
@@ -64,11 +59,7 @@ void GcodeSuite::G92() {
|
64
|
59
|
LOOP_XYZE(i) {
|
65
|
60
|
if (parser.seenval(axis_codes[i])) {
|
66
|
61
|
current_position[i] = parser.value_axis_units((AxisEnum)i);
|
67
|
|
- #if IS_SCARA || !HAS_POSITION_SHIFT
|
68
|
|
- if (i == E_AXIS) didE = true; else didXYZ = true;
|
69
|
|
- #elif HAS_POSITION_SHIFT
|
70
|
|
- if (i == E_AXIS) didE = true;
|
71
|
|
- #endif
|
|
62
|
+ if (i == E_AXIS) sync_E = true; else sync_XYZ = true;
|
72
|
63
|
}
|
73
|
64
|
}
|
74
|
65
|
} break;
|
|
@@ -81,11 +72,11 @@ void GcodeSuite::G92() {
|
81
|
72
|
d = v - current_position[i];
|
82
|
73
|
if (!NEAR_ZERO(d)) {
|
83
|
74
|
#if IS_SCARA || !HAS_POSITION_SHIFT
|
84
|
|
- if (i == E_AXIS) didE = true; else didXYZ = true;
|
|
75
|
+ if (i == E_AXIS) sync_E = true; else sync_XYZ = true;
|
85
|
76
|
current_position[i] = v; // Without workspaces revert to Marlin 1.0 behavior
|
86
|
77
|
#elif HAS_POSITION_SHIFT
|
87
|
78
|
if (i == E_AXIS) {
|
88
|
|
- didE = true;
|
|
79
|
+ sync_E = true;
|
89
|
80
|
current_position.e = v; // When using coordinate spaces, only E is set directly
|
90
|
81
|
}
|
91
|
82
|
else {
|
|
@@ -105,8 +96,8 @@ void GcodeSuite::G92() {
|
105
|
96
|
coordinate_system[active_coordinate_system] = position_shift;
|
106
|
97
|
#endif
|
107
|
98
|
|
108
|
|
- if (didXYZ) sync_plan_position();
|
109
|
|
- else if (didE) sync_plan_position_e();
|
|
99
|
+ if (sync_XYZ) sync_plan_position();
|
|
100
|
+ else if (sync_E) sync_plan_position_e();
|
110
|
101
|
|
111
|
102
|
report_current_position();
|
112
|
103
|
}
|