Quellcode durchsuchen

Delta support for multiple hotends with offsets (#10118)

Scott Lahteine vor 7 Jahren
Ursprung
Commit
a6feb58837
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden

+ 4
- 2
Marlin/src/gcode/calibrate/G28.cpp Datei anzeigen

191
 
191
 
192
   // Always home with tool 0 active
192
   // Always home with tool 0 active
193
   #if HOTENDS > 1
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
     tool_change(0, 0, true);
197
     tool_change(0, 0, true);
196
   #endif
198
   #endif
197
 
199
 
331
   clean_up_after_endstop_or_probe_move();
333
   clean_up_after_endstop_or_probe_move();
332
 
334
 
333
   // Restore the active tool after homing
335
   // Restore the active tool after homing
334
-  #if HOTENDS > 1
336
+  #if HOTENDS > 1 && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE))
335
     #if ENABLED(PARKING_EXTRUDER)
337
     #if ENABLED(PARKING_EXTRUDER)
336
       #define NO_FETCH false // fetch the previous toolhead
338
       #define NO_FETCH false // fetch the previous toolhead
337
     #else
339
     #else

+ 5
- 0
Marlin/src/gcode/config/M218.cpp Datei anzeigen

70
     }
70
     }
71
     SERIAL_EOL();
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
 #endif // HOTENDS > 1
80
 #endif // HOTENDS > 1

+ 1
- 1
Marlin/src/gcode/feature/pause/M125.cpp Datei anzeigen

65
   // Lift Z axis
65
   // Lift Z axis
66
   if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
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
     park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0);
69
     park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0);
70
     park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0);
70
     park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0);
71
   #endif
71
   #endif

+ 1
- 1
Marlin/src/gcode/feature/pause/M600.cpp Datei anzeigen

87
   // Lift Z axis
87
   // Lift Z axis
88
   if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
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
     park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0);
91
     park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0);
92
     park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0);
92
     park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0);
93
   #endif
93
   #endif

+ 19
- 8
Marlin/src/module/delta.cpp Datei anzeigen

115
   }
115
   }
116
 #endif
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
     SERIAL_ECHOPAIR("delta A:", delta[A_AXIS]);   \
122
     SERIAL_ECHOPAIR("delta A:", delta[A_AXIS]);   \
123
     SERIAL_ECHOPAIR(" B:", delta[B_AXIS]);        \
123
     SERIAL_ECHOPAIR(" B:", delta[B_AXIS]);        \
124
     SERIAL_ECHOLNPAIR(" C:", delta[C_AXIS]);      \
124
     SERIAL_ECHOLNPAIR(" C:", delta[C_AXIS]);      \
125
   }while(0)
125
   }while(0)
126
 
126
 
127
 void inverse_kinematics(const float raw[XYZ]) {
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
 float delta_safe_distance_from_top() {
147
 float delta_safe_distance_from_top() {
137
   float cartesian[XYZ] = { 0, 0, 0 };
148
   float cartesian[XYZ] = { 0, 0, 0 };
138
   inverse_kinematics(cartesian);
149
   inverse_kinematics(cartesian);
139
-  float distance = delta[A_AXIS];
150
+  float centered_extent = delta[A_AXIS];
140
   cartesian[Y_AXIS] = DELTA_PRINTABLE_RADIUS;
151
   cartesian[Y_AXIS] = DELTA_PRINTABLE_RADIUS;
141
   inverse_kinematics(cartesian);
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 Datei anzeigen

610
 
610
 
611
       LOOP_XYZE(i) raw[i] += segment_distance[i];
611
       LOOP_XYZE(i) raw[i] += segment_distance[i];
612
 
612
 
613
-      #if ENABLED(DELTA)
613
+      #if ENABLED(DELTA) && HOTENDS < 2
614
         DELTA_IK(raw); // Delta can inline its kinematics
614
         DELTA_IK(raw); // Delta can inline its kinematics
615
       #else
615
       #else
616
         inverse_kinematics(raw);
616
         inverse_kinematics(raw);

+ 15
- 2
Marlin/src/module/tool_change.cpp Datei anzeigen

382
             const float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder],
382
             const float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder],
383
                         z_raise = 0.3 + (z_diff > 0.0 ? z_diff : 0.0);
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
             current_position[Z_AXIS] += z_raise;
386
             current_position[Z_AXIS] += z_raise;
387
             planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
387
             planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
388
             move_nozzle_servo(tmp_extruder);
388
             move_nozzle_servo(tmp_extruder);
492
         // Tell the planner the new "current position"
492
         // Tell the planner the new "current position"
493
         SYNC_PLAN_POSITION_KINEMATIC();
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
         // Move to the "old position" (move the extruder into place)
507
         // Move to the "old position" (move the extruder into place)
496
         #if ENABLED(SWITCHING_NOZZLE)
508
         #if ENABLED(SWITCHING_NOZZLE)
497
           destination[Z_AXIS] += z_diff;  // Include the Z restore with the "move back"
509
           destination[Z_AXIS] += z_diff;  // Include the Z restore with the "move back"
498
         #endif
510
         #endif
499
-        if (!no_move && IsRunning()) {
511
+
512
+        if (safe_to_move && !no_move && IsRunning()) {
500
           #if ENABLED(DEBUG_LEVELING_FEATURE)
513
           #if ENABLED(DEBUG_LEVELING_FEATURE)
501
             if (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination);
514
             if (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination);
502
           #endif
515
           #endif

Laden…
Abbrechen
Speichern