Followup for Tool Migration (#17800)

This commit is contained in:
studiodyne 2020-05-03 07:32:25 +02:00 committed by GitHub
parent 0c68794fa9
commit 36efe75ad1
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 6 deletions

View file

@ -2959,6 +2959,11 @@ void Temperature::tick() {
, const bool click_to_cancel/*=false*/ , const bool click_to_cancel/*=false*/
#endif #endif
) { ) {
#if ENABLED(AUTOTEMP)
REMEMBER(1, planner.autotemp_enabled, false);
#endif
#if TEMP_RESIDENCY_TIME > 0 #if TEMP_RESIDENCY_TIME > 0
millis_t residency_start_ms = 0; millis_t residency_start_ms = 0;
bool first_loop = true; bool first_loop = true;

View file

@ -790,6 +790,11 @@ void tool_change_prime() {
const bool ok = TERN1(TOOLCHANGE_PARK, all_axes_homed() && toolchange_settings.enable_park); const bool ok = TERN1(TOOLCHANGE_PARK, all_axes_homed() && toolchange_settings.enable_park);
#if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
// Store and stop fan. Restored on any exit.
REMEMBER(fan, thermalManager.fan_speed[TOOLCHANGE_FS_FAN], 0);
#endif
// Z raise // Z raise
if (ok) { if (ok) {
// Do a small lift to avoid the workpiece in the move back (below) // Do a small lift to avoid the workpiece in the move back (below)
@ -820,11 +825,10 @@ void tool_change_prime() {
#endif #endif
// Cool down with fan // Cool down with fan
#if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
const int16_t fansp = thermalManager.fan_speed[TOOLCHANGE_FS_FAN];
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed; thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
gcode.dwell(toolchange_settings.fan_time * 1000); gcode.dwell(toolchange_settings.fan_time * 1000);
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = fansp; thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = 0;
#endif #endif
// Move back // Move back
@ -933,6 +937,11 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
if (new_tool != old_tool) { if (new_tool != old_tool) {
destination = current_position; destination = current_position;
#if BOTH(TOOLCHANGE_FILAMENT_SWAP, HAS_FAN) && TOOLCHANGE_FS_FAN >= 0
// Store and stop fan. Restored on any exit.
REMEMBER(fan, thermalManager.fan_speed[TOOLCHANGE_FS_FAN], 0);
#endif
// Z raise before retraction // Z raise before retraction
#if ENABLED(TOOLCHANGE_ZRAISE_BEFORE_RETRACT) && DISABLED(SWITCHING_NOZZLE) #if ENABLED(TOOLCHANGE_ZRAISE_BEFORE_RETRACT) && DISABLED(SWITCHING_NOZZLE)
if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) { if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) {
@ -1104,11 +1113,10 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
#endif #endif
// Cool down with fan // Cool down with fan
#if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
const int16_t fansp = thermalManager.fan_speed[TOOLCHANGE_FS_FAN];
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed; thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
gcode.dwell(toolchange_settings.fan_time * 1000); gcode.dwell(toolchange_settings.fan_time * 1000);
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = fansp; thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = 0;
#endif #endif
} }
#endif #endif
@ -1157,6 +1165,11 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
unscaled_e_move(toolchange_settings.extra_resume + TOOLCHANGE_FS_WIPE_RETRACT, MMM_TO_MMS(toolchange_settings.unretract_speed)); unscaled_e_move(toolchange_settings.extra_resume + TOOLCHANGE_FS_WIPE_RETRACT, MMM_TO_MMS(toolchange_settings.unretract_speed));
current_position.e = 0; current_position.e = 0;
sync_plan_position_e(); // New extruder primed and set to 0 sync_plan_position_e(); // New extruder primed and set to 0
// Restart Fan
#if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
RESTORE(fan);
#endif
} }
#endif #endif
@ -1257,6 +1270,9 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
thermalManager.wait_for_hotend(active_extruder); thermalManager.wait_for_hotend(active_extruder);
#endif #endif
// Migrate Linear Advance K factor to the new extruder
TERN_(LIN_ADVANCE, planner.extruder_advance_K[active_extruder] = planner.extruder_advance_K[migration_extruder]);
// Perform the tool change // Perform the tool change
tool_change(migration_extruder); tool_change(migration_extruder);