Browse Source

Implement DUAL_NOZZLE_DUPLICATION_MODE

Scott Lahteine 8 years ago
parent
commit
cbc7f22ad9
4 changed files with 29 additions and 11 deletions
  1. 1
    1
      Marlin/Marlin.h
  2. 26
    9
      Marlin/Marlin_main.cpp
  3. 1
    0
      Marlin/language.h
  4. 1
    1
      Marlin/stepper_indirection.h

+ 1
- 1
Marlin/Marlin.h View File

@@ -134,7 +134,7 @@ void idle(
134 134
 
135 135
 void manage_inactivity(bool ignore_stepper_queue = false);
136 136
 
137
-#if ENABLED(DUAL_X_CARRIAGE)
137
+#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
138 138
   extern bool extruder_duplication_enabled;
139 139
 #endif
140 140
 

+ 26
- 9
Marlin/Marlin_main.cpp View File

@@ -1392,6 +1392,10 @@ XYZ_CONSTS_FROM_CONFIG(float, max_length,     MAX_LENGTH);
1392 1392
 XYZ_CONSTS_FROM_CONFIG(float, home_bump_mm,   HOME_BUMP_MM);
1393 1393
 XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
1394 1394
 
1395
+#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
1396
+  bool extruder_duplication_enabled = false; // Used in Dual X mode 2
1397
+#endif
1398
+
1395 1399
 #if ENABLED(DUAL_X_CARRIAGE)
1396 1400
 
1397 1401
   #define DXC_FULL_CONTROL_MODE 0
@@ -1423,7 +1427,6 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
1423 1427
   static millis_t delayed_move_time = 0; // used in mode 1
1424 1428
   static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
1425 1429
   static float duplicate_extruder_temp_offset = 0; // used in mode 2
1426
-  bool extruder_duplication_enabled = false; // used in mode 2
1427 1430
 
1428 1431
 #endif //DUAL_X_CARRIAGE
1429 1432
 
@@ -2820,12 +2823,13 @@ inline void gcode_G4() {
2820 2823
     current_position[X_AXIS] = current_position[Y_AXIS] = 0.0;
2821 2824
     sync_plan_position();
2822 2825
 
2823
-    #if ENABLED(DUAL_X_CARRIAGE)
2824
-      int x_axis_home_dir = x_home_dir(active_extruder);
2825
-      extruder_duplication_enabled = false;
2826
-    #else
2827
-      int x_axis_home_dir = home_dir(X_AXIS);
2828
-    #endif
2826
+    int x_axis_home_dir =
2827
+      #if ENABLED(DUAL_X_CARRIAGE)
2828
+        x_home_dir(active_extruder)
2829
+      #else
2830
+        home_dir(X_AXIS)
2831
+      #endif
2832
+    ;
2829 2833
 
2830 2834
     float mlx = max_length(X_AXIS),
2831 2835
           mly = max_length(Y_AXIS),
@@ -2878,6 +2882,10 @@ inline void gcode_G28() {
2878 2882
     tool_change(0, 0, true);
2879 2883
   #endif
2880 2884
 
2885
+  #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
2886
+    extruder_duplication_enabled = false;
2887
+  #endif
2888
+
2881 2889
   /**
2882 2890
    * For mesh bed leveling deactivate the mesh calculations, will be turned
2883 2891
    * on again when homing all axis
@@ -2996,7 +3004,6 @@ inline void gcode_G28() {
2996 3004
     if (home_all_axis || homeX) {
2997 3005
       #if ENABLED(DUAL_X_CARRIAGE)
2998 3006
         int tmp_extruder = active_extruder;
2999
-        extruder_duplication_enabled = false;
3000 3007
         active_extruder = !active_extruder;
3001 3008
         HOMEAXIS(X);
3002 3009
         inactive_extruder_x_pos = current_position[X_AXIS];
@@ -6473,7 +6480,17 @@ inline void gcode_M503() {
6473 6480
     delayed_move_time = 0;
6474 6481
   }
6475 6482
 
6476
-#endif // DUAL_X_CARRIAGE
6483
+#elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
6484
+
6485
+  inline void gcode_M605() {
6486
+    stepper.synchronize();
6487
+    extruder_duplication_enabled = code_seen('S') && code_value_int() == 2;
6488
+    SERIAL_ECHO_START;
6489
+    SERIAL_ECHOPAIR(MSG_DUPLICATION_MODE, extruder_duplication_enabled ? MSG_ON : MSG_OFF);
6490
+    SERIAL_EOL;
6491
+  }
6492
+
6493
+#endif // M605
6477 6494
 
6478 6495
 #if ENABLED(LIN_ADVANCE)
6479 6496
   /**

+ 1
- 0
Marlin/language.h View File

@@ -159,6 +159,7 @@
159 159
 #define MSG_ENDSTOP_HIT                     "TRIGGERED"
160 160
 #define MSG_ENDSTOP_OPEN                    "open"
161 161
 #define MSG_HOTEND_OFFSET                   "Hotend offsets:"
162
+#define MSG_DUPLICATION_MODE                "Duplication mode: "
162 163
 
163 164
 #define MSG_SD_CANT_OPEN_SUBDIR             "Cannot open subdir "
164 165
 #define MSG_SD_INIT_FAIL                    "SD init fail"

+ 1
- 1
Marlin/stepper_indirection.h View File

@@ -195,7 +195,7 @@
195 195
   #define NORM_E_DIR() { switch (current_block->active_extruder) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); } }
196 196
   #define REV_E_DIR() { switch (current_block->active_extruder) { case 0: E0_DIR_WRITE(INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(INVERT_E2_DIR); } }
197 197
 #elif EXTRUDERS > 1
198
-  #if DISABLED(DUAL_X_CARRIAGE)
198
+  #if DISABLED(DUAL_X_CARRIAGE) && DISABLED(DUAL_NOZZLE_DUPLICATION_MODE)
199 199
     #define E_STEP_WRITE(v) { if (current_block->active_extruder == 0) { E0_STEP_WRITE(v); } else { E1_STEP_WRITE(v); } }
200 200
     #define NORM_E_DIR() { if (current_block->active_extruder == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }
201 201
     #define REV_E_DIR() { if (current_block->active_extruder == 0) { E0_DIR_WRITE(INVERT_E0_DIR); } else { E1_DIR_WRITE(INVERT_E1_DIR); } }

Loading…
Cancel
Save