Procházet zdrojové kódy

G12 defaults per tool. Event G-code for post-toolchange (#16554)

InsanityAutomation před 4 roky
rodič
revize
79810b7fcb

+ 4
- 3
Marlin/Configuration.h Zobrazit soubor

1524
   // Default number of triangles
1524
   // Default number of triangles
1525
   #define NOZZLE_CLEAN_TRIANGLES  3
1525
   #define NOZZLE_CLEAN_TRIANGLES  3
1526
 
1526
 
1527
-  // Specify positions as { X, Y, Z }
1528
-  #define NOZZLE_CLEAN_START_POINT {  30, 30, (Z_MIN_POS + 1) }
1529
-  #define NOZZLE_CLEAN_END_POINT   { 100, 60, (Z_MIN_POS + 1) }
1527
+  // Specify positions for each tool as { { X, Y, Z }, { X, Y, Z } }
1528
+  // Dual hotend system may use { {  -20, (Y_BED_SIZE / 2), (Z_MIN_POS + 1) },  {  420, (Y_BED_SIZE / 2), (Z_MIN_POS + 1) }}
1529
+  #define NOZZLE_CLEAN_START_POINT { {  30, 30, (Z_MIN_POS + 1) } }
1530
+  #define NOZZLE_CLEAN_END_POINT   { { 100, 60, (Z_MIN_POS + 1) } }
1530
 
1531
 
1531
   // Circular pattern radius
1532
   // Circular pattern radius
1532
   #define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5
1533
   #define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5

+ 3
- 0
Marlin/Configuration_adv.h Zobrazit soubor

1771
   // Z raise distance for tool-change, as needed for some extruders
1771
   // Z raise distance for tool-change, as needed for some extruders
1772
   #define TOOLCHANGE_ZRAISE     2  // (mm)
1772
   #define TOOLCHANGE_ZRAISE     2  // (mm)
1773
   //#define TOOLCHANGE_NO_RETURN   // Never return to the previous position on tool-change
1773
   //#define TOOLCHANGE_NO_RETURN   // Never return to the previous position on tool-change
1774
+  #if ENABLED(TOOLCHANGE_NO_RETURN)
1775
+    //#define EVENT_GCODE_AFTER_TOOLCHANGE "G12X"   // G-code to run after tool-change is complete
1776
+  #endif
1774
 
1777
 
1775
   // Retract and prime filament on tool-change
1778
   // Retract and prime filament on tool-change
1776
   //#define TOOLCHANGE_FILAMENT_SWAP
1779
   //#define TOOLCHANGE_FILAMENT_SWAP

+ 7
- 9
Marlin/src/libs/nozzle.cpp Zobrazit soubor

157
    * @param argument depends on the cleaning pattern
157
    * @param argument depends on the cleaning pattern
158
    */
158
    */
159
   void Nozzle::clean(const uint8_t &pattern, const uint8_t &strokes, const float &radius, const uint8_t &objects, const uint8_t cleans) {
159
   void Nozzle::clean(const uint8_t &pattern, const uint8_t &strokes, const float &radius, const uint8_t &objects, const uint8_t cleans) {
160
-    xyz_pos_t start = NOZZLE_CLEAN_START_POINT, end = NOZZLE_CLEAN_END_POINT;
160
+    xyz_pos_t start[HOTENDS] = NOZZLE_CLEAN_START_POINT, end[HOTENDS] = NOZZLE_CLEAN_END_POINT, middle[HOTENDS] = NOZZLE_CLEAN_CIRCLE_MIDDLE;
161
 
161
 
162
     if (pattern == 2) {
162
     if (pattern == 2) {
163
       if (!(cleans & (_BV(X_AXIS) | _BV(Y_AXIS)))) {
163
       if (!(cleans & (_BV(X_AXIS) | _BV(Y_AXIS)))) {
164
         SERIAL_ECHOLNPGM("Warning : Clean Circle requires XY");
164
         SERIAL_ECHOLNPGM("Warning : Clean Circle requires XY");
165
         return;
165
         return;
166
       }
166
       }
167
-      constexpr xyz_pos_t middle NOZZLE_CLEAN_CIRCLE_MIDDLE;
168
-      end = middle;
169
     }
167
     }
170
     else {
168
     else {
171
-      if (!TEST(cleans, X_AXIS)) start.x = end.x = current_position.x;
172
-      if (!TEST(cleans, Y_AXIS)) start.y = end.y = current_position.y;
169
+      if (!TEST(cleans, X_AXIS)) start[active_extruder].x = end[active_extruder].x = current_position.x;
170
+      if (!TEST(cleans, Y_AXIS)) start[active_extruder].y = end[active_extruder].y = current_position.y;
173
     }
171
     }
174
-    if (!TEST(cleans, Z_AXIS)) start.z = end.z = current_position.z;
172
+    if (!TEST(cleans, Z_AXIS)) start[active_extruder].z = end[active_extruder].z = current_position.z;
175
 
173
 
176
     switch (pattern) {
174
     switch (pattern) {
177
-       case 1: zigzag(start, end, strokes, objects); break;
178
-       case 2: circle(start, end, strokes, radius);  break;
179
-      default: stroke(start, end, strokes);
175
+       case 1: zigzag(start[active_extruder], end[active_extruder], strokes, objects); break;
176
+       case 2: circle(start[active_extruder], middle[active_extruder], strokes, radius);  break;
177
+      default: stroke(start[active_extruder], end[active_extruder], strokes);
180
     }
178
     }
181
   }
179
   }
182
 
180
 

+ 4
- 0
Marlin/src/module/tool_change.cpp Zobrazit soubor

1067
       fanmux_switch(active_extruder);
1067
       fanmux_switch(active_extruder);
1068
     #endif
1068
     #endif
1069
 
1069
 
1070
+    #ifdef EVENT_GCODE_AFTER_TOOLCHANGE
1071
+      gcode.process_subcommands_now_P(EVENT_GCODE_AFTER_TOOLCHANGE);
1072
+    #endif
1073
+
1070
     SERIAL_ECHO_START();
1074
     SERIAL_ECHO_START();
1071
     SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, int(active_extruder));
1075
     SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, int(active_extruder));
1072
 
1076
 

Loading…
Zrušit
Uložit