From b23d765991f2cbd1648bd2c5519631f8066a0bb9 Mon Sep 17 00:00:00 2001
From: Eric Kuzmenko <eric.gralco@gmail.com>
Date: Thu, 20 Aug 2015 11:37:00 -0500
Subject: [PATCH] Added Extrude From Multiple Extruders from LCD feature

---
 Marlin/language_en.h | 15 +++++++++++++++
 Marlin/ultralcd.cpp  | 32 +++++++++++++++++++++++++++++++-
 2 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/Marlin/language_en.h b/Marlin/language_en.h
index c4bebd7e588..60e46ba8470 100644
--- a/Marlin/language_en.h
+++ b/Marlin/language_en.h
@@ -120,6 +120,21 @@
 #ifndef MSG_MOVE_E
 #define MSG_MOVE_E                          "Extruder"
 #endif
+#if EXTRUDERS > 1
+  #ifndef MSG_MOVE_E1
+  #define MSG_MOVE_E1                       "Extruder1"
+  #endif
+  #if EXTRUDERS > 2
+    #ifndef MSG_MOVE_E2
+    #define MSG_MOVE_E2                     "Extruder2"
+    #endif
+    #if EXTRUDERS > 3
+      #ifndef MSG_MOVE_E3
+      #define MSG_MOVE_E3                   "Extruder3"
+      #endif
+    #endif
+  #endif // EXTRUDERS > 2
+#endif // EXTRUDERS > 1
 #ifndef MSG_MOVE_01MM
 #define MSG_MOVE_01MM                       "Move 0.1mm"
 #endif
diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp
index 6f0d7e1088b..29c97e6854f 100644
--- a/Marlin/ultralcd.cpp
+++ b/Marlin/ultralcd.cpp
@@ -743,7 +743,15 @@ static void _lcd_move(const char *name, AxisEnum axis, int min, int max) {
 static void lcd_move_x() { _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, X_MIN_POS, X_MAX_POS); }
 static void lcd_move_y() { _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, Y_MIN_POS, Y_MAX_POS); }
 static void lcd_move_z() { _lcd_move(PSTR(MSG_MOVE_Z), Z_AXIS, Z_MIN_POS, Z_MAX_POS); }
-static void lcd_move_e() {
+static void lcd_move_e(
+#if EXTRUDERS > 1
+  uint8_t e = 0
+#endif
+) {
+  #if EXTRUDERS > 1
+    unsigned short original_active_extruder = active_extruder;
+    active_extruder = e;
+  #endif
   if (encoderPosition != 0) {
     current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
     encoderPosition = 0;
@@ -752,8 +760,21 @@ static void lcd_move_e() {
   }
   if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_MOVE_E), ftostr31(current_position[E_AXIS]));
   if (LCD_CLICKED) lcd_goto_menu(lcd_move_menu_axis);
+  #if EXTRUDERS > 1
+    active_extruder = original_active_extruder;
+  #endif
 }
 
+#if EXTRUDERS > 1
+  static void lcd_move_e1() { lcd_move_e(1) }
+  #if EXTRUDERS > 2
+    static void lcd_move_e2() { lcd_move_e(2) }
+    #if EXTRUDERS > 3
+      static void lcd_move_e3() { lcd_move_e(3) }
+    #endif
+  #endif
+#endif // EXTRUDERS > 1
+
 /**
  *
  * "Prepare" > "Move Xmm" > "Move XYZ" submenu
@@ -768,6 +789,15 @@ static void lcd_move_menu_axis() {
   if (move_menu_scale < 10.0) {
     MENU_ITEM(submenu, MSG_MOVE_Z, lcd_move_z);
     MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_e);
+    #if EXTRUDERS > 1
+      MENU_ITEM(submenu, MSG_MOVE_E1, lcd_move_e1);
+      #if EXTRUDERS > 2
+        MENU_ITEM(submenu, MSG_MOVE_E2, lcd_move_e2);
+        #if EXTRUDERS > 3
+          MENU_ITEM(submenu, MSG_MOVE_E3, lcd_move_e3);
+        #endif
+      #endif
+    #endif // EXTRUDERS > 1
   }
   END_MENU();
 }