Merge pull request #8310 from thinkyhead/bf2_fixes_for_117

[2.0] Fix G92 for native workspace
This commit is contained in:
Scott Lahteine 2017-11-07 13:23:03 -06:00 committed by GitHub
commit 776cb52629
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 22 deletions

View File

@ -32,10 +32,8 @@
* G92: Set current position to given X Y Z E * G92: Set current position to given X Y Z E
*/ */
void GcodeSuite::G92() { void GcodeSuite::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) {
@ -60,27 +58,28 @@ void GcodeSuite::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 l = parser.value_axis_units((AxisEnum)i),
v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i),
d = v - current_position[i];
if (!NEAR_ZERO(d)) {
if (i == E_AXIS) didE = true; else didXYZ = true;
#if IS_SCARA #if IS_SCARA
current_position[i] = parser.value_axis_units((AxisEnum)i); current_position[i] = v; // For SCARA just set the position directly
if (i != E_AXIS) didXYZ = true; #elif HAS_POSITION_SHIFT
#else if (i == E_AXIS)
#if HAS_POSITION_SHIFT current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
const float p = current_position[i]; else {
#endif position_shift[i] += d; // Other axes simply offset the coordinate space
const float v = parser.value_axis_units((AxisEnum)i);
current_position[i] = v;
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
} }
} }

View File

@ -53,7 +53,7 @@
#define MSG_LEVEL_BED_WAITING _UxGT("Klick für Start") #define MSG_LEVEL_BED_WAITING _UxGT("Klick für Start")
#define MSG_LEVEL_BED_NEXT_POINT _UxGT("Nächste Koordinate") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Nächste Koordinate")
#define MSG_LEVEL_BED_DONE _UxGT("Fertig") #define MSG_LEVEL_BED_DONE _UxGT("Fertig")
#define MSG_Z_FADE_HEIGHT _UxGT("Niv. Ausblendhöhe") #define MSG_Z_FADE_HEIGHT _UxGT("Ausblendhöhe")
#define MSG_SET_HOME_OFFSETS _UxGT("Setze Homeversatz") #define MSG_SET_HOME_OFFSETS _UxGT("Setze Homeversatz")
#define MSG_HOME_OFFSETS_APPLIED _UxGT("Homeversatz aktiv") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Homeversatz aktiv")
#define MSG_SET_ORIGIN _UxGT("Setze Nullpunkt") //"G92 X0 Y0 Z0" commented out in ultralcd.cpp #define MSG_SET_ORIGIN _UxGT("Setze Nullpunkt") //"G92 X0 Y0 Z0" commented out in ultralcd.cpp
@ -77,6 +77,8 @@
#define MSG_MOVE_AXIS _UxGT("Bewegen") #define MSG_MOVE_AXIS _UxGT("Bewegen")
#define MSG_BED_LEVELING _UxGT("Bett Nivellierung") #define MSG_BED_LEVELING _UxGT("Bett Nivellierung")
#define MSG_LEVEL_BED _UxGT("Bett nivellieren") #define MSG_LEVEL_BED _UxGT("Bett nivellieren")
#define MSG_LEVEL_CORNERS _UxGT("Ecken nivellieren")
#define MSG_NEXT_CORNER _UxGT("Nächste Ecke")
#define MSG_EDITING_STOPPED _UxGT("Netzbearb. angeh.") #define MSG_EDITING_STOPPED _UxGT("Netzbearb. angeh.")
#define MSG_USER_MENU _UxGT("Benutzer Menü") #define MSG_USER_MENU _UxGT("Benutzer Menü")
#define MSG_MOVING _UxGT("In Bewegung...") #define MSG_MOVING _UxGT("In Bewegung...")