Fix feedrate after toolchange

The fix is simple. Most changes are because of changed indendation,
bacause of leaving early for wrong tool number
This commit is contained in:
Blue-Marlin 2016-04-27 00:57:45 +02:00
parent ec82e1e05d
commit e58e281473

View File

@ -6304,23 +6304,23 @@ inline void gcode_T(uint8_t tmp_extruder) {
SERIAL_CHAR('T');
SERIAL_PROTOCOL_F(tmp_extruder, DEC);
SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
return;
}
else {
target_extruder = tmp_extruder;
#if EXTRUDERS > 1
bool make_move = false;
#endif
float stored_feedrate = feedrate;
if (code_seen('F')) {
#if EXTRUDERS > 1
make_move = true;
#endif
float next_feedrate = code_value();
if (next_feedrate > 0.0) feedrate = next_feedrate;
if (next_feedrate > 0.0) stored_feedrate = feedrate = next_feedrate;
}
else {
#ifdef XY_TRAVEL_SPEED
feedrate = XY_TRAVEL_SPEED;
#else
feedrate = min(max_feedrate[X_AXIS], max_feedrate[Y_AXIS]);
#endif
}
#if EXTRUDERS > 1
if (tmp_extruder != active_extruder) {
// Save current position to return to after applying extruder offset
@ -6352,7 +6352,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
}
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
active_extruder_parked = (active_extruder == 0); // this triggers the second extruder to move into the duplication position
if (active_extruder == 0 || active_extruder_parked)
if (active_extruder_parked)
current_position[X_AXIS] = inactive_extruder_x_pos;
else
current_position[X_AXIS] = destination[X_AXIS] + duplicate_extruder_x_offset;
@ -6366,6 +6366,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
active_extruder_parked = true;
delayed_move_time = 0;
}
// No extra case for AUTO_BED_LEVELING_FEATURE in DUAL_X_CARRIAGE. Does that mean they don't work together?
#else // !DUAL_X_CARRIAGE
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
// Offset extruder, make sure to apply the bed level rotation matrix
@ -6414,9 +6415,9 @@ inline void gcode_T(uint8_t tmp_extruder) {
#else
sync_plan_position();
#endif
// Move to the old position if 'F' was in the parameters
if (make_move && IsRunning()) prepare_move();
}
// Move to the old position
if (IsRunning()) prepare_move();
} // (tmp_extruder != active_extruder)
#if ENABLED(EXT_SOLENOID)
st_synchronize();
@ -6425,11 +6426,13 @@ inline void gcode_T(uint8_t tmp_extruder) {
#endif // EXT_SOLENOID
#endif // EXTRUDERS > 1
feedrate = stored_feedrate;
SERIAL_ECHO_START;
SERIAL_ECHO(MSG_ACTIVE_EXTRUDER);
SERIAL_PROTOCOLLN((int)active_extruder);
}
}
/**
* Process a single command and dispatch it to its handler