Fix Singlenozzle Standby issues (#21759)

Fixes #21758

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
ellensp 2021-05-01 20:21:18 +12:00 committed by Scott Lahteine
parent 8abef30a75
commit d00f6cbe12
6 changed files with 34 additions and 18 deletions

View File

@ -640,6 +640,16 @@
#endif #endif
#endif #endif
/**
* Disable unused SINGLENOZZLE sub-options
*/
#if DISABLED(SINGLENOZZLE)
#undef SINGLENOZZLE_STANDBY_TEMP
#endif
#if !BOTH(HAS_FAN, SINGLENOZZLE)
#undef SINGLENOZZLE_STANDBY_FAN
#endif
/** /**
* DISTINCT_E_FACTORS affects how some E factors are accessed * DISTINCT_E_FACTORS affects how some E factors are accessed
*/ */

View File

@ -171,7 +171,7 @@ void menu_temperature() {
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP) #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
LOOP_S_L_N(e, 1, EXTRUDERS) LOOP_S_L_N(e, 1, EXTRUDERS)
EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0)); EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0));
#endif #endif
// //

View File

@ -134,7 +134,7 @@ void menu_tune() {
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP) #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
LOOP_S_L_N(e, 1, EXTRUDERS) LOOP_S_L_N(e, 1, EXTRUDERS)
EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0)); EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0));
#endif #endif
// //

View File

@ -466,9 +466,9 @@ volatile bool Temperature::raw_temps_ready = false;
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP) #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
celsius_t Temperature::singlenozzle_temp[EXTRUDERS]; celsius_t Temperature::singlenozzle_temp[EXTRUDERS];
#if HAS_FAN #endif
uint8_t Temperature::singlenozzle_fan_speed[EXTRUDERS]; #if ENABLED(SINGLENOZZLE_STANDBY_FAN)
#endif uint8_t Temperature::singlenozzle_fan_speed[EXTRUDERS];
#endif #endif
#if ENABLED(PROBING_HEATERS_OFF) #if ENABLED(PROBING_HEATERS_OFF)
@ -2500,20 +2500,22 @@ void Temperature::disable_all_heaters() {
#endif // PROBING_HEATERS_OFF #endif // PROBING_HEATERS_OFF
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP) #if EITHER(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN)
void Temperature::singlenozzle_change(const uint8_t old_tool, const uint8_t new_tool) { void Temperature::singlenozzle_change(const uint8_t old_tool, const uint8_t new_tool) {
#if HAS_FAN #if ENABLED(SINGLENOZZLE_STANDBY_FAN)
singlenozzle_fan_speed[old_tool] = fan_speed[0]; singlenozzle_fan_speed[old_tool] = fan_speed[0];
fan_speed[0] = singlenozzle_fan_speed[new_tool]; fan_speed[0] = singlenozzle_fan_speed[new_tool];
#endif #endif
singlenozzle_temp[old_tool] = temp_hotend[0].target; #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) { singlenozzle_temp[old_tool] = temp_hotend[0].target;
setTargetHotend(singlenozzle_temp[new_tool], 0); if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
TERN_(AUTOTEMP, planner.autotemp_update()); setTargetHotend(singlenozzle_temp[new_tool], 0);
TERN_(HAS_STATUS_MESSAGE, set_heating_message(0)); TERN_(AUTOTEMP, planner.autotemp_update());
(void)wait_for_hotend(0, false); // Wait for heating or cooling TERN_(HAS_STATUS_MESSAGE, set_heating_message(0));
} (void)wait_for_hotend(0, false); // Wait for heating or cooling
}
#endif
} }
#endif #endif

View File

@ -372,9 +372,11 @@ class Temperature {
static inline bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); } static inline bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); }
static inline bool targetHotEnoughToExtrude(const uint8_t e) { return !targetTooColdToExtrude(e); } static inline bool targetHotEnoughToExtrude(const uint8_t e) { return !targetTooColdToExtrude(e); }
#if ENABLED(SINGLENOZZLE_STANDBY_FAN) #if EITHER(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN)
static celsius_t singlenozzle_temp[EXTRUDERS]; #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
#if HAS_FAN static celsius_t singlenozzle_temp[EXTRUDERS];
#endif
#if ENABLED(SINGLENOZZLE_STANDBY_FAN)
static uint8_t singlenozzle_fan_speed[EXTRUDERS]; static uint8_t singlenozzle_fan_speed[EXTRUDERS];
#endif #endif
static void singlenozzle_change(const uint8_t old_tool, const uint8_t new_tool); static void singlenozzle_change(const uint8_t old_tool, const uint8_t new_tool);

View File

@ -1194,7 +1194,9 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
const bool should_move = safe_to_move && !no_move && IsRunning(); const bool should_move = safe_to_move && !no_move && IsRunning();
if (should_move) { if (should_move) {
TERN_(SINGLENOZZLE_STANDBY_TEMP, thermalManager.singlenozzle_change(old_tool, new_tool)); #if EITHER(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN)
thermalManager.singlenozzle_change(old_tool, new_tool);
#endif
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP) #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
if (should_swap && !too_cold) { if (should_swap && !too_cold) {