Browse Source

Fix manual_move to move the correct E stepper

Scott Lahteine 8 years ago
parent
commit
811967923a
1 changed files with 22 additions and 13 deletions
  1. 22
    13
      Marlin/ultralcd.cpp

+ 22
- 13
Marlin/ultralcd.cpp View File

91
 
91
 
92
   int8_t encoderDiff; // updated from interrupt context and added to encoderPosition every LCD update
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
   millis_t manual_move_start_time = 0;
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
   bool encoderRateMultiplierEnabled;
102
   bool encoderRateMultiplierEnabled;
98
   int32_t lastEncoderMovementMillis;
103
   int32_t lastEncoderMovementMillis;
1208
     if (manual_move_axis != (int8_t)NO_AXIS && millis() >= manual_move_start_time && !planner.is_full()) {
1213
     if (manual_move_axis != (int8_t)NO_AXIS && millis() >= manual_move_start_time && !planner.is_full()) {
1209
       #if ENABLED(DELTA)
1214
       #if ENABLED(DELTA)
1210
         calculate_delta(current_position);
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
       #else
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
       #endif
1219
       #endif
1215
       manual_move_axis = (int8_t)NO_AXIS;
1220
       manual_move_axis = (int8_t)NO_AXIS;
1216
     }
1221
     }
1220
    * Set a flag that lcd_update() should start a move
1225
    * Set a flag that lcd_update() should start a move
1221
    * to "current_position" after a short delay.
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
     manual_move_start_time = millis() + 500UL; // 1/2 second delay
1236
     manual_move_start_time = millis() + 500UL; // 1/2 second delay
1225
     manual_move_axis = (int8_t)axis;
1237
     manual_move_axis = (int8_t)axis;
1226
   }
1238
   }
1259
   static void lcd_move_z() { _lcd_move(PSTR(MSG_MOVE_Z), Z_AXIS, sw_endstop_min[Z_AXIS], sw_endstop_max[Z_AXIS]); }
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
   static void lcd_move_e(
1272
   static void lcd_move_e(
1261
     #if EXTRUDERS > 1
1273
     #if EXTRUDERS > 1
1262
-      uint8_t e
1274
+      int8_t eindex = -1
1263
     #endif
1275
     #endif
1264
   ) {
1276
   ) {
1265
     ENCODER_DIRECTION_NORMAL();
1277
     ENCODER_DIRECTION_NORMAL();
1266
-    #if EXTRUDERS > 1
1267
-      unsigned short original_active_extruder = active_extruder;
1268
-      active_extruder = e;
1269
-    #endif
1270
     if (encoderPosition) {
1278
     if (encoderPosition) {
1271
       current_position[E_AXIS] += float((int32_t)encoderPosition) * move_menu_scale;
1279
       current_position[E_AXIS] += float((int32_t)encoderPosition) * move_menu_scale;
1272
       encoderPosition = 0;
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
       lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
1286
       lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
1275
     }
1287
     }
1276
     if (lcdDrawUpdate) {
1288
     if (lcdDrawUpdate) {
1292
       lcd_implementation_drawedit(pos_label, ftostr41sign(current_position[E_AXIS]));
1304
       lcd_implementation_drawedit(pos_label, ftostr41sign(current_position[E_AXIS]));
1293
     }
1305
     }
1294
     if (LCD_CLICKED) lcd_goto_previous_menu(true);
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
   #if EXTRUDERS > 1
1309
   #if EXTRUDERS > 1

Loading…
Cancel
Save