Bladeren bron

Followup fixes for singlenozzle, etc. (#17712)

studiodyne 4 jaren geleden
bovenliggende
commit
89b17b5463
No account linked to committer's email address

+ 7
- 0
Marlin/Configuration.h Bestand weergeven

@@ -150,6 +150,13 @@
150 150
 // For Cyclops or any "multi-extruder" that shares a single nozzle.
151 151
 //#define SINGLENOZZLE
152 152
 
153
+// Save and restore temperature and fan speed on tool-change.
154
+// Set standby for the unselected tool with M104/106/109 T...
155
+#if ENABLED(SINGLENOZZLE)
156
+  //#define SINGLENOZZLE_STANDBY_TEMP
157
+  //#define SINGLENOZZLE_STANDBY_FAN
158
+#endif
159
+
153 160
 /**
154 161
  * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants.
155 162
  *

+ 1
- 1
Marlin/Configuration_adv.h Bestand weergeven

@@ -1889,7 +1889,7 @@
1889 1889
     // (May break filament if not retracted beforehand.)
1890 1890
     //#define TOOLCHANGE_FS_INIT_BEFORE_SWAP
1891 1891
 
1892
-    // Prime on the first T command even if the same or no toolchange / swap
1892
+    // Prime on the first T0 (If other, TOOLCHANGE_FS_INIT_BEFORE_SWAP applied)
1893 1893
     // Enable it (M217 V[0/1]) before printing, to avoid unwanted priming on host connect
1894 1894
     //#define TOOLCHANGE_FS_PRIME_FIRST_USED
1895 1895
 

+ 2
- 2
Marlin/src/gcode/temp/M104_M109.cpp Bestand weergeven

@@ -65,7 +65,7 @@ void GcodeSuite::M104() {
65 65
 
66 66
   if (parser.seenval('S')) {
67 67
     const int16_t temp = parser.value_celsius();
68
-    #if ENABLED(SINGLENOZZLE)
68
+    #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
69 69
       singlenozzle_temp[target_extruder] = temp;
70 70
       if (target_extruder != active_extruder) return;
71 71
     #endif
@@ -111,7 +111,7 @@ void GcodeSuite::M109() {
111 111
              set_temp = no_wait_for_cooling || parser.seenval('R');
112 112
   if (set_temp) {
113 113
     const int16_t temp = parser.value_celsius();
114
-    #if ENABLED(SINGLENOZZLE)
114
+    #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
115 115
       singlenozzle_temp[target_extruder] = temp;
116 116
       if (target_extruder != active_extruder) return;
117 117
     #endif

+ 5
- 4
Marlin/src/lcd/menu/menu_temperature.cpp Bestand weergeven

@@ -168,8 +168,9 @@ void menu_temperature() {
168 168
       EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); });
169 169
   #endif
170 170
 
171
-  #if ENABLED(SINGLENOZZLE)
172
-    EDIT_ITEM_FAST(uint16_3, MSG_NOZZLE_STANDBY, &singlenozzle_temp[active_extruder ? 0 : 1], 0, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT);
171
+  #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
172
+    LOOP_S_L_N(e, 1, EXTRUDERS)
173
+      EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &singlenozzle_temp[e], 0, thermalManager.heater_maxtemp[0] - HOTEND_OVERSHOOT);
173 174
   #endif
174 175
 
175 176
   //
@@ -207,11 +208,11 @@ void menu_temperature() {
207 208
       };
208 209
     #endif
209 210
 
210
-    #define SNFAN(N) (ENABLED(SINGLENOZZLE) && !HAS_FAN##N && EXTRUDERS > N)
211
+    #define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && EXTRUDERS > N)
211 212
     #if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7)
212 213
       auto singlenozzle_item = [&](const uint8_t f) {
213 214
         MENU_ITEM_IF(1) {
214
-          editable.uint8 = thermalManager.fan_speed[f];
215
+          editable.uint8 = singlenozzle_fan_speed[f];
215 216
           EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update);
216 217
         }
217 218
       };

+ 5
- 4
Marlin/src/lcd/menu/menu_tune.cpp Bestand weergeven

@@ -124,8 +124,9 @@ void menu_tune() {
124 124
       EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); });
125 125
   #endif
126 126
 
127
-  #if ENABLED(SINGLENOZZLE)
128
-    EDIT_ITEM_FAST(uint16_3, MSG_NOZZLE_STANDBY, &singlenozzle_temp[active_extruder ? 0 : 1], 0, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT);
127
+  #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
128
+    LOOP_S_L_N(e, 1, EXTRUDERS)
129
+      EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &singlenozzle_temp[e], 0, thermalManager.heater_maxtemp[0] - HOTEND_OVERSHOOT);
129 130
   #endif
130 131
 
131 132
   //
@@ -156,11 +157,11 @@ void menu_tune() {
156 157
       };
157 158
     #endif
158 159
 
159
-    #define SNFAN(N) (ENABLED(SINGLENOZZLE) && !HAS_FAN##N && EXTRUDERS > N)
160
+    #define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && EXTRUDERS > N)
160 161
     #if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7)
161 162
       auto singlenozzle_item = [&](const uint8_t f) {
162 163
         MENU_ITEM_IF(1) {
163
-          editable.uint8 = thermalManager.fan_speed[f];
164
+          editable.uint8 = singlenozzle_fan_speed[f];
164 165
           EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update);
165 166
         }
166 167
       };

+ 11
- 0
Marlin/src/module/planner.cpp Bestand weergeven

@@ -2861,6 +2861,17 @@ void Planner::set_max_jerk(const AxisEnum axis, float targetValue) {
2861 2861
 
2862 2862
 #if ENABLED(AUTOTEMP)
2863 2863
 
2864
+void Planner::autotemp_update() {
2865
+  
2866
+  #if ENABLED(AUTOTEMP_PROPORTIONAL)
2867
+    const int16_t target = thermalManager.degTargetHotend(active_extruder);
2868
+    autotemp_min = target + AUTOTEMP_MIN_P;
2869
+    autotemp_max = target + AUTOTEMP_MAX_P;
2870
+  #endif
2871
+  autotemp_factor = TERN(AUTOTEMP_PROPORTIONAL, AUTOTEMP_FACTOR_P, 0);
2872
+  autotemp_enabled = autotemp_factor != 0;
2873
+}
2874
+
2864 2875
   void Planner::autotemp_M104_M109() {
2865 2876
 
2866 2877
     #if ENABLED(AUTOTEMP_PROPORTIONAL)

+ 1
- 0
Marlin/src/module/planner.h Bestand weergeven

@@ -824,6 +824,7 @@ class Planner {
824 824
       static bool autotemp_enabled;
825 825
       static void getHighESpeed();
826 826
       static void autotemp_M104_M109();
827
+      static void autotemp_update();
827 828
     #endif
828 829
 
829 830
     #if HAS_LINEAR_E_JERK

+ 1
- 1
Marlin/src/module/temperature.cpp Bestand weergeven

@@ -193,7 +193,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
193 193
 
194 194
     NOMORE(speed, 255U);
195 195
 
196
-    #if ENABLED(SINGLENOZZLE)
196
+    #if ENABLED(SINGLENOZZLE_STANDBY_FAN)
197 197
       if (target != active_extruder) {
198 198
         if (target < EXTRUDERS) singlenozzle_fan_speed[target] = speed;
199 199
         return;

+ 23
- 18
Marlin/src/module/tool_change.cpp Bestand weergeven

@@ -47,11 +47,12 @@
47 47
   bool toolchange_extruder_ready[EXTRUDERS];
48 48
 #endif
49 49
 
50
-#if ENABLED(SINGLENOZZLE)
50
+#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
51 51
   uint16_t singlenozzle_temp[EXTRUDERS];
52
-  #if HAS_FAN
53
-    uint8_t singlenozzle_fan_speed[EXTRUDERS];
54
-  #endif
52
+#endif
53
+
54
+#if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
55
+  uint8_t singlenozzle_fan_speed[EXTRUDERS];
55 56
 #endif
56 57
 
57 58
 #if ENABLED(MAGNETIC_PARKING_EXTRUDER) || defined(EVENT_GCODE_AFTER_TOOLCHANGE) || (ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0)
@@ -822,7 +823,7 @@ void tool_change_prime() {
822 823
     #if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN
823 824
       const int16_t fansp = thermalManager.fan_speed[TOOLCHANGE_FS_FAN];
824 825
       thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
825
-      safe_delay(toolchange_settings.fan_time * 1000);
826
+      gcode.dwell(toolchange_settings.fan_time * 1000);
826 827
       thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = fansp;
827 828
     #endif
828 829
 
@@ -934,7 +935,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
934 935
 
935 936
       // Z raise before retraction
936 937
       #if ENABLED(TOOLCHANGE_ZRAISE_BEFORE_RETRACT) && DISABLED(SWITCHING_NOZZLE)
937
-        if (can_move_away && TERN1(toolchange_settings.enable_park)) {
938
+        if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) {
938 939
           // Do a small lift to avoid the workpiece in the move back (below)
939 940
           current_position.z += toolchange_settings.z_raise;
940 941
           #if HAS_SOFTWARE_ENDSTOPS
@@ -956,8 +957,12 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
956 957
             SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD);
957 958
             if (ENABLED(SINGLENOZZLE)) { active_extruder = new_tool; return; }
958 959
           }
959
-          else
960
-            unscaled_e_move(-toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.retract_speed));
960
+          else {
961
+            // If first new tool, toolchange without unloading the old not initialized 'Just prime/init the new'
962
+            if (first_tool_is_primed)
963
+              unscaled_e_move(-toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.retract_speed));
964
+            first_tool_is_primed = true; // The first new tool will be primed by toolchanging
965
+          }
961 966
         }
962 967
       #endif
963 968
 
@@ -1059,15 +1064,16 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1059 1064
       const bool should_move = safe_to_move && !no_move && IsRunning();
1060 1065
       if (should_move) {
1061 1066
 
1062
-        #if ENABLED(SINGLENOZZLE)
1063
-          #if HAS_FAN
1064
-            singlenozzle_fan_speed[old_tool] = thermalManager.fan_speed[0];
1065
-            thermalManager.fan_speed[0] = singlenozzle_fan_speed[new_tool];
1066
-          #endif
1067
+        #if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
1068
+          singlenozzle_fan_speed[old_tool] = thermalManager.fan_speed[0];
1069
+          thermalManager.fan_speed[0] = singlenozzle_fan_speed[new_tool];
1070
+        #endif
1067 1071
 
1072
+        #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
1068 1073
           singlenozzle_temp[old_tool] = thermalManager.temp_hotend[0].target;
1069 1074
           if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
1070 1075
             thermalManager.setTargetHotend(singlenozzle_temp[new_tool], 0);
1076
+            TERN_(AUTOTEMP, planner.autotemp_update());
1071 1077
             TERN_(HAS_DISPLAY, thermalManager.set_heating_message(0));
1072 1078
             (void)thermalManager.wait_for_hotend(0, false);  // Wait for heating or cooling
1073 1079
           }
@@ -1101,7 +1107,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1101 1107
             #if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN
1102 1108
               const int16_t fansp = thermalManager.fan_speed[TOOLCHANGE_FS_FAN];
1103 1109
               thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
1104
-              safe_delay(toolchange_settings.fan_time * 1000);
1110
+              gcode.dwell(toolchange_settings.fan_time * 1000);
1105 1111
               thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = fansp;
1106 1112
             #endif
1107 1113
           }
@@ -1245,10 +1251,9 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1245 1251
 
1246 1252
     // Migrate the temperature to the new hotend
1247 1253
     #if HAS_MULTI_HOTEND
1248
-      thermalManager.setTargetHotend(thermalManager.degTargetHotend(active_extruder), migration_extruder);
1249
-      #if HAS_DISPLAY
1250
-        thermalManager.set_heating_message(0);
1251
-      #endif
1254
+      thermalManager.setTargetHotend(thermalManager.temp_hotend[active_extruder].target, migration_extruder);
1255
+      TERN_(AUTOTEMP, planner.autotemp_update());
1256
+      TERN_(HAS_DISPLAY, thermalManager.set_heating_message(0));
1252 1257
       thermalManager.wait_for_hotend(active_extruder);
1253 1258
     #endif
1254 1259
 

+ 5
- 4
Marlin/src/module/tool_change.h Bestand weergeven

@@ -108,11 +108,12 @@
108 108
 
109 109
 #endif
110 110
 
111
-#if ENABLED(SINGLENOZZLE)
111
+#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
112 112
   extern uint16_t singlenozzle_temp[EXTRUDERS];
113
-  #if HAS_FAN
114
-    extern uint8_t singlenozzle_fan_speed[EXTRUDERS];
115
-  #endif
113
+#endif
114
+
115
+#if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
116
+  extern uint8_t singlenozzle_fan_speed[EXTRUDERS];
116 117
 #endif
117 118
 
118 119
 TERN_(ELECTROMAGNETIC_SWITCHING_TOOLHEAD, void est_init());

Laden…
Annuleren
Opslaan