Skip to content

Commit

Permalink
Fix Singlenozzle Standby issues (#21759)
Browse files Browse the repository at this point in the history
Fixes #21758

Co-authored-by: Scott Lahteine <[email protected]>
  • Loading branch information
ellensp and thinkyhead authored May 1, 2021
1 parent 8c912d7 commit ef9ca61
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 18 deletions.
10 changes: 10 additions & 0 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

//
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_tune.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

//
Expand Down
26 changes: 14 additions & 12 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions Marlin/src/module/temperature.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/module/tool_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ef9ca61

Please sign in to comment.