Skip to content

Commit 8dfdf51

Browse files
committed
🎨 Format, use status macros
1 parent 4ff0634 commit 8dfdf51

File tree

11 files changed

+29
-31
lines changed

11 files changed

+29
-31
lines changed

Marlin/Configuration_adv.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1339,13 +1339,13 @@
13391339
#endif
13401340

13411341
#if EITHER(HAS_DISPLAY, DWIN_LCD_PROUI)
1342-
// The timeout (in ms) to return to the status screen from sub-menus
1343-
//#define LCD_TIMEOUT_TO_STATUS 15000
1342+
// The timeout to return to the status screen from sub-menus
1343+
//#define LCD_TIMEOUT_TO_STATUS 15000 // (ms)
13441344

13451345
#if ENABLED(SHOW_BOOTSCREEN)
1346-
#define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s)
1346+
#define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s)
13471347
#if EITHER(HAS_MARLINUI_U8GLIB, TFT_COLOR_UI)
1348-
#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving lots of flash)
1348+
#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving lots of flash)
13491349
#endif
13501350
#endif
13511351

@@ -3464,7 +3464,7 @@
34643464
#define SPINDLE_LASER_USE_PWM // Enable if your controller supports setting the speed/power
34653465
#if ENABLED(SPINDLE_LASER_USE_PWM)
34663466
#define SPINDLE_LASER_PWM_INVERT false // Set to "true" if the speed/power goes up when you want it to go slower
3467-
#define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR, ESP32 and LPC)
3467+
#define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR, ESP32, and LPC)
34683468
#endif
34693469

34703470
//#define AIR_EVACUATION // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11

Marlin/src/gcode/lcd/M117.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
void GcodeSuite::M117() {
3434

3535
if (parser.string_arg && parser.string_arg[0])
36-
ui.set_status(parser.string_arg);
36+
ui.set_status(parser.string_arg, true);
3737
else
3838
ui.reset_status();
3939

Marlin/src/gcode/temp/M140_M190.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,9 @@ void GcodeSuite::M140_M190(const bool isM190) {
8282
if (!got_temp) return;
8383

8484
thermalManager.setTargetBed(temp);
85+
thermalManager.isHeatingBed() ? LCD_MESSAGE(MSG_BED_HEATING) : LCD_MESSAGE(MSG_BED_COOLING);
8586

86-
ui.set_status(thermalManager.isHeatingBed() ? GET_TEXT_F(MSG_BED_HEATING) : GET_TEXT_F(MSG_BED_COOLING));
87-
88-
// with PRINTJOB_TIMER_AUTOSTART, M190 can start the timer, and M140 can stop it
87+
// With PRINTJOB_TIMER_AUTOSTART, M190 can start the timer, and M140 can stop it
8988
TERN_(PRINTJOB_TIMER_AUTOSTART, thermalManager.auto_job_check_timer(isM190, !isM190));
9089

9190
if (isM190)

Marlin/src/gcode/temp/M192.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void GcodeSuite::M192() {
4949
}
5050

5151
const celsius_t target_temp = parser.value_celsius();
52-
ui.set_status(thermalManager.isProbeBelowTemp(target_temp) ? GET_TEXT_F(MSG_PROBE_HEATING) : GET_TEXT_F(MSG_PROBE_COOLING));
52+
thermalManager.isProbeBelowTemp(target_temp) ? LCD_MESSAGE(MSG_PROBE_HEATING) : LCD_MESSAGE(MSG_PROBE_COOLING);
5353
thermalManager.wait_for_probe(target_temp, no_wait_for_cooling);
5454
}
5555

Marlin/src/lcd/e3v2/proui/dwin.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2304,7 +2304,7 @@ TERN(HAS_ONESTEP_LEVELING, float, void) Tram(uint8_t point) {
23042304
inLev = true;
23052305
zval = probe.probe_at_point(xpos, ypos, PROBE_PT_STOW);
23062306
if (isnan(zval))
2307-
ui.set_status(F("Position Not Reachable, check offsets"));
2307+
LCD_MESSAGE_F("Position Not Reachable, check offsets");
23082308
else {
23092309
sprintf_P(cmd, PSTR("X:%s, Y:%s, Z:%s"),
23102310
dtostrf(xpos, 1, 1, str_1),
@@ -2336,7 +2336,7 @@ void TramC () { Tram(4); }
23362336
void Trammingwizard() {
23372337
bed_mesh_t zval = {0};
23382338
if (HMI_data.FullManualTramming) {
2339-
ui.set_status(F("Disable manual tramming"));
2339+
LCD_MESSAGE_F("Disable manual tramming");
23402340
return;
23412341
}
23422342
zval[0][0] = Tram(0);

Marlin/src/lcd/marlinui.cpp

+11-3
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ void MarlinUI::init() {
593593
// share the same line on the display.
594594
//
595595

596-
#if DISABLED(PROGRESS_MSG_ONCE) || (PROGRESS_MSG_EXPIRE > 0)
596+
#if DISABLED(PROGRESS_MSG_ONCE) || PROGRESS_MSG_EXPIRE > 0
597597
#define GOT_MS
598598
const millis_t ms = millis();
599599
#endif
@@ -1420,6 +1420,7 @@ void MarlinUI::init() {
14201420
#if SERVICE_INTERVAL_3 > 0
14211421
static PGMSTR(service3, "> " SERVICE_NAME_3 "!");
14221422
#endif
1423+
14231424
FSTR_P msg;
14241425
if (printingIsPaused())
14251426
msg = GET_TEXT_F(MSG_PRINT_PAUSED);
@@ -1450,13 +1451,18 @@ void MarlinUI::init() {
14501451
set_status(msg, -1);
14511452
}
14521453

1454+
/**
1455+
* Set Status with a fixed string and alert level.
1456+
* @param fstr A constant F-string to set as the status.
1457+
* @param level Alert level. Negative to ignore and reset the level. Non-zero never expires.
1458+
*/
14531459
void MarlinUI::set_status(FSTR_P const fstr, int8_t level) {
1454-
PGM_P const pstr = FTOP(fstr);
1460+
// Alerts block lower priority messages
14551461
if (level < 0) level = alert_level = 0;
14561462
if (level < alert_level) return;
14571463
alert_level = level;
14581464

1459-
TERN_(HOST_STATUS_NOTIFICATIONS, hostui.notify(fstr));
1465+
PGM_P const pstr = FTOP(fstr);
14601466

14611467
// Since the message is encoded in UTF8 it must
14621468
// only be cut on a character boundary.
@@ -1476,6 +1482,8 @@ void MarlinUI::init() {
14761482
strncpy_P(status_message, pstr, maxLen);
14771483
status_message[maxLen] = '\0';
14781484

1485+
TERN_(HOST_STATUS_NOTIFICATIONS, hostui.notify(fstr));
1486+
14791487
finish_status(level > 0);
14801488
}
14811489

Marlin/src/lcd/marlinui.h

-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@
3939
#define HAS_ENCODER_ACTION 1
4040
#endif
4141

42-
#if HAS_STATUS_MESSAGE
43-
#define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80U)
44-
#endif
45-
4642
#if E_MANUAL > 1
4743
#define MULTI_E_MANUAL 1
4844
#endif

Marlin/src/module/motion.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@
2929
#include "stepper.h"
3030
#include "planner.h"
3131
#include "temperature.h"
32-
3332
#include "../gcode/gcode.h"
34-
33+
#include "../lcd/marlinui.h"
3534
#include "../inc/MarlinConfig.h"
3635

3736
#if IS_SCARA
@@ -51,10 +50,6 @@
5150
#include "../feature/bltouch.h"
5251
#endif
5352

54-
#if HAS_STATUS_MESSAGE
55-
#include "../lcd/marlinui.h"
56-
#endif
57-
5853
#if HAS_FILAMENT_SENSOR
5954
#include "../feature/runout.h"
6055
#endif
@@ -1325,7 +1320,7 @@ void prepare_line_to_destination() {
13251320
);
13261321
SERIAL_ECHO_START();
13271322
SERIAL_ECHOLN(msg);
1328-
TERN_(HAS_STATUS_MESSAGE, ui.set_status(msg));
1323+
ui.set_status(msg);
13291324
return true;
13301325
}
13311326
return false;

Marlin/src/module/probe.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
313313
ui.set_status(ds_str, 99);
314314
SERIAL_ECHOLNF(deploy ? GET_EN_TEXT_F(MSG_MANUAL_DEPLOY) : GET_EN_TEXT_F(MSG_MANUAL_STOW));
315315

316-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("Stow Probe"), FPSTR(CONTINUE_STR)));
317-
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Stow Probe")));
318-
TERN_(DWIN_LCD_PROUI, DWIN_Popup_Confirm(ICON_BLTouch, F("Stow Probe"), FPSTR(CONTINUE_STR)));
316+
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, ds_str, FPSTR(CONTINUE_STR)));
317+
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(ds_str));
318+
TERN_(DWIN_LCD_PROUI, DWIN_Popup_Confirm(ICON_BLTouch, ds_str, FPSTR(CONTINUE_STR)));
319319
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
320320
ui.reset_status();
321321

Marlin/src/module/temperature.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ volatile bool Temperature::raw_temps_ready = false;
651651

652652
// PID Tuning loop
653653
wait_for_heatup = true; // Can be interrupted with M108
654-
TERN_(HAS_STATUS_MESSAGE, ui.set_status(F("Wait for heat up...")));
654+
LCD_MESSAGE(MSG_HEATING);
655655
while (wait_for_heatup) {
656656

657657
const millis_t ms = millis();

Marlin/src/sd/cardreader.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ void CardReader::mount() {
458458
cdroot();
459459
#if ENABLED(USB_FLASH_DRIVE_SUPPORT) || PIN_EXISTS(SD_DETECT)
460460
else if (marlin_state != MF_INITIALIZING)
461-
ui.set_status(GET_TEXT_F(MSG_MEDIA_INIT_FAIL), -1);
461+
LCD_ALERTMESSAGE(MSG_MEDIA_INIT_FAIL);
462462
#endif
463463

464464
ui.refresh();

0 commit comments

Comments
 (0)