1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-25 04:48:31 +00:00

Merge pull request #8309 from thinkyhead/bf1_fixes_for_117

[1.1] Fix G92 for native workspace
This commit is contained in:
Scott Lahteine 2017-11-07 12:52:55 -06:00 committed by GitHub
commit 8e18e05d1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6270,10 +6270,8 @@ void home_all_axes() { gcode_G28(true); }
* G92: Set current position to given X Y Z E * G92: Set current position to given X Y Z E
*/ */
inline void gcode_G92() { inline void gcode_G92() {
bool didXYZ = false,
didE = parser.seenval('E');
if (!didE) stepper.synchronize(); stepper.synchronize();
#if ENABLED(CNC_COORDINATE_SYSTEMS) #if ENABLED(CNC_COORDINATE_SYSTEMS)
switch (parser.subcode) { switch (parser.subcode) {
@ -6298,24 +6296,27 @@ inline void gcode_G92() {
#define IS_G92_0 true #define IS_G92_0 true
#endif #endif
bool didXYZ = false, didE = false;
if (IS_G92_0) LOOP_XYZE(i) { if (IS_G92_0) LOOP_XYZE(i) {
if (parser.seenval(axis_codes[i])) { if (parser.seenval(axis_codes[i])) {
const float v = parser.value_axis_units((AxisEnum)i),
d = current_position[i] - v;
if (d) {
if (i == E_AXIS) didE = true; else didXYZ = true;
#if IS_SCARA #if IS_SCARA
if (i != E_AXIS) didXYZ = true; current_position[i] = v; // For SCARA just set the position directly
#else #elif HAS_POSITION_SHIFT
#if HAS_POSITION_SHIFT if (i == E_AXIS)
const float p = current_position[i]; current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
#endif else {
const float v = parser.value_axis_units((AxisEnum)i); position_shift[i] += d; // Other axes simply offset the coordinate space
if (i != E_AXIS) {
didXYZ = true;
#if HAS_POSITION_SHIFT
position_shift[i] += v - p; // Offset the coordinate space
update_software_endstops((AxisEnum)i); update_software_endstops((AxisEnum)i);
}
#else
current_position[i] = v; // Without workspaces revert to Marlin 1.0 behavior
#endif #endif
} }
#endif
} }
} }