🚸 Clear "heating/cooling" message on temp reached

This commit is contained in:
Scott Lahteine 2022-03-25 17:35:00 -05:00 committed by Scott Lahteine
parent 9324132a40
commit 0e693854d0
6 changed files with 29 additions and 4 deletions

View File

@ -126,7 +126,7 @@ void GcodeSuite::M104_M109(const bool isM109) {
#endif #endif
if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling) if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling)
thermalManager.set_heating_message(target_extruder); thermalManager.set_heating_message(target_extruder, !isM109 && got_temp);
} }
TERN_(AUTOTEMP, planner.autotemp_M104_M109()); TERN_(AUTOTEMP, planner.autotemp_M104_M109());

View File

@ -89,6 +89,11 @@ void GcodeSuite::M140_M190(const bool isM190) {
if (isM190) if (isM190)
thermalManager.wait_for_bed(no_wait_for_cooling); thermalManager.wait_for_bed(no_wait_for_cooling);
else
ui.set_status_reset_fn([]{
const celsius_t c = thermalManager.degTargetBed();
return c < 30 || thermalManager.degBedNear(c);
});
} }
#endif // HAS_HEATED_BED #endif // HAS_HEATED_BED

View File

@ -73,6 +73,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#endif #endif
char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1]; char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1];
uint8_t MarlinUI::alert_level; // = 0 uint8_t MarlinUI::alert_level; // = 0
statusResetFunc_t MarlinUI::status_reset_callback; // = nullptr
#endif #endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
@ -627,6 +628,9 @@ void MarlinUI::init() {
#endif // BASIC_PROGRESS_BAR #endif // BASIC_PROGRESS_BAR
if (status_reset_callback && (*status_reset_callback)())
reset_status();
#if HAS_MARLINUI_MENU #if HAS_MARLINUI_MENU
if (use_click()) { if (use_click()) {
#if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) #if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
@ -1515,6 +1519,8 @@ void MarlinUI::init() {
UNUSED(persist); UNUSED(persist);
set_status_reset_fn();
#if HAS_WIRED_LCD #if HAS_WIRED_LCD
#if BASIC_PROGRESS_BAR || BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) #if BASIC_PROGRESS_BAR || BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)

View File

@ -59,6 +59,8 @@
#define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80U) #define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80U)
typedef bool (*statusResetFunc_t)();
#if HAS_WIRED_LCD #if HAS_WIRED_LCD
enum LCDViewAction : uint8_t { enum LCDViewAction : uint8_t {
@ -352,11 +354,15 @@ public:
static void reset_status(const bool no_welcome=false); static void reset_status(const bool no_welcome=false);
static void set_alert_status(FSTR_P const fstr); static void set_alert_status(FSTR_P const fstr);
static void reset_alert_level() { alert_level = 0; } static void reset_alert_level() { alert_level = 0; }
static statusResetFunc_t status_reset_callback;
static void set_status_reset_fn(const statusResetFunc_t fn=nullptr) { status_reset_callback = fn; }
#else #else
static constexpr bool has_status() { return false; } static constexpr bool has_status() { return false; }
static void reset_status(const bool=false) {} static void reset_status(const bool=false) {}
static void set_alert_status(FSTR_P const) {} static void set_alert_status(FSTR_P const) {}
static void reset_alert_level() {} static void reset_alert_level() {}
static void set_status_reset_fn(const statusResetFunc_t=nullptr) {}
#endif #endif
static void set_status(const char * const cstr, const bool persist=false); static void set_status(const char * const cstr, const bool persist=false);

View File

@ -3631,7 +3631,7 @@ void Temperature::isr() {
#endif #endif
#if HAS_HOTEND && HAS_STATUS_MESSAGE #if HAS_HOTEND && HAS_STATUS_MESSAGE
void Temperature::set_heating_message(const uint8_t e) { void Temperature::set_heating_message(const uint8_t e, const bool isM104/*=false*/) {
const bool heating = isHeatingHotend(e); const bool heating = isHeatingHotend(e);
ui.status_printf(0, ui.status_printf(0,
#if HAS_MULTI_HOTEND #if HAS_MULTI_HOTEND
@ -3641,6 +3641,14 @@ void Temperature::isr() {
#endif #endif
, heating ? GET_TEXT(MSG_HEATING) : GET_TEXT(MSG_COOLING) , heating ? GET_TEXT(MSG_HEATING) : GET_TEXT(MSG_COOLING)
); );
if (isM104) {
static uint8_t wait_e; wait_e = e;
ui.set_status_reset_fn([]{
const celsius_t c = degTargetHotend(wait_e);
return c < 30 || degHotendNear(wait_e, c);
});
}
} }
#endif #endif

View File

@ -961,9 +961,9 @@ class Temperature {
#endif #endif
#if HAS_HOTEND && HAS_STATUS_MESSAGE #if HAS_HOTEND && HAS_STATUS_MESSAGE
static void set_heating_message(const uint8_t e); static void set_heating_message(const uint8_t e, const bool isM104=false);
#else #else
static void set_heating_message(const uint8_t) {} static void set_heating_message(const uint8_t, const bool=false) {}
#endif #endif
#if HAS_MARLINUI_MENU && HAS_TEMPERATURE #if HAS_MARLINUI_MENU && HAS_TEMPERATURE