Browse Source

Move singlenozzle temp/fan (#20829)

Scott Lahteine 3 years ago
parent
commit
3f90ecfd77
No account linked to committer's email address

+ 2
- 2
Marlin/src/gcode/temp/M104_M109.cpp View File

@@ -88,7 +88,7 @@ void GcodeSuite::M104() {
88 88
 
89 89
   if (got_temp) {
90 90
     #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
91
-      singlenozzle_temp[target_extruder] = temp;
91
+      thermalManager.singlenozzle_temp[target_extruder] = temp;
92 92
       if (target_extruder != active_extruder) return;
93 93
     #endif
94 94
     thermalManager.setTargetHotend(temp, target_extruder);
@@ -166,7 +166,7 @@ void GcodeSuite::M109() {
166 166
 
167 167
   if (got_temp) {
168 168
     #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
169
-      singlenozzle_temp[target_extruder] = temp;
169
+      thermalManager.singlenozzle_temp[target_extruder] = temp;
170 170
       if (target_extruder != active_extruder) return;
171 171
     #endif
172 172
     thermalManager.setTargetHotend(temp, target_extruder);

+ 4
- 4
Marlin/src/inc/SanityCheck.h View File

@@ -1935,16 +1935,16 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
1935 1935
  * Basic multi hotend duplication mode
1936 1936
  */
1937 1937
 #if ENABLED(MULTI_NOZZLE_DUPLICATION)
1938
-  #if HOTENDS < 2
1939
-    #error "MULTI_NOZZLE_DUPLICATION requires 2 or more hotends."
1938
+  #if ENABLED(SINGLENOZZLE)
1939
+    #error "MULTI_NOZZLE_DUPLICATION is incompatible with SINGLENOZZLE."
1940 1940
   #elif ENABLED(DUAL_X_CARRIAGE)
1941 1941
     #error "MULTI_NOZZLE_DUPLICATION is incompatible with DUAL_X_CARRIAGE."
1942
-  #elif ENABLED(SINGLENOZZLE)
1943
-    #error "MULTI_NOZZLE_DUPLICATION is incompatible with SINGLENOZZLE."
1944 1942
   #elif ENABLED(MIXING_EXTRUDER)
1945 1943
     #error "MULTI_NOZZLE_DUPLICATION is incompatible with MIXING_EXTRUDER."
1946 1944
   #elif ENABLED(SWITCHING_EXTRUDER)
1947 1945
     #error "MULTI_NOZZLE_DUPLICATION is incompatible with SWITCHING_EXTRUDER."
1946
+  #elif HOTENDS < 2
1947
+    #error "MULTI_NOZZLE_DUPLICATION requires 2 or more hotends."
1948 1948
   #endif
1949 1949
 #endif
1950 1950
 

+ 1
- 1
Marlin/src/lcd/menu/menu_item.h View File

@@ -485,7 +485,7 @@ class MenuItem_bool : public MenuEditItemBase {
485 485
   #if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7)
486 486
     #define DEFINE_SINGLENOZZLE_ITEM() \
487 487
       auto singlenozzle_item = [&](const uint8_t f) { \
488
-        editable.uint8 = singlenozzle_fan_speed[f]; \
488
+        editable.uint8 = thermalManager.singlenozzle_fan_speed[f]; \
489 489
         EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update); \
490 490
       }
491 491
   #else

+ 1
- 1
Marlin/src/lcd/menu/menu_temperature.cpp View File

@@ -159,7 +159,7 @@ void menu_temperature() {
159 159
 
160 160
   #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
161 161
     LOOP_S_L_N(e, 1, EXTRUDERS)
162
-      EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &singlenozzle_temp[e], 0, thermalManager.heater_maxtemp[0] - (HOTEND_OVERSHOOT));
162
+      EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.heater_maxtemp[0] - (HOTEND_OVERSHOOT));
163 163
   #endif
164 164
 
165 165
   //

+ 1
- 1
Marlin/src/lcd/menu/menu_tune.cpp View File

@@ -127,7 +127,7 @@ void menu_tune() {
127 127
 
128 128
   #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
129 129
     LOOP_S_L_N(e, 1, EXTRUDERS)
130
-      EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &singlenozzle_temp[e], 0, thermalManager.heater_maxtemp[0] - HOTEND_OVERSHOOT);
130
+      EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.heater_maxtemp[0] - HOTEND_OVERSHOOT);
131 131
   #endif
132 132
 
133 133
   //

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

@@ -377,6 +377,13 @@ volatile bool Temperature::raw_temps_ready = false;
377 377
           Temperature::soft_pwm_count_fan[FAN_COUNT];
378 378
 #endif
379 379
 
380
+#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
381
+  uint16_t Temperature::singlenozzle_temp[EXTRUDERS];
382
+  #if HAS_FAN
383
+    uint8_t Temperature::singlenozzle_fan_speed[EXTRUDERS];
384
+  #endif
385
+#endif
386
+
380 387
 #if ENABLED(PROBING_HEATERS_OFF)
381 388
   bool Temperature::paused;
382 389
 #endif
@@ -2195,6 +2202,24 @@ void Temperature::disable_all_heaters() {
2195 2202
 
2196 2203
 #endif // PROBING_HEATERS_OFF
2197 2204
 
2205
+#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
2206
+
2207
+  void Temperature::singlenozzle_change(const uint8_t old_tool, const uint8_t new_tool) {
2208
+    #if HAS_FAN
2209
+      singlenozzle_fan_speed[old_tool] = fan_speed[0];
2210
+      fan_speed[0] = singlenozzle_fan_speed[new_tool];
2211
+    #endif
2212
+    singlenozzle_temp[old_tool] = temp_hotend[0].target;
2213
+    if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
2214
+      setTargetHotend(singlenozzle_temp[new_tool], 0);
2215
+      TERN_(AUTOTEMP, planner.autotemp_update());
2216
+      TERN_(HAS_DISPLAY, set_heating_message(0));
2217
+      (void)wait_for_hotend(0, false);  // Wait for heating or cooling
2218
+    }
2219
+  }
2220
+
2221
+#endif
2222
+
2198 2223
 #if HAS_MAX6675
2199 2224
 
2200 2225
   #ifndef THERMOCOUPLE_MAX_ERRORS

+ 8
- 0
Marlin/src/module/temperature.h View File

@@ -335,6 +335,14 @@ class Temperature {
335 335
     FORCE_INLINE static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); }
336 336
     FORCE_INLINE static bool targetHotEnoughToExtrude(const uint8_t e) { return !targetTooColdToExtrude(e); }
337 337
 
338
+    #if ENABLED(SINGLENOZZLE_STANDBY_FAN)
339
+      static uint16_t singlenozzle_temp[EXTRUDERS];
340
+      #if HAS_FAN
341
+        static uint8_t singlenozzle_fan_speed[EXTRUDERS];
342
+      #endif
343
+      static void singlenozzle_change(const uint8_t old_tool, const uint8_t new_tool);
344
+    #endif
345
+
338 346
     #if HEATER_IDLE_HANDLER
339 347
 
340 348
       // Heater idle handling. Marlin creates one per hotend and one for the heated bed.

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

@@ -49,14 +49,6 @@
49 49
   bool toolchange_extruder_ready[EXTRUDERS];
50 50
 #endif
51 51
 
52
-#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
53
-  uint16_t singlenozzle_temp[EXTRUDERS];
54
-#endif
55
-
56
-#if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
57
-  uint8_t singlenozzle_fan_speed[EXTRUDERS];
58
-#endif
59
-
60 52
 #if ENABLED(MAGNETIC_PARKING_EXTRUDER) || defined(EVENT_GCODE_AFTER_TOOLCHANGE) || (ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0)
61 53
   #include "../gcode/gcode.h"
62 54
 #endif
@@ -1081,20 +1073,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1081 1073
       const bool should_move = safe_to_move && !no_move && IsRunning();
1082 1074
       if (should_move) {
1083 1075
 
1084
-        #if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
1085
-          singlenozzle_fan_speed[old_tool] = thermalManager.fan_speed[0];
1086
-          thermalManager.fan_speed[0] = singlenozzle_fan_speed[new_tool];
1087
-        #endif
1088
-
1089
-        #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
1090
-          singlenozzle_temp[old_tool] = thermalManager.temp_hotend[0].target;
1091
-          if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
1092
-            thermalManager.setTargetHotend(singlenozzle_temp[new_tool], 0);
1093
-            TERN_(AUTOTEMP, planner.autotemp_update());
1094
-            TERN_(HAS_DISPLAY, thermalManager.set_heating_message(0));
1095
-            (void)thermalManager.wait_for_hotend(0, false);  // Wait for heating or cooling
1096
-          }
1097
-        #endif
1076
+        TERN_(SINGLENOZZLE_STANDBY_TEMP, thermalManager.singlenozzle_change(old_tool, new_tool));
1098 1077
 
1099 1078
         #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
1100 1079
           if (should_swap && !too_cold) {

+ 0
- 8
Marlin/src/module/tool_change.h View File

@@ -114,14 +114,6 @@
114 114
 
115 115
 #endif
116 116
 
117
-#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
118
-  extern uint16_t singlenozzle_temp[EXTRUDERS];
119
-#endif
120
-
121
-#if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
122
-  extern uint8_t singlenozzle_fan_speed[EXTRUDERS];
123
-#endif
124
-
125 117
 TERN_(ELECTROMAGNETIC_SWITCHING_TOOLHEAD, void est_init());
126 118
 
127 119
 TERN_(SWITCHING_TOOLHEAD, void swt_init());

Loading…
Cancel
Save