|
@@ -32,10 +32,8 @@
|
32
|
32
|
* G92: Set current position to given X Y Z E
|
33
|
33
|
*/
|
34
|
34
|
void GcodeSuite::G92() {
|
35
|
|
- bool didXYZ = false,
|
36
|
|
- didE = parser.seenval('E');
|
37
|
35
|
|
38
|
|
- if (!didE) stepper.synchronize();
|
|
36
|
+ stepper.synchronize();
|
39
|
37
|
|
40
|
38
|
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
41
|
39
|
switch (parser.subcode) {
|
|
@@ -60,27 +58,28 @@ void GcodeSuite::G92() {
|
60
|
58
|
#define IS_G92_0 true
|
61
|
59
|
#endif
|
62
|
60
|
|
|
61
|
+ bool didXYZ = false, didE = false;
|
|
62
|
+
|
63
|
63
|
if (IS_G92_0) LOOP_XYZE(i) {
|
64
|
64
|
if (parser.seenval(axis_codes[i])) {
|
65
|
|
- #if IS_SCARA
|
66
|
|
- current_position[i] = parser.value_axis_units((AxisEnum)i);
|
67
|
|
- if (i != E_AXIS) didXYZ = true;
|
68
|
|
- #else
|
69
|
|
- #if HAS_POSITION_SHIFT
|
70
|
|
- const float p = current_position[i];
|
71
|
|
- #endif
|
72
|
|
- const float v = parser.value_axis_units((AxisEnum)i);
|
73
|
|
-
|
74
|
|
- current_position[i] = v;
|
75
|
|
-
|
76
|
|
- if (i != E_AXIS) {
|
77
|
|
- didXYZ = true;
|
78
|
|
- #if HAS_POSITION_SHIFT
|
79
|
|
- position_shift[i] += v - p; // Offset the coordinate space
|
|
65
|
+ const float l = parser.value_axis_units((AxisEnum)i),
|
|
66
|
+ v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i),
|
|
67
|
+ d = v - current_position[i];
|
|
68
|
+ if (!NEAR_ZERO(d)) {
|
|
69
|
+ if (i == E_AXIS) didE = true; else didXYZ = true;
|
|
70
|
+ #if IS_SCARA
|
|
71
|
+ current_position[i] = v; // For SCARA just set the position directly
|
|
72
|
+ #elif HAS_POSITION_SHIFT
|
|
73
|
+ if (i == E_AXIS)
|
|
74
|
+ current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
|
|
75
|
+ else {
|
|
76
|
+ position_shift[i] += d; // Other axes simply offset the coordinate space
|
80
|
77
|
update_software_endstops((AxisEnum)i);
|
81
|
|
- #endif
|
82
|
|
- }
|
83
|
|
- #endif
|
|
78
|
+ }
|
|
79
|
+ #else
|
|
80
|
+ current_position[i] = v; // Without workspaces revert to Marlin 1.0 behavior
|
|
81
|
+ #endif
|
|
82
|
+ }
|
84
|
83
|
}
|
85
|
84
|
}
|
86
|
85
|
|