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
/**
* 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
*/

View file

@ -171,7 +171,7 @@ void menu_temperature() {
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
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
//

View file

@ -134,7 +134,7 @@ void menu_tune() {
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
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
//

View file

@ -466,9 +466,9 @@ volatile bool Temperature::raw_temps_ready = false;
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
celsius_t Temperature::singlenozzle_temp[EXTRUDERS];
#if HAS_FAN
uint8_t Temperature::singlenozzle_fan_speed[EXTRUDERS];
#endif
#endif
#if ENABLED(SINGLENOZZLE_STANDBY_FAN)
uint8_t Temperature::singlenozzle_fan_speed[EXTRUDERS];
#endif
#if ENABLED(PROBING_HEATERS_OFF)
@ -2500,20 +2500,22 @@ void Temperature::disable_all_heaters() {
#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) {
#if HAS_FAN
#if ENABLED(SINGLENOZZLE_STANDBY_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_STATUS_MESSAGE, set_heating_message(0));
(void)wait_for_hotend(0, false); // Wait for heating or cooling
}
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
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_STATUS_MESSAGE, set_heating_message(0));
(void)wait_for_hotend(0, false); // Wait for heating or cooling
}
#endif
}
#endif

View file

@ -372,9 +372,11 @@ class Temperature {
static inline bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); }
static inline bool targetHotEnoughToExtrude(const uint8_t e) { return !targetTooColdToExtrude(e); }
#if ENABLED(SINGLENOZZLE_STANDBY_FAN)
static celsius_t singlenozzle_temp[EXTRUDERS];
#if HAS_FAN
#if EITHER(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN)
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
static celsius_t singlenozzle_temp[EXTRUDERS];
#endif
#if ENABLED(SINGLENOZZLE_STANDBY_FAN)
static uint8_t singlenozzle_fan_speed[EXTRUDERS];
#endif
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();
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 (should_swap && !too_cold) {