Skip to content

Commit fd74261

Browse files
committed
🚸 Clear "heating/cooling" message on temp reached
1 parent 8dfdf51 commit fd74261

File tree

6 files changed

+29
-4
lines changed

6 files changed

+29
-4
lines changed

Marlin/src/gcode/temp/M104_M109.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void GcodeSuite::M104_M109(const bool isM109) {
126126
#endif
127127

128128
if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling)
129-
thermalManager.set_heating_message(target_extruder);
129+
thermalManager.set_heating_message(target_extruder, !isM109 && got_temp);
130130
}
131131

132132
TERN_(AUTOTEMP, planner.autotemp_M104_M109());

Marlin/src/gcode/temp/M140_M190.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ void GcodeSuite::M140_M190(const bool isM190) {
8989

9090
if (isM190)
9191
thermalManager.wait_for_bed(no_wait_for_cooling);
92+
else
93+
ui.set_status_reset_fn([]{
94+
const celsius_t c = thermalManager.degTargetBed();
95+
return c < 30 || thermalManager.degBedNear(c);
96+
});
9297
}
9398

9499
#endif // HAS_HEATED_BED

Marlin/src/lcd/marlinui.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
7373
#endif
7474
char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1];
7575
uint8_t MarlinUI::alert_level; // = 0
76+
statusResetFunc_t MarlinUI::status_reset_callback; // = nullptr
7677
#endif
7778

7879
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
@@ -627,6 +628,9 @@ void MarlinUI::init() {
627628

628629
#endif // BASIC_PROGRESS_BAR
629630

631+
if (status_reset_callback && (*status_reset_callback)())
632+
reset_status();
633+
630634
#if HAS_MARLINUI_MENU
631635
if (use_click()) {
632636
#if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
@@ -1515,6 +1519,8 @@ void MarlinUI::init() {
15151519

15161520
UNUSED(persist);
15171521

1522+
set_status_reset_fn();
1523+
15181524
#if HAS_WIRED_LCD
15191525

15201526
#if BASIC_PROGRESS_BAR || BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)

Marlin/src/lcd/marlinui.h

+6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959

6060
#define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80U)
6161

62+
typedef bool (*statusResetFunc_t)();
63+
6264
#if HAS_WIRED_LCD
6365

6466
enum LCDViewAction : uint8_t {
@@ -352,11 +354,15 @@ class MarlinUI {
352354
static void reset_status(const bool no_welcome=false);
353355
static void set_alert_status(FSTR_P const fstr);
354356
static void reset_alert_level() { alert_level = 0; }
357+
358+
static statusResetFunc_t status_reset_callback;
359+
static void set_status_reset_fn(const statusResetFunc_t fn=nullptr) { status_reset_callback = fn; }
355360
#else
356361
static constexpr bool has_status() { return false; }
357362
static void reset_status(const bool=false) {}
358363
static void set_alert_status(FSTR_P const) {}
359364
static void reset_alert_level() {}
365+
static void set_status_reset_fn(const statusResetFunc_t=nullptr) {}
360366
#endif
361367

362368
static void set_status(const char * const cstr, const bool persist=false);

Marlin/src/module/temperature.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -3631,7 +3631,7 @@ void Temperature::isr() {
36313631
#endif
36323632

36333633
#if HAS_HOTEND && HAS_STATUS_MESSAGE
3634-
void Temperature::set_heating_message(const uint8_t e) {
3634+
void Temperature::set_heating_message(const uint8_t e, const bool isM104/*=false*/) {
36353635
const bool heating = isHeatingHotend(e);
36363636
ui.status_printf(0,
36373637
#if HAS_MULTI_HOTEND
@@ -3641,6 +3641,14 @@ void Temperature::isr() {
36413641
#endif
36423642
, heating ? GET_TEXT(MSG_HEATING) : GET_TEXT(MSG_COOLING)
36433643
);
3644+
3645+
if (isM104) {
3646+
static uint8_t wait_e; wait_e = e;
3647+
ui.set_status_reset_fn([]{
3648+
const celsius_t c = degTargetHotend(wait_e);
3649+
return c < 30 || degHotendNear(wait_e, c);
3650+
});
3651+
}
36443652
}
36453653
#endif
36463654

Marlin/src/module/temperature.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -961,9 +961,9 @@ class Temperature {
961961
#endif
962962

963963
#if HAS_HOTEND && HAS_STATUS_MESSAGE
964-
static void set_heating_message(const uint8_t e);
964+
static void set_heating_message(const uint8_t e, const bool isM104=false);
965965
#else
966-
static void set_heating_message(const uint8_t) {}
966+
static void set_heating_message(const uint8_t, const bool=false) {}
967967
#endif
968968

969969
#if HAS_MARLINUI_MENU && HAS_TEMPERATURE

0 commit comments

Comments
 (0)