Move singlenozzle temp/fan (#20829)

This commit is contained in:
Scott Lahteine
2021-01-19 20:58:50 -06:00
committed by GitHub
parent a275e4e5b8
commit 3f90ecfd77
9 changed files with 43 additions and 39 deletions

View File

@ -377,6 +377,13 @@ volatile bool Temperature::raw_temps_ready = false;
Temperature::soft_pwm_count_fan[FAN_COUNT];
#endif
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
uint16_t Temperature::singlenozzle_temp[EXTRUDERS];
#if HAS_FAN
uint8_t Temperature::singlenozzle_fan_speed[EXTRUDERS];
#endif
#endif
#if ENABLED(PROBING_HEATERS_OFF)
bool Temperature::paused;
#endif
@ -2195,6 +2202,24 @@ void Temperature::disable_all_heaters() {
#endif // PROBING_HEATERS_OFF
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
void Temperature::singlenozzle_change(const uint8_t old_tool, const uint8_t new_tool) {
#if HAS_FAN
singlenozzle_fan_speed[old_tool] = fan_speed[0];
fan_speed[0] = singlenozzle_fan_speed[new_tool];
#endif
singlenozzle_temp[old_tool] = temp_hotend[0].target;
if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
setTargetHotend(singlenozzle_temp[new_tool], 0);
TERN_(AUTOTEMP, planner.autotemp_update());
TERN_(HAS_DISPLAY, set_heating_message(0));
(void)wait_for_hotend(0, false); // Wait for heating or cooling
}
}
#endif
#if HAS_MAX6675
#ifndef THERMOCOUPLE_MAX_ERRORS

View File

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

View File

@ -49,14 +49,6 @@
bool toolchange_extruder_ready[EXTRUDERS];
#endif
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
uint16_t singlenozzle_temp[EXTRUDERS];
#endif
#if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
uint8_t singlenozzle_fan_speed[EXTRUDERS];
#endif
#if ENABLED(MAGNETIC_PARKING_EXTRUDER) || defined(EVENT_GCODE_AFTER_TOOLCHANGE) || (ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0)
#include "../gcode/gcode.h"
#endif
@ -1081,20 +1073,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
const bool should_move = safe_to_move && !no_move && IsRunning();
if (should_move) {
#if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
singlenozzle_fan_speed[old_tool] = thermalManager.fan_speed[0];
thermalManager.fan_speed[0] = singlenozzle_fan_speed[new_tool];
#endif
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
singlenozzle_temp[old_tool] = thermalManager.temp_hotend[0].target;
if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
thermalManager.setTargetHotend(singlenozzle_temp[new_tool], 0);
TERN_(AUTOTEMP, planner.autotemp_update());
TERN_(HAS_DISPLAY, thermalManager.set_heating_message(0));
(void)thermalManager.wait_for_hotend(0, false); // Wait for heating or cooling
}
#endif
TERN_(SINGLENOZZLE_STANDBY_TEMP, thermalManager.singlenozzle_change(old_tool, new_tool));
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
if (should_swap && !too_cold) {

View File

@ -114,14 +114,6 @@
#endif
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
extern uint16_t singlenozzle_temp[EXTRUDERS];
#endif
#if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
extern uint8_t singlenozzle_fan_speed[EXTRUDERS];
#endif
TERN_(ELECTROMAGNETIC_SWITCHING_TOOLHEAD, void est_init());
TERN_(SWITCHING_TOOLHEAD, void swt_init());