Browse Source

Merge pull request #8310 from thinkyhead/bf2_fixes_for_117

[2.0] Fix G92 for native workspace
Scott Lahteine 7 years ago
parent
commit
776cb52629
No account linked to committer's email address
2 changed files with 23 additions and 22 deletions
  1. 20
    21
      Marlin/src/gcode/geometry/G92.cpp
  2. 3
    1
      Marlin/src/lcd/language/language_de.h

+ 20
- 21
Marlin/src/gcode/geometry/G92.cpp View File

@@ -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
 

+ 3
- 1
Marlin/src/lcd/language/language_de.h View File

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

Loading…
Cancel
Save