Browse Source

🎨 Format, use status macros

Scott Lahteine 3 years ago
parent
commit
8dfdf51678

+ 5
- 5
Marlin/Configuration_adv.h View File

1339
 #endif
1339
 #endif
1340
 
1340
 
1341
 #if EITHER(HAS_DISPLAY, DWIN_LCD_PROUI)
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
   #if ENABLED(SHOW_BOOTSCREEN)
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
     #if EITHER(HAS_MARLINUI_U8GLIB, TFT_COLOR_UI)
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
     #endif
1349
     #endif
1350
   #endif
1350
   #endif
1351
 
1351
 
3464
   #define SPINDLE_LASER_USE_PWM                // Enable if your controller supports setting the speed/power
3464
   #define SPINDLE_LASER_USE_PWM                // Enable if your controller supports setting the speed/power
3465
   #if ENABLED(SPINDLE_LASER_USE_PWM)
3465
   #if ENABLED(SPINDLE_LASER_USE_PWM)
3466
     #define SPINDLE_LASER_PWM_INVERT    false  // Set to "true" if the speed/power goes up when you want it to go slower
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
   #endif
3468
   #endif
3469
 
3469
 
3470
   //#define AIR_EVACUATION                     // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11
3470
   //#define AIR_EVACUATION                     // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11

+ 1
- 1
Marlin/src/gcode/lcd/M117.cpp View File

33
 void GcodeSuite::M117() {
33
 void GcodeSuite::M117() {
34
 
34
 
35
   if (parser.string_arg && parser.string_arg[0])
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
   else
37
   else
38
     ui.reset_status();
38
     ui.reset_status();
39
 
39
 

+ 2
- 3
Marlin/src/gcode/temp/M140_M190.cpp View File

82
   if (!got_temp) return;
82
   if (!got_temp) return;
83
 
83
 
84
   thermalManager.setTargetBed(temp);
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
   TERN_(PRINTJOB_TIMER_AUTOSTART, thermalManager.auto_job_check_timer(isM190, !isM190));
88
   TERN_(PRINTJOB_TIMER_AUTOSTART, thermalManager.auto_job_check_timer(isM190, !isM190));
90
 
89
 
91
   if (isM190)
90
   if (isM190)

+ 1
- 1
Marlin/src/gcode/temp/M192.cpp View File

49
   }
49
   }
50
 
50
 
51
   const celsius_t target_temp = parser.value_celsius();
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
   thermalManager.wait_for_probe(target_temp, no_wait_for_cooling);
53
   thermalManager.wait_for_probe(target_temp, no_wait_for_cooling);
54
 }
54
 }
55
 
55
 

+ 2
- 2
Marlin/src/lcd/e3v2/proui/dwin.cpp View File

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

+ 11
- 3
Marlin/src/lcd/marlinui.cpp View File

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

+ 0
- 4
Marlin/src/lcd/marlinui.h View File

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

+ 2
- 7
Marlin/src/module/motion.cpp View File

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

+ 3
- 3
Marlin/src/module/probe.cpp View File

313
       ui.set_status(ds_str, 99);
313
       ui.set_status(ds_str, 99);
314
       SERIAL_ECHOLNF(deploy ? GET_EN_TEXT_F(MSG_MANUAL_DEPLOY) : GET_EN_TEXT_F(MSG_MANUAL_STOW));
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
       TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
319
       TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
320
       ui.reset_status();
320
       ui.reset_status();
321
 
321
 

+ 1
- 1
Marlin/src/module/temperature.cpp View File

651
 
651
 
652
     // PID Tuning loop
652
     // PID Tuning loop
653
     wait_for_heatup = true; // Can be interrupted with M108
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
     while (wait_for_heatup) {
655
     while (wait_for_heatup) {
656
 
656
 
657
       const millis_t ms = millis();
657
       const millis_t ms = millis();

+ 1
- 1
Marlin/src/sd/cardreader.cpp View File

458
     cdroot();
458
     cdroot();
459
   #if ENABLED(USB_FLASH_DRIVE_SUPPORT) || PIN_EXISTS(SD_DETECT)
459
   #if ENABLED(USB_FLASH_DRIVE_SUPPORT) || PIN_EXISTS(SD_DETECT)
460
     else if (marlin_state != MF_INITIALIZING)
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
   #endif
462
   #endif
463
 
463
 
464
   ui.refresh();
464
   ui.refresh();

Loading…
Cancel
Save