Bladeren bron

Remove dual x-carriage functionality that could/should be implemented in slicer

Also added a couple of missed merge lines in homeaxis() from previous
commit.
Robert F-C 12 jaren geleden
bovenliggende
commit
39cd3dbdbe
2 gewijzigde bestanden met toevoegingen van 12 en 80 verwijderingen
  1. 0
    5
      Marlin/Configuration_adv.h
  2. 12
    75
      Marlin/Marlin_main.cpp

+ 0
- 5
Marlin/Configuration_adv.h Bestand weergeven

169
 #define X2_STEP_PIN 25
169
 #define X2_STEP_PIN 25
170
 #define X2_DIR_PIN 23
170
 #define X2_DIR_PIN 23
171
 
171
 
172
-// The following settings control the behaviour of the automatic parking and unparking of inactive extruder
173
-#define TOOLCHANGE_PARK_ZLIFT 0.1        // the distance to raise Z axis when parking an extruder
174
-#define TOOLCHANGE_UNPARK_ZLIFT 1        // the distance to raise Z axis when unparking an extruder
175
-#define TOOLCHANGE_UNPARK_SKIP_TRAVEL_MOVES // disable if slicer natively suports dual x-carriage mode. 
176
-    // When enabled this avoids unnecessary & inadvertant moves from the last position of old extruder. 
177
 #endif // DUAL_X_CARRIAGE
172
 #endif // DUAL_X_CARRIAGE
178
     
173
     
179
 //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
174
 //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:

+ 12
- 75
Marlin/Marlin_main.cpp Bestand weergeven

703
   return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR;
703
   return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR;
704
 }
704
 }
705
 
705
 
706
-static bool active_extruder_parked = false;
707
-static float raised_parked_position[NUM_AXIS];
708
-static unsigned long delayed_move_time = 0;
706
+static float inactive_x_carriage_pos = X2_MAX_POS;
709
 #endif     
707
 #endif     
710
 
708
 
711
 static void axis_is_at_home(int axis) {
709
 static void axis_is_at_home(int axis) {
745
       
743
       
746
     current_position[axis] = 0;
744
     current_position[axis] = 0;
747
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
745
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
748
-    destination[axis] = 1.5 * max_length(axis) * home_dir(axis);
746
+    destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
749
     feedrate = homing_feedrate[axis];
747
     feedrate = homing_feedrate[axis];
750
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
748
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
751
     st_synchronize();
749
     st_synchronize();
752
 
750
 
753
     current_position[axis] = 0;
751
     current_position[axis] = 0;
754
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
752
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
755
-    destination[axis] = -home_retract_mm(axis) * home_dir(axis);
753
+    destination[axis] = -home_retract_mm(axis) * axis_home_dir;
756
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
754
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
757
     st_synchronize();
755
     st_synchronize();
758
 
756
 
759
-    destination[axis] = 2*home_retract_mm(axis) * home_dir(axis);
757
+    destination[axis] = 2*home_retract_mm(axis) * axis_home_dir;
760
     feedrate = homing_feedrate[axis]/2 ;
758
     feedrate = homing_feedrate[axis]/2 ;
761
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
759
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
762
     st_synchronize();
760
     st_synchronize();
896
 
894
 
897
 #else // NOT DELTA
895
 #else // NOT DELTA
898
 
896
 
899
-          home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
897
+      home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
900
 
898
 
901
       #if Z_HOME_DIR > 0                      // If homing away from BED do Z first
899
       #if Z_HOME_DIR > 0                      // If homing away from BED do Z first
902
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
900
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
945
         int tmp_extruder = active_extruder;
943
         int tmp_extruder = active_extruder;
946
         active_extruder = !active_extruder;
944
         active_extruder = !active_extruder;
947
         HOMEAXIS(X);
945
         HOMEAXIS(X);
946
+        inactive_x_carriage_pos = current_position[X_AXIS];
948
         active_extruder = tmp_extruder;
947
         active_extruder = tmp_extruder;
949
-        active_extruder_parked = false; 
950
-        delayed_move_time = 0;
951
       #endif         
948
       #endif         
952
         HOMEAXIS(X);
949
         HOMEAXIS(X);
953
       }
950
       }
2061
         // Save current position to return to after applying extruder offset
2058
         // Save current position to return to after applying extruder offset
2062
         memcpy(destination, current_position, sizeof(destination));
2059
         memcpy(destination, current_position, sizeof(destination));
2063
       #ifdef DUAL_X_CARRIAGE
2060
       #ifdef DUAL_X_CARRIAGE
2064
-        if (Stopped == false && delayed_move_time == 0 && current_position[X_AXIS] != x_home_pos(active_extruder))
2065
-        {
2066
-          // Park old head: 1) raise 2) move to park position 3) lower
2067
-          plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT, 
2068
-                current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
2069
-          plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT, 
2070
-                current_position[E_AXIS], max_feedrate[X_AXIS], active_extruder);
2071
-          plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS], 
2072
-                current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
2073
-          st_synchronize();
2074
-        }
2075
-        
2076
         // only apply Y extruder offset in dual x carriage mode (x offset is already used in determining home pos)
2061
         // only apply Y extruder offset in dual x carriage mode (x offset is already used in determining home pos)
2077
         current_position[Y_AXIS] = current_position[Y_AXIS] -
2062
         current_position[Y_AXIS] = current_position[Y_AXIS] -
2078
                      extruder_offset[Y_AXIS][active_extruder] +
2063
                      extruder_offset[Y_AXIS][active_extruder] +
2079
                      extruder_offset[Y_AXIS][tmp_extruder];
2064
                      extruder_offset[Y_AXIS][tmp_extruder];
2080
-                     
2081
-        active_extruder = tmp_extruder;
2082
 
2065
 
2083
-        // Inactive head always starts at its parked position.
2084
-        axis_is_at_home(X_AXIS);
2066
+        float tmp_x_pos = current_position[X_AXIS];
2085
 
2067
 
2086
-        // record raised toolhead position for use by unpark
2087
-        memcpy(raised_parked_position, current_position, sizeof(raised_parked_position));
2088
-        raised_parked_position[Z_AXIS] += TOOLCHANGE_UNPARK_ZLIFT;
2089
-        
2090
-        active_extruder_parked = true;
2091
-        delayed_move_time = 0;
2068
+        // Set the new active extruder and position
2069
+        active_extruder = tmp_extruder;
2070
+        axis_is_at_home(X_AXIS); //this function updates X min/max values.
2071
+        current_position[X_AXIS] = inactive_x_carriage_pos;
2072
+        inactive_x_carriage_pos = tmp_x_pos;      
2092
       #else    
2073
       #else    
2093
         // Offset extruder (only by XY)
2074
         // Offset extruder (only by XY)
2094
         int i;
2075
         int i;
2294
                      active_extruder);
2275
                      active_extruder);
2295
   }
2276
   }
2296
 #else
2277
 #else
2297
-
2298
-#if defined(DUAL_X_CARRIAGE)
2299
-  if (active_extruder_parked)
2300
-  {
2301
-    if (current_position[E_AXIS] == destination[E_AXIS])
2302
-    {
2303
-      // this is a travel move
2304
-#ifdef TOOLCHANGE_UNPARK_SKIP_TRAVEL_MOVES
2305
-      if (delayed_move_time != 0xFFFFFFFFUL)
2306
-      {
2307
-        // skip this move but still update current_position in main so that it can 
2308
-        // be used as starting position before extrusion (but not in planner)
2309
-        memcpy(current_position, destination, sizeof(current_position)); 
2310
-        if (destination[Z_AXIS] > raised_parked_position[Z_AXIS])
2311
-          raised_parked_position[Z_AXIS] = destination[Z_AXIS];
2312
-        delayed_move_time = millis();
2313
-        return;
2314
-      }
2315
-      delayed_move_time = 0;
2316
-#else
2317
-      // this will cause the unpark code below to execute the specified lift in moving to the initial (travel move) position.
2318
-      memcpy(current_position, destination, sizeof(current_position)); 
2319
-#endif      
2320
-    }
2321
-    // unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
2322
-    plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS],    current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
2323
-    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], 
2324
-        current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder);
2325
-    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 
2326
-        current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
2327
-    active_extruder_parked = false;
2328
-  }
2329
-#endif //DUAL_X_CARRIAGE
2330
-
2331
   // Do not use feedmultiply for E or Z only moves
2278
   // Do not use feedmultiply for E or Z only moves
2332
   if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
2279
   if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
2333
       plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
2280
       plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
2447
      WRITE(E0_ENABLE_PIN,oldstatus);
2394
      WRITE(E0_ENABLE_PIN,oldstatus);
2448
     }
2395
     }
2449
   #endif
2396
   #endif
2450
-  #if defined(DUAL_X_CARRIAGE) && defined(TOOLCHANGE_UNPARK_SKIP_TRAVEL_MOVES)
2451
-    // handle delayed move timeout
2452
-    if (delayed_move_time != 0 && (millis() - delayed_move_time) > 1000)
2453
-    {
2454
-      // travel moves have been received so enact them
2455
-      delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
2456
-      memcpy(destination,current_position,sizeof(destination));
2457
-      prepare_move(); 
2458
-    }
2459
-  #endif  
2460
   check_axes_activity();
2397
   check_axes_activity();
2461
 }
2398
 }
2462
 
2399
 

Laden…
Annuleren
Opslaan