瀏覽代碼

🎨 Format, use status macros

Scott Lahteine 2 年之前
父節點
當前提交
8dfdf51678

+ 5
- 5
Marlin/Configuration_adv.h 查看文件

@@ -1339,13 +1339,13 @@
1339 1339
 #endif
1340 1340
 
1341 1341
 #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)
1344 1344
 
1345 1345
   #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)
1347 1347
     #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)
1349 1349
     #endif
1350 1350
   #endif
1351 1351
 
@@ -3464,7 +3464,7 @@
3464 3464
   #define SPINDLE_LASER_USE_PWM                // Enable if your controller supports setting the speed/power
3465 3465
   #if ENABLED(SPINDLE_LASER_USE_PWM)
3466 3466
     #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)
3468 3468
   #endif
3469 3469
 
3470 3470
   //#define AIR_EVACUATION                     // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11

+ 1
- 1
Marlin/src/gcode/lcd/M117.cpp 查看文件

@@ -33,7 +33,7 @@
33 33
 void GcodeSuite::M117() {
34 34
 
35 35
   if (parser.string_arg && parser.string_arg[0])
36
-    ui.set_status(parser.string_arg);
36
+    ui.set_status(parser.string_arg, true);
37 37
   else
38 38
     ui.reset_status();
39 39
 

+ 2
- 3
Marlin/src/gcode/temp/M140_M190.cpp 查看文件

@@ -82,10 +82,9 @@ void GcodeSuite::M140_M190(const bool isM190) {
82 82
   if (!got_temp) return;
83 83
 
84 84
   thermalManager.setTargetBed(temp);
85
+  thermalManager.isHeatingBed() ? LCD_MESSAGE(MSG_BED_HEATING) : LCD_MESSAGE(MSG_BED_COOLING);
85 86
 
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
89 88
   TERN_(PRINTJOB_TIMER_AUTOSTART, thermalManager.auto_job_check_timer(isM190, !isM190));
90 89
 
91 90
   if (isM190)

+ 1
- 1
Marlin/src/gcode/temp/M192.cpp 查看文件

@@ -49,7 +49,7 @@ void GcodeSuite::M192() {
49 49
   }
50 50
 
51 51
   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);
53 53
   thermalManager.wait_for_probe(target_temp, no_wait_for_cooling);
54 54
 }
55 55
 

+ 2
- 2
Marlin/src/lcd/e3v2/proui/dwin.cpp 查看文件

@@ -2304,7 +2304,7 @@ TERN(HAS_ONESTEP_LEVELING, float, void) Tram(uint8_t point) {
2304 2304
       inLev = true;
2305 2305
       zval = probe.probe_at_point(xpos, ypos, PROBE_PT_STOW);
2306 2306
       if (isnan(zval))
2307
-        ui.set_status(F("Position Not Reachable, check offsets"));
2307
+        LCD_MESSAGE_F("Position Not Reachable, check offsets");
2308 2308
       else {
2309 2309
         sprintf_P(cmd, PSTR("X:%s, Y:%s, Z:%s"),
2310 2310
           dtostrf(xpos, 1, 1, str_1),
@@ -2336,7 +2336,7 @@ void TramC () { Tram(4); }
2336 2336
   void Trammingwizard() {
2337 2337
     bed_mesh_t zval = {0};
2338 2338
     if (HMI_data.FullManualTramming) {
2339
-      ui.set_status(F("Disable manual tramming"));
2339
+      LCD_MESSAGE_F("Disable manual tramming");
2340 2340
       return;
2341 2341
     }
2342 2342
     zval[0][0] = Tram(0);

+ 11
- 3
Marlin/src/lcd/marlinui.cpp 查看文件

@@ -593,7 +593,7 @@ void MarlinUI::init() {
593 593
       // share the same line on the display.
594 594
       //
595 595
 
596
-      #if DISABLED(PROGRESS_MSG_ONCE) || (PROGRESS_MSG_EXPIRE > 0)
596
+      #if DISABLED(PROGRESS_MSG_ONCE) || PROGRESS_MSG_EXPIRE > 0
597 597
         #define GOT_MS
598 598
         const millis_t ms = millis();
599 599
       #endif
@@ -1420,6 +1420,7 @@ void MarlinUI::init() {
1420 1420
     #if SERVICE_INTERVAL_3 > 0
1421 1421
       static PGMSTR(service3, "> " SERVICE_NAME_3 "!");
1422 1422
     #endif
1423
+
1423 1424
     FSTR_P msg;
1424 1425
     if (printingIsPaused())
1425 1426
       msg = GET_TEXT_F(MSG_PRINT_PAUSED);
@@ -1450,13 +1451,18 @@ void MarlinUI::init() {
1450 1451
     set_status(msg, -1);
1451 1452
   }
1452 1453
 
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
+   */
1453 1459
   void MarlinUI::set_status(FSTR_P const fstr, int8_t level) {
1454
-    PGM_P const pstr = FTOP(fstr);
1460
+    // Alerts block lower priority messages
1455 1461
     if (level < 0) level = alert_level = 0;
1456 1462
     if (level < alert_level) return;
1457 1463
     alert_level = level;
1458 1464
 
1459
-    TERN_(HOST_STATUS_NOTIFICATIONS, hostui.notify(fstr));
1465
+    PGM_P const pstr = FTOP(fstr);
1460 1466
 
1461 1467
     // Since the message is encoded in UTF8 it must
1462 1468
     // only be cut on a character boundary.
@@ -1476,6 +1482,8 @@ void MarlinUI::init() {
1476 1482
     strncpy_P(status_message, pstr, maxLen);
1477 1483
     status_message[maxLen] = '\0';
1478 1484
 
1485
+    TERN_(HOST_STATUS_NOTIFICATIONS, hostui.notify(fstr));
1486
+
1479 1487
     finish_status(level > 0);
1480 1488
   }
1481 1489
 

+ 0
- 4
Marlin/src/lcd/marlinui.h 查看文件

@@ -39,10 +39,6 @@
39 39
   #define HAS_ENCODER_ACTION 1
40 40
 #endif
41 41
 
42
-#if HAS_STATUS_MESSAGE
43
-  #define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80U)
44
-#endif
45
-
46 42
 #if E_MANUAL > 1
47 43
   #define MULTI_E_MANUAL 1
48 44
 #endif

+ 2
- 7
Marlin/src/module/motion.cpp 查看文件

@@ -29,9 +29,8 @@
29 29
 #include "stepper.h"
30 30
 #include "planner.h"
31 31
 #include "temperature.h"
32
-
33 32
 #include "../gcode/gcode.h"
34
-
33
+#include "../lcd/marlinui.h"
35 34
 #include "../inc/MarlinConfig.h"
36 35
 
37 36
 #if IS_SCARA
@@ -51,10 +50,6 @@
51 50
   #include "../feature/bltouch.h"
52 51
 #endif
53 52
 
54
-#if HAS_STATUS_MESSAGE
55
-  #include "../lcd/marlinui.h"
56
-#endif
57
-
58 53
 #if HAS_FILAMENT_SENSOR
59 54
   #include "../feature/runout.h"
60 55
 #endif
@@ -1325,7 +1320,7 @@ void prepare_line_to_destination() {
1325 1320
       );
1326 1321
       SERIAL_ECHO_START();
1327 1322
       SERIAL_ECHOLN(msg);
1328
-      TERN_(HAS_STATUS_MESSAGE, ui.set_status(msg));
1323
+      ui.set_status(msg);
1329 1324
       return true;
1330 1325
     }
1331 1326
     return false;

+ 3
- 3
Marlin/src/module/probe.cpp 查看文件

@@ -313,9 +313,9 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
313 313
       ui.set_status(ds_str, 99);
314 314
       SERIAL_ECHOLNF(deploy ? GET_EN_TEXT_F(MSG_MANUAL_DEPLOY) : GET_EN_TEXT_F(MSG_MANUAL_STOW));
315 315
 
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)));
319 319
       TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
320 320
       ui.reset_status();
321 321
 

+ 1
- 1
Marlin/src/module/temperature.cpp 查看文件

@@ -651,7 +651,7 @@ volatile bool Temperature::raw_temps_ready = false;
651 651
 
652 652
     // PID Tuning loop
653 653
     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);
655 655
     while (wait_for_heatup) {
656 656
 
657 657
       const millis_t ms = millis();

+ 1
- 1
Marlin/src/sd/cardreader.cpp 查看文件

@@ -458,7 +458,7 @@ void CardReader::mount() {
458 458
     cdroot();
459 459
   #if ENABLED(USB_FLASH_DRIVE_SUPPORT) || PIN_EXISTS(SD_DETECT)
460 460
     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);
462 462
   #endif
463 463
 
464 464
   ui.refresh();

Loading…
取消
儲存