Browse Source

Bug Fix: Switching extruder tool change leaves Z in wrong position

The tool_change function saves the current_position to the destination
array soon after starting.  Later in the switching extruder section, the
destination array is modified when moving the Z axis up & down.  A later
section of tool_change moves the head back to the “original location”
using the destination array.  This later section assumes that the
destination array hasn’t been modified.

The fix is to save the destination Z position and then restore it after
the Z movements have completed.

Going back to using the current_position array for the switching
extruder Z axis moves (and  leaving the destination array untouched)
doesn’t fix the problem.

This bug was introduced by the “Make tool_change kinematic compatible”
commit # 847429eff4 which was merged on 10
Oct 2016 as part of PR 4982.

This bug was discovered in Issue 5966.
Bob-the-Kuhn 8 years ago
parent
commit
685ed5393a
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      Marlin/Marlin_main.cpp

+ 5
- 3
Marlin/Marlin_main.cpp View File

7385
       if (nozzle_timed_out)
7385
       if (nozzle_timed_out)
7386
         lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_CLICK_TO_HEAT_NOZZLE);
7386
         lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_CLICK_TO_HEAT_NOZZLE);
7387
 
7387
 
7388
-      #if HAS_BUZZER 
7388
+      #if HAS_BUZZER
7389
         filament_change_beep();
7389
         filament_change_beep();
7390
       #endif
7390
       #endif
7391
 
7391
 
7445
     stepper.synchronize();
7445
     stepper.synchronize();
7446
 
7446
 
7447
     #if defined(FILAMENT_CHANGE_EXTRUDE_LENGTH) && FILAMENT_CHANGE_EXTRUDE_LENGTH > 0
7447
     #if defined(FILAMENT_CHANGE_EXTRUDE_LENGTH) && FILAMENT_CHANGE_EXTRUDE_LENGTH > 0
7448
-  
7448
+
7449
       do {
7449
       do {
7450
         // "Wait for filament extrude"
7450
         // "Wait for filament extrude"
7451
         lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_EXTRUDE);
7451
         lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_EXTRUDE);
8033
                   z_raise = 0.3 + (z_diff > 0.0 ? z_diff : 0.0);
8033
                   z_raise = 0.3 + (z_diff > 0.0 ? z_diff : 0.0);
8034
 
8034
 
8035
             // Always raise by some amount (destination copied from current_position earlier)
8035
             // Always raise by some amount (destination copied from current_position earlier)
8036
+            float save_Z = destination[Z_AXIS];  // save Z for later on
8036
             destination[Z_AXIS] += z_raise;
8037
             destination[Z_AXIS] += z_raise;
8037
             planner.buffer_line_kinematic(destination, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
8038
             planner.buffer_line_kinematic(destination, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
8038
             stepper.synchronize();
8039
             stepper.synchronize();
8046
               planner.buffer_line_kinematic(destination, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
8047
               planner.buffer_line_kinematic(destination, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
8047
               stepper.synchronize();
8048
               stepper.synchronize();
8048
             }
8049
             }
8050
+            destination[Z_AXIS] = save_Z;  // restore original Z position so the 'Move to the "old position"' is correct
8049
           #endif
8051
           #endif
8050
 
8052
 
8051
           /**
8053
           /**
10306
   #else
10308
   #else
10307
     #define M600_TEST true
10309
     #define M600_TEST true
10308
   #endif
10310
   #endif
10309
-             
10311
+
10310
   if (M600_TEST && stepper_inactive_time && ELAPSED(ms, previous_cmd_ms + stepper_inactive_time)
10312
   if (M600_TEST && stepper_inactive_time && ELAPSED(ms, previous_cmd_ms + stepper_inactive_time)
10311
       && !ignore_stepper_queue && !planner.blocks_queued()) {
10313
       && !ignore_stepper_queue && !planner.blocks_queued()) {
10312
     #if ENABLED(DISABLE_INACTIVE_X)
10314
     #if ENABLED(DISABLE_INACTIVE_X)

Loading…
Cancel
Save