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
   xy_float_t nozzle_outer_dimension = nod;
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
 #if ENABLED(BACKLASH_GCODE)
95
 #if ENABLED(BACKLASH_GCODE)
98
   #define TEMPORARY_BACKLASH_CORRECTION(value) REMEMBER(tbst, backlash.correction, value)
96
   #define TEMPORARY_BACKLASH_CORRECTION(value) REMEMBER(tbst, backlash.correction, value)
99
 #else
97
 #else

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

37
 
37
 
38
 /**
38
 /**
39
  * G12: Clean the nozzle
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
 void GcodeSuite::G12() {
46
 void GcodeSuite::G12() {
42
   // Don't allow nozzle cleaning without homing first
47
   // Don't allow nozzle cleaning without homing first
45
   const uint8_t pattern = parser.ushortval('P', 0),
50
   const uint8_t pattern = parser.ushortval('P', 0),
46
                 strokes = parser.ushortval('S', NOZZLE_CLEAN_STROKES),
51
                 strokes = parser.ushortval('S', NOZZLE_CLEAN_STROKES),
47
                 objects = parser.ushortval('T', NOZZLE_CLEAN_TRIANGLES);
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
   const bool seenxyz = parser.seen("XYZ");
55
   const bool seenxyz = parser.seen("XYZ");
51
   const uint8_t cleans =  (!seenxyz || parser.boolval('X') ? _BV(X_AXIS) : 0)
56
   const uint8_t cleans =  (!seenxyz || parser.boolval('X') ? _BV(X_AXIS) : 0)
52
                         | (!seenxyz || parser.boolval('Y') ? _BV(Y_AXIS) : 0)
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
   #if HAS_LEVELING
61
   #if HAS_LEVELING
60
     TEMPORARY_BED_LEVELING_STATE(!TEST(cleans, Z_AXIS) && planner.leveling_active);
63
     TEMPORARY_BED_LEVELING_STATE(!TEST(cleans, Z_AXIS) && planner.leveling_active);
61
   #endif
64
   #endif
62
 
65
 
66
+  TEMPORARY_SOFT_ENDSTOP_STATE(parser.boolval('E'));
67
+
63
   nozzle.clean(pattern, strokes, radius, objects, cleans);
68
   nozzle.clean(pattern, strokes, radius, objects, cleans);
64
 }
69
 }
65
 
70
 

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

152
         LIMIT(   end[arrPos].A, soft_endstop.min.A, soft_endstop.max.A); \
152
         LIMIT(   end[arrPos].A, soft_endstop.min.A, soft_endstop.max.A); \
153
       }while(0)
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
     #endif
171
     #endif

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

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

Loading…
Cancel
Save