浏览代码

Delta support for multiple hotends with offsets (#10118)

Scott Lahteine 7 年前
父节点
当前提交
a6feb58837
没有帐户链接到提交者的电子邮件

+ 4
- 2
Marlin/src/gcode/calibrate/G28.cpp 查看文件

@@ -191,7 +191,9 @@ void GcodeSuite::G28(const bool always_home_all) {
191 191
 
192 192
   // Always home with tool 0 active
193 193
   #if HOTENDS > 1
194
-    const uint8_t old_tool_index = active_extruder;
194
+    #if DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)
195
+      const uint8_t old_tool_index = active_extruder;
196
+    #endif
195 197
     tool_change(0, 0, true);
196 198
   #endif
197 199
 
@@ -331,7 +333,7 @@ void GcodeSuite::G28(const bool always_home_all) {
331 333
   clean_up_after_endstop_or_probe_move();
332 334
 
333 335
   // Restore the active tool after homing
334
-  #if HOTENDS > 1
336
+  #if HOTENDS > 1 && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE))
335 337
     #if ENABLED(PARKING_EXTRUDER)
336 338
       #define NO_FETCH false // fetch the previous toolhead
337 339
     #else

+ 5
- 0
Marlin/src/gcode/config/M218.cpp 查看文件

@@ -70,6 +70,11 @@ void GcodeSuite::M218() {
70 70
     }
71 71
     SERIAL_EOL();
72 72
   }
73
+
74
+  #if ENABLED(DELTA)
75
+    if (target_extruder == active_extruder)
76
+      do_blocking_move_to_xy(current_position[X_AXIS], current_position[Y_AXIS], planner.max_feedrate_mm_s[X_AXIS]);
77
+  #endif
73 78
 }
74 79
 
75 80
 #endif // HOTENDS > 1

+ 1
- 1
Marlin/src/gcode/feature/pause/M125.cpp 查看文件

@@ -65,7 +65,7 @@ void GcodeSuite::M125() {
65 65
   // Lift Z axis
66 66
   if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
67 67
 
68
-  #if HOTENDS > 1 && DISABLED(DUAL_X_CARRIAGE)
68
+  #if HOTENDS > 1 && DISABLED(DUAL_X_CARRIAGE) && DISABLED(DELTA)
69 69
     park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0);
70 70
     park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0);
71 71
   #endif

+ 1
- 1
Marlin/src/gcode/feature/pause/M600.cpp 查看文件

@@ -87,7 +87,7 @@ void GcodeSuite::M600() {
87 87
   // Lift Z axis
88 88
   if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
89 89
 
90
-  #if HOTENDS > 1 && DISABLED(DUAL_X_CARRIAGE)
90
+  #if HOTENDS > 1 && DISABLED(DUAL_X_CARRIAGE) && DISABLED(DELTA)
91 91
     park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0);
92 92
     park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0);
93 93
   #endif

+ 19
- 8
Marlin/src/module/delta.cpp 查看文件

@@ -115,18 +115,29 @@ void recalc_delta_settings() {
115 115
   }
116 116
 #endif
117 117
 
118
-#define DELTA_DEBUG() do { \
119
-    SERIAL_ECHOPAIR("cartesian X:", raw[X_AXIS]); \
120
-    SERIAL_ECHOPAIR(" Y:", raw[Y_AXIS]);          \
121
-    SERIAL_ECHOLNPAIR(" Z:", raw[Z_AXIS]);        \
118
+#define DELTA_DEBUG(VAR) do { \
119
+    SERIAL_ECHOPAIR("cartesian X:", VAR[X_AXIS]); \
120
+    SERIAL_ECHOPAIR(" Y:", VAR[Y_AXIS]);          \
121
+    SERIAL_ECHOLNPAIR(" Z:", VAR[Z_AXIS]);        \
122 122
     SERIAL_ECHOPAIR("delta A:", delta[A_AXIS]);   \
123 123
     SERIAL_ECHOPAIR(" B:", delta[B_AXIS]);        \
124 124
     SERIAL_ECHOLNPAIR(" C:", delta[C_AXIS]);      \
125 125
   }while(0)
126 126
 
127 127
 void inverse_kinematics(const float raw[XYZ]) {
128
-  DELTA_IK(raw);
129
-  // DELTA_DEBUG();
128
+  #if HOTENDS > 1
129
+    // Delta hotend offsets must be applied in Cartesian space with no "spoofing"
130
+    const float pos[XYZ] = {
131
+      raw[X_AXIS] - hotend_offset[X_AXIS][active_extruder],
132
+      raw[Y_AXIS] - hotend_offset[Y_AXIS][active_extruder],
133
+      raw[Z_AXIS]
134
+    };
135
+    DELTA_IK(pos);
136
+    //DELTA_DEBUG(pos);
137
+  #else
138
+    DELTA_IK(raw);
139
+    //DELTA_DEBUG(raw);
140
+  #endif
130 141
 }
131 142
 
132 143
 /**
@@ -136,10 +147,10 @@ void inverse_kinematics(const float raw[XYZ]) {
136 147
 float delta_safe_distance_from_top() {
137 148
   float cartesian[XYZ] = { 0, 0, 0 };
138 149
   inverse_kinematics(cartesian);
139
-  float distance = delta[A_AXIS];
150
+  float centered_extent = delta[A_AXIS];
140 151
   cartesian[Y_AXIS] = DELTA_PRINTABLE_RADIUS;
141 152
   inverse_kinematics(cartesian);
142
-  return FABS(distance - delta[A_AXIS]);
153
+  return FABS(centered_extent - delta[A_AXIS]);
143 154
 }
144 155
 
145 156
 /**

+ 1
- 1
Marlin/src/module/motion.cpp 查看文件

@@ -610,7 +610,7 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
610 610
 
611 611
       LOOP_XYZE(i) raw[i] += segment_distance[i];
612 612
 
613
-      #if ENABLED(DELTA)
613
+      #if ENABLED(DELTA) && HOTENDS < 2
614 614
         DELTA_IK(raw); // Delta can inline its kinematics
615 615
       #else
616 616
         inverse_kinematics(raw);

+ 15
- 2
Marlin/src/module/tool_change.cpp 查看文件

@@ -382,7 +382,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
382 382
             const float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder],
383 383
                         z_raise = 0.3 + (z_diff > 0.0 ? z_diff : 0.0);
384 384
 
385
-            // Always raise by some amount (destination copied from current_position earlier)
385
+            // Always raise by some amount
386 386
             current_position[Z_AXIS] += z_raise;
387 387
             planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
388 388
             move_nozzle_servo(tmp_extruder);
@@ -492,11 +492,24 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
492 492
         // Tell the planner the new "current position"
493 493
         SYNC_PLAN_POSITION_KINEMATIC();
494 494
 
495
+        #if ENABLED(DELTA)
496
+          //LOOP_XYZ(i) update_software_endstops(i); // or modify the constrain function
497
+          // Do a small lift to avoid the workpiece in the move back (below)
498
+          const bool safe_to_move = current_position[Z_AXIS] < delta_clip_start_height - 1;
499
+          if (safe_to_move && !no_move && IsRunning()) {
500
+            ++current_position[Z_AXIS];
501
+            planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
502
+          }
503
+        #else
504
+          constexpr bool safe_to_move = true;
505
+        #endif
506
+ 
495 507
         // Move to the "old position" (move the extruder into place)
496 508
         #if ENABLED(SWITCHING_NOZZLE)
497 509
           destination[Z_AXIS] += z_diff;  // Include the Z restore with the "move back"
498 510
         #endif
499
-        if (!no_move && IsRunning()) {
511
+
512
+        if (safe_to_move && !no_move && IsRunning()) {
500 513
           #if ENABLED(DEBUG_LEVELING_FEATURE)
501 514
             if (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination);
502 515
           #endif

正在加载...
取消
保存