Browse Source

Followup for Tool Migration (#17800)

studiodyne 5 years ago
parent
commit
36efe75ad1
No account linked to committer's email address
2 changed files with 27 additions and 6 deletions
  1. 5
    0
      Marlin/src/module/temperature.cpp
  2. 22
    6
      Marlin/src/module/tool_change.cpp

+ 5
- 0
Marlin/src/module/temperature.cpp View File

2959
         , const bool click_to_cancel/*=false*/
2959
         , const bool click_to_cancel/*=false*/
2960
       #endif
2960
       #endif
2961
     ) {
2961
     ) {
2962
+
2963
+      #if ENABLED(AUTOTEMP)
2964
+        REMEMBER(1, planner.autotemp_enabled, false);
2965
+      #endif
2966
+
2962
       #if TEMP_RESIDENCY_TIME > 0
2967
       #if TEMP_RESIDENCY_TIME > 0
2963
         millis_t residency_start_ms = 0;
2968
         millis_t residency_start_ms = 0;
2964
         bool first_loop = true;
2969
         bool first_loop = true;

+ 22
- 6
Marlin/src/module/tool_change.cpp View File

790
 
790
 
791
     const bool ok = TERN1(TOOLCHANGE_PARK, all_axes_homed() && toolchange_settings.enable_park);
791
     const bool ok = TERN1(TOOLCHANGE_PARK, all_axes_homed() && toolchange_settings.enable_park);
792
 
792
 
793
+    #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
794
+      // Store and stop fan. Restored on any exit.
795
+      REMEMBER(fan, thermalManager.fan_speed[TOOLCHANGE_FS_FAN], 0);
796
+    #endif
797
+
793
     // Z raise
798
     // Z raise
794
     if (ok) {
799
     if (ok) {
795
       // Do a small lift to avoid the workpiece in the move back (below)
800
       // Do a small lift to avoid the workpiece in the move back (below)
820
     #endif
825
     #endif
821
 
826
 
822
     // Cool down with fan
827
     // Cool down with fan
823
-    #if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN
828
+    #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
824
-      const int16_t fansp = thermalManager.fan_speed[TOOLCHANGE_FS_FAN];
825
       thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
829
       thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
826
       gcode.dwell(toolchange_settings.fan_time * 1000);
830
       gcode.dwell(toolchange_settings.fan_time * 1000);
827
-      thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = fansp;
831
+      thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = 0;
828
     #endif
832
     #endif
829
 
833
 
830
     // Move back
834
     // Move back
933
     if (new_tool != old_tool) {
937
     if (new_tool != old_tool) {
934
       destination = current_position;
938
       destination = current_position;
935
 
939
 
940
+      #if BOTH(TOOLCHANGE_FILAMENT_SWAP, HAS_FAN) && TOOLCHANGE_FS_FAN >= 0
941
+        // Store and stop fan. Restored on any exit.
942
+        REMEMBER(fan, thermalManager.fan_speed[TOOLCHANGE_FS_FAN], 0);
943
+      #endif
944
+
936
       // Z raise before retraction
945
       // Z raise before retraction
937
       #if ENABLED(TOOLCHANGE_ZRAISE_BEFORE_RETRACT) && DISABLED(SWITCHING_NOZZLE)
946
       #if ENABLED(TOOLCHANGE_ZRAISE_BEFORE_RETRACT) && DISABLED(SWITCHING_NOZZLE)
938
         if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) {
947
         if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) {
1104
             #endif
1113
             #endif
1105
 
1114
 
1106
             // Cool down with fan
1115
             // Cool down with fan
1107
-            #if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN
1116
+            #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
1108
-              const int16_t fansp = thermalManager.fan_speed[TOOLCHANGE_FS_FAN];
1109
               thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
1117
               thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
1110
               gcode.dwell(toolchange_settings.fan_time * 1000);
1118
               gcode.dwell(toolchange_settings.fan_time * 1000);
1111
-              thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = fansp;
1119
+              thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = 0;
1112
             #endif
1120
             #endif
1113
           }
1121
           }
1114
         #endif
1122
         #endif
1157
             unscaled_e_move(toolchange_settings.extra_resume + TOOLCHANGE_FS_WIPE_RETRACT, MMM_TO_MMS(toolchange_settings.unretract_speed));
1165
             unscaled_e_move(toolchange_settings.extra_resume + TOOLCHANGE_FS_WIPE_RETRACT, MMM_TO_MMS(toolchange_settings.unretract_speed));
1158
             current_position.e = 0;
1166
             current_position.e = 0;
1159
             sync_plan_position_e(); // New extruder primed and set to 0
1167
             sync_plan_position_e(); // New extruder primed and set to 0
1168
+
1169
+            // Restart Fan
1170
+            #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
1171
+              RESTORE(fan);
1172
+            #endif
1160
           }
1173
           }
1161
         #endif
1174
         #endif
1162
 
1175
 
1257
       thermalManager.wait_for_hotend(active_extruder);
1270
       thermalManager.wait_for_hotend(active_extruder);
1258
     #endif
1271
     #endif
1259
 
1272
 
1273
+    // Migrate Linear Advance K factor to the new extruder
1274
+    TERN_(LIN_ADVANCE, planner.extruder_advance_K[active_extruder] = planner.extruder_advance_K[migration_extruder]);
1275
+
1260
     // Perform the tool change
1276
     // Perform the tool change
1261
     tool_change(migration_extruder);
1277
     tool_change(migration_extruder);
1262
 
1278
 

Loading…
Cancel
Save