Browse Source

G12 E soft endstops parameter (#17788)

Scott Lahteine 4 years ago
parent
commit
2d758663db
No account linked to committer's email address

+ 0
- 2
Marlin/src/gcode/calibrate/G425.cpp View File

@@ -92,8 +92,6 @@ struct measurements_t {
92 92
   xy_float_t nozzle_outer_dimension = nod;
93 93
 };
94 94
 
95
-#define TEMPORARY_SOFT_ENDSTOP_STATE(enable) REMEMBER(tes, soft_endstops_enabled, enable);
96
-
97 95
 #if ENABLED(BACKLASH_GCODE)
98 96
   #define TEMPORARY_BACKLASH_CORRECTION(value) REMEMBER(tbst, backlash.correction, value)
99 97
 #else

+ 9
- 4
Marlin/src/gcode/feature/clean/G12.cpp View File

@@ -37,6 +37,11 @@
37 37
 
38 38
 /**
39 39
  * G12: Clean the nozzle
40
+ *
41
+ *  E<bool>          : 0=Never or 1=Always apply the "software endstop" limits
42
+ *  P0 S<strokes>    : Stroke cleaning with S strokes
43
+ *  P1 Sn T<objects> : Zigzag cleaning with S repeats and T zigzags
44
+ *  P2 Sn R<radius>  : Circle cleaning with S repeats and R radius
40 45
  */
41 46
 void GcodeSuite::G12() {
42 47
   // Don't allow nozzle cleaning without homing first
@@ -45,14 +50,12 @@ void GcodeSuite::G12() {
45 50
   const uint8_t pattern = parser.ushortval('P', 0),
46 51
                 strokes = parser.ushortval('S', NOZZLE_CLEAN_STROKES),
47 52
                 objects = parser.ushortval('T', NOZZLE_CLEAN_TRIANGLES);
48
-  const float radius = parser.floatval('R', NOZZLE_CLEAN_CIRCLE_RADIUS);
53
+  const float radius = parser.linearval('R', NOZZLE_CLEAN_CIRCLE_RADIUS);
49 54
 
50 55
   const bool seenxyz = parser.seen("XYZ");
51 56
   const uint8_t cleans =  (!seenxyz || parser.boolval('X') ? _BV(X_AXIS) : 0)
52 57
                         | (!seenxyz || parser.boolval('Y') ? _BV(Y_AXIS) : 0)
53
-                        #if DISABLED(NOZZLE_CLEAN_NO_Z)
54
-                          | (!seenxyz || parser.boolval('Z') ? _BV(Z_AXIS) : 0)
55
-                        #endif
58
+                        | TERN(NOZZLE_CLEAN_NO_Z, 0, (!seenxyz || parser.boolval('Z') ? _BV(Z_AXIS) : 0))
56 59
                       ;
57 60
 
58 61
   #if HAS_LEVELING
@@ -60,6 +63,8 @@ void GcodeSuite::G12() {
60 63
     TEMPORARY_BED_LEVELING_STATE(!TEST(cleans, Z_AXIS) && planner.leveling_active);
61 64
   #endif
62 65
 
66
+  TEMPORARY_SOFT_ENDSTOP_STATE(parser.boolval('E'));
67
+
63 68
   nozzle.clean(pattern, strokes, radius, objects, cleans);
64 69
 }
65 70
 

+ 13
- 11
Marlin/src/libs/nozzle.cpp View File

@@ -152,18 +152,20 @@ Nozzle nozzle;
152 152
         LIMIT(   end[arrPos].A, soft_endstop.min.A, soft_endstop.max.A); \
153 153
       }while(0)
154 154
 
155
-      LIMIT_AXIS(x);
156
-      LIMIT_AXIS(y);
157
-      LIMIT_AXIS(z);
155
+      if (soft_endstops_enabled) {
156
+
157
+        LIMIT_AXIS(x);
158
+        LIMIT_AXIS(y);
159
+        LIMIT_AXIS(z);
160
+        const bool radiusOutOfRange = (middle[arrPos].x + radius > soft_endstop.max.x)
161
+                                   || (middle[arrPos].x - radius < soft_endstop.min.x)
162
+                                   || (middle[arrPos].y + radius > soft_endstop.max.y)
163
+                                   || (middle[arrPos].y - radius < soft_endstop.min.y);
164
+        if (radiusOutOfRange && pattern == 2) {
165
+          SERIAL_ECHOLNPGM("Warning: Radius Out of Range");
166
+          return;
167
+        }
158 168
 
159
-      const bool radiusOutOfRange = (middle[arrPos].x + radius > soft_endstop.max.x)
160
-                                 || (middle[arrPos].x - radius < soft_endstop.min.x)
161
-                                 || (middle[arrPos].y + radius > soft_endstop.max.y)
162
-                                 || (middle[arrPos].y - radius < soft_endstop.min.y);
163
-
164
-      if (radiusOutOfRange && pattern == 2) {
165
-        SERIAL_ECHOLNPGM("Warning: Radius Out of Range");
166
-        return;
167 169
       }
168 170
 
169 171
     #endif

+ 2
- 0
Marlin/src/module/motion.h View File

@@ -152,6 +152,7 @@ typedef struct { xyz_pos_t min, max; } axis_limits_t;
152 152
       , const uint8_t old_tool_index=0, const uint8_t new_tool_index=0
153 153
     #endif
154 154
   );
155
+  #define TEMPORARY_SOFT_ENDSTOP_STATE(enable) REMEMBER(tes, soft_endstops_enabled, enable);
155 156
 #else
156 157
   constexpr bool soft_endstops_enabled = false;
157 158
   //constexpr axis_limits_t soft_endstop = {
@@ -159,6 +160,7 @@ typedef struct { xyz_pos_t min, max; } axis_limits_t;
159 160
   //  { X_MAX_POS, Y_MAX_POS, Z_MAX_POS } };
160 161
   #define apply_motion_limits(V)    NOOP
161 162
   #define update_software_endstops(...) NOOP
163
+  #define TEMPORARY_SOFT_ENDSTOP_STATE(...) NOOP
162 164
 #endif
163 165
 
164 166
 void report_real_position();

Loading…
Cancel
Save