瀏覽代碼

Fix manual_move to move the correct E stepper

Scott Lahteine 8 年之前
父節點
當前提交
811967923a
共有 1 個文件被更改,包括 22 次插入13 次删除
  1. 22
    13
      Marlin/ultralcd.cpp

+ 22
- 13
Marlin/ultralcd.cpp 查看文件

@@ -91,8 +91,13 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
91 91
 
92 92
   int8_t encoderDiff; // updated from interrupt context and added to encoderPosition every LCD update
93 93
 
94
-  int8_t manual_move_axis = (int8_t)NO_AXIS;
95 94
   millis_t manual_move_start_time = 0;
95
+  int8_t manual_move_axis = (int8_t)NO_AXIS;
96
+  #if EXTRUDERS > 1
97
+    int8_t manual_move_e_index = 0;
98
+  #else
99
+    #define manual_move_e_index 0
100
+  #endif
96 101
 
97 102
   bool encoderRateMultiplierEnabled;
98 103
   int32_t lastEncoderMovementMillis;
@@ -1208,9 +1213,9 @@ static void lcd_status_screen() {
1208 1213
     if (manual_move_axis != (int8_t)NO_AXIS && millis() >= manual_move_start_time && !planner.is_full()) {
1209 1214
       #if ENABLED(DELTA)
1210 1215
         calculate_delta(current_position);
1211
-        planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[manual_move_axis]/60, active_extruder);
1216
+        planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[manual_move_axis]/60, manual_move_e_index);
1212 1217
       #else
1213
-        planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[manual_move_axis]/60, active_extruder);
1218
+        planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[manual_move_axis]/60, manual_move_e_index);
1214 1219
       #endif
1215 1220
       manual_move_axis = (int8_t)NO_AXIS;
1216 1221
     }
@@ -1220,7 +1225,14 @@ static void lcd_status_screen() {
1220 1225
    * Set a flag that lcd_update() should start a move
1221 1226
    * to "current_position" after a short delay.
1222 1227
    */
1223
-  inline void manual_move_to_current(AxisEnum axis) {
1228
+  inline void manual_move_to_current(AxisEnum axis
1229
+    #if EXTRUDERS > 1
1230
+      , int8_t eindex=-1
1231
+    #endif
1232
+  ) {
1233
+    #if EXTRUDERS > 1
1234
+      if (axis == E_AXIS) manual_move_e_index = eindex >= 0 ? eindex : active_extruder;
1235
+    #endif
1224 1236
     manual_move_start_time = millis() + 500UL; // 1/2 second delay
1225 1237
     manual_move_axis = (int8_t)axis;
1226 1238
   }
@@ -1259,18 +1271,18 @@ static void lcd_status_screen() {
1259 1271
   static void lcd_move_z() { _lcd_move(PSTR(MSG_MOVE_Z), Z_AXIS, sw_endstop_min[Z_AXIS], sw_endstop_max[Z_AXIS]); }
1260 1272
   static void lcd_move_e(
1261 1273
     #if EXTRUDERS > 1
1262
-      uint8_t e
1274
+      int8_t eindex = -1
1263 1275
     #endif
1264 1276
   ) {
1265 1277
     ENCODER_DIRECTION_NORMAL();
1266
-    #if EXTRUDERS > 1
1267
-      unsigned short original_active_extruder = active_extruder;
1268
-      active_extruder = e;
1269
-    #endif
1270 1278
     if (encoderPosition) {
1271 1279
       current_position[E_AXIS] += float((int32_t)encoderPosition) * move_menu_scale;
1272 1280
       encoderPosition = 0;
1273
-      manual_move_to_current(E_AXIS);
1281
+      manual_move_to_current(E_AXIS
1282
+        #if EXTRUDERS > 1
1283
+          , eindex
1284
+        #endif
1285
+      );
1274 1286
       lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
1275 1287
     }
1276 1288
     if (lcdDrawUpdate) {
@@ -1292,9 +1304,6 @@ static void lcd_status_screen() {
1292 1304
       lcd_implementation_drawedit(pos_label, ftostr41sign(current_position[E_AXIS]));
1293 1305
     }
1294 1306
     if (LCD_CLICKED) lcd_goto_previous_menu(true);
1295
-    #if EXTRUDERS > 1
1296
-      active_extruder = original_active_extruder;
1297
-    #endif
1298 1307
   }
1299 1308
 
1300 1309
   #if EXTRUDERS > 1

Loading…
取消
儲存