Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gui: Add option to automatically cooldown after filament unload #3700

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/gui/MItem_filament.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,18 @@ bool MI_PURGE::AvailableForAnyTool() {
void MI_PURGE::UpdateEnableState() {
set_enabled(AvailableForAnyTool());
}

/*****************************************************************************/
// MI_AUTO_COOLDOWN
/*****************************************************************************/
bool MI_AUTO_COOLDOWN::init_index() const {
return config_store().auto_cooldown_enabled.get();
}

void MI_AUTO_COOLDOWN::OnChange(size_t old_index) {
if (old_index) {
config_store().auto_cooldown_enabled.set(false);
} else {
config_store().auto_cooldown_enabled.set(true);
}
}
23 changes: 23 additions & 0 deletions src/gui/MItem_filament.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @brief menu items for filament menu
*/
#pragma once
#include "WindowMenuItems.hpp"

#include <i_window_menu_item.hpp>
#include <i18n.h>
Expand Down Expand Up @@ -59,3 +60,25 @@ class MI_PURGE : public IWindowMenuItem {

void UpdateEnableState();
};

class MI_COOLDOWN : public IWindowMenuItem {
static constexpr const char *const label = N_("Cooldown");

public:
MI_COOLDOWN();

protected:
virtual void click(IWindowMenu & /*window_menu*/) override;
};

class MI_AUTO_COOLDOWN : public WI_ICON_SWITCH_OFF_ON_t {
constexpr static const char *const label = N_("Cooldown after unload");
bool init_index() const;

public:
MI_AUTO_COOLDOWN()
: WI_ICON_SWITCH_OFF_ON_t(init_index(), _(label), nullptr, is_enabled_t::yes, is_hidden_t::no) {}

protected:
virtual void OnChange(size_t old_index) override;
};
1 change: 1 addition & 0 deletions src/gui/screen_menu_temperature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ using ScreenBase = ScreenMenu<
#if HAS_XBUDDY_EXTENSION()
MI_XBUDDY_EXTENSION_COOLING_FANS,
#endif
MI_AUTO_COOLDOWN,
MI_COOLDOWN>;

} // namespace screen_menu_temperature
Expand Down
7 changes: 7 additions & 0 deletions src/marlin_stubs/pause/M701_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ void filament_gcodes::M70X_process_user_response(PreheatStatus::Result res, uint
thermalManager.set_fan_speed(0, 0);
break;
case PreheatStatus::Result::DoneNoFilament:
if (config_store().auto_cooldown_enabled.get()) {
thermalManager.setTargetHotend(0, 0);
thermalManager.setTargetBed(0);
marlin_server::set_temp_to_display(0, 0);
thermalManager.set_fan_speed(0, 0);
}
break;
case PreheatStatus::Result::Aborted:
case PreheatStatus::Result::Error:
case PreheatStatus::Result::DidNotFinish: // cannot happen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ struct CurrentStore
StoreItem<bool, input_shaper::weight_adjust_enabled_default, journal::hash("Input Shaper Weight Adjust Y Enabled V2")> input_shaper_weight_adjust_y_enabled;
StoreItem<input_shaper::WeightAdjustConfig, input_shaper::weight_adjust_y_default, journal::hash("Input Shaper Weight Adjust Y Config")> input_shaper_weight_adjust_y_config;

StoreItem<bool, false, journal::hash("Enable auto cooldown on unload")> auto_cooldown_enabled;

input_shaper::Config get_input_shaper_config();
void set_input_shaper_config(const input_shaper::Config &);

Expand Down