Преглед на файлове

🎨 Apply F() to E3V2 titles, popups

Scott Lahteine преди 2 години
родител
ревизия
64a919da2a

+ 4
- 1
Marlin/src/gcode/lcd/M0_M1.cpp Целия файл

@@ -71,7 +71,10 @@ void GcodeSuite::M0_M1() {
71 71
     else
72 72
       ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT));
73 73
   #elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
74
-    DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg ?: GET_TEXT(MSG_STOPPED), GET_TEXT(MSG_USERWAIT));
74
+    if (parser.string_arg)
75
+      DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT));
76
+    else
77
+      DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT));
75 78
   #else
76 79
 
77 80
     if (parser.string_arg) {

+ 4
- 3
Marlin/src/lcd/e3v2/common/dwin_api.h Целия файл

@@ -174,9 +174,10 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
174 174
 //  rlimit: For draw less chars than string length use rlimit
175 175
 void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit=0xFFFF);
176 176
 
177
-inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, FSTR_P title) {
178
-  // Note that this won't work on AVR, only 32-bit systems!
179
-  DWIN_Draw_String(bShow, size, color, bColor, x, y, FTOP(title));
177
+inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, FSTR_P const ftitle) {
178
+  char ctitle[strlen_P(FTOP(ftitle)) + 1];
179
+  strcpy_P(ctitle, FTOP(ftitle));
180
+  DWIN_Draw_String(bShow, size, color, bColor, x, y, ctitle);
180 181
 }
181 182
 
182 183
 // Draw a positive integer

+ 27
- 23
Marlin/src/lcd/e3v2/creality/dwin.cpp Целия файл

@@ -359,12 +359,8 @@ inline void Clear_Title_Bar() {
359 359
   DWIN_Draw_Box(1, Color_Bg_Blue, 0, 0, DWIN_WIDTH, TITLE_HEIGHT);
360 360
 }
361 361
 
362
-void Draw_Title(const char * const title) {
363
-  DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
364
-}
365
-
366
-void Draw_Title(FSTR_P title) {
367
-  DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
362
+void Draw_Title(FSTR_P ftitle) {
363
+  DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, ftitle);
368 364
 }
369 365
 
370 366
 inline void Clear_Menu_Area() {
@@ -420,18 +416,25 @@ inline uint16_t nr_sd_menu_items() {
420 416
   return card.get_num_Files() + !card.flag.workDirIsRoot;
421 417
 }
422 418
 
419
+void Erase_Menu_Text(const uint8_t line) {
420
+  DWIN_Draw_Rectangle(1, Color_Bg_Black, LBLX, MBASE(line) - 14, 271, MBASE(line) + 28);
421
+}
422
+
423 423
 void Draw_Menu_Icon(const uint8_t line, const uint8_t icon) {
424 424
   DWIN_ICON_Show(ICON, icon, 26, MBASE(line) - 3);
425 425
 }
426 426
 
427
-void Erase_Menu_Text(const uint8_t line) {
428
-  DWIN_Draw_Rectangle(1, Color_Bg_Black, LBLX, MBASE(line) - 14, 271, MBASE(line) + 28);
427
+void _Decorate_Menu_Item(const uint8_t line, const uint8_t icon, bool more) {
428
+  if (icon) Draw_Menu_Icon(line, icon);
429
+  if (more) Draw_More_Icon(line);
429 430
 }
430
-
431 431
 void Draw_Menu_Item(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) {
432 432
   if (label) DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, (char*)label);
433
-  if (icon) Draw_Menu_Icon(line, icon);
434
-  if (more) Draw_More_Icon(line);
433
+  _Decorate_Menu_Item(line, icon, more);
434
+}
435
+void Draw_Menu_Item(const uint8_t line, const uint8_t icon=0, FSTR_P const flabel=nullptr, bool more=false) {
436
+  if (flabel) DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, flabel);
437
+  _Decorate_Menu_Item(line, icon, more);
435 438
 }
436 439
 
437 440
 void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) {
@@ -439,13 +442,14 @@ void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const
439 442
   DWIN_Draw_Line(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34);
440 443
 }
441 444
 
442
-void Draw_Menu_LineF(const uint8_t line, const uint8_t icon=0, FSTR_P label=nullptr, bool more=false) {
443
-  Draw_Menu_Line(line, icon, (char*)label, more);
445
+void Draw_Menu_Line(const uint8_t line, const uint8_t icon, FSTR_P const flabel, bool more=false) {
446
+  Draw_Menu_Item(line, icon, flabel, more);
447
+  DWIN_Draw_Line(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34);
444 448
 }
445 449
 
446 450
 void Draw_Checkbox_Line(const uint8_t line, const bool ison) {
447 451
   const uint16_t x = 225, y = EBASE(line) - 2;
448
-  DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, x + 5, y, F(ison ? "X" : " "));
452
+  DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, x + 5, y, ison ? F("X") : F(" "));
449 453
   DWIN_Draw_Rectangle(0, Color_White, x + 2, y + 2, x + 16, y + 16);
450 454
 }
451 455
 
@@ -1853,7 +1857,7 @@ void Draw_SDItem(const uint16_t item, int16_t row=-1) {
1853 1857
   if (row < 0) row = item + 1 + MROWS - index_file;
1854 1858
   const bool is_subdir = !card.flag.workDirIsRoot;
1855 1859
   if (is_subdir && item == 0) {
1856
-    Draw_Menu_Line(row, ICON_Folder, "..");
1860
+    Draw_Menu_Line(row, ICON_Folder, F(".."));
1857 1861
     return;
1858 1862
   }
1859 1863
 
@@ -2531,7 +2535,7 @@ void Item_HomeOffs_X(const uint8_t row) {
2531 2535
   }
2532 2536
   else {
2533 2537
     #ifdef USE_STRING_TITLES
2534
-      Draw_Menu_LineF(row, ICON_HomeOffsetX, GET_TEXT_F(MSG_HOME_OFFSET_X));
2538
+      Draw_Menu_Line(row, ICON_HomeOffsetX, GET_TEXT_F(MSG_HOME_OFFSET_X));
2535 2539
     #else
2536 2540
       say_home_offs_en(row); say_x_en(75, row);   // "Home Offset X"
2537 2541
     #endif
@@ -2546,7 +2550,7 @@ void Item_HomeOffs_Y(const uint8_t row) {
2546 2550
   }
2547 2551
   else {
2548 2552
     #ifdef USE_STRING_TITLES
2549
-      Draw_Menu_LineF(row, ICON_HomeOffsetY, GET_TEXT_F(MSG_HOME_OFFSET_Y));
2553
+      Draw_Menu_Line(row, ICON_HomeOffsetY, GET_TEXT_F(MSG_HOME_OFFSET_Y));
2550 2554
     #else
2551 2555
       say_home_offs_en(row); say_y_en(75, row);   // "Home Offset X"
2552 2556
     #endif
@@ -2561,7 +2565,7 @@ void Item_HomeOffs_Z(const uint8_t row) {
2561 2565
   }
2562 2566
   else {
2563 2567
     #ifdef USE_STRING_TITLES
2564
-      Draw_Menu_LineF(row, ICON_HomeOffsetZ, GET_TEXT_F(MSG_HOME_OFFSET_Z));
2568
+      Draw_Menu_Line(row, ICON_HomeOffsetZ, GET_TEXT_F(MSG_HOME_OFFSET_Z));
2565 2569
     #else
2566 2570
       say_home_offs_en(row); say_z_en(75, row);   // "Home Offset Z"
2567 2571
     #endif
@@ -2604,8 +2608,8 @@ void Draw_HomeOff_Menu() {
2604 2608
         DWIN_Frame_TitleCopy(124, 431, 91, 12);                             // "Probe Offsets"
2605 2609
       #endif
2606 2610
       #ifdef USE_STRING_TITLES
2607
-        Draw_Menu_LineF(1, ICON_ProbeOffsetX, GET_TEXT_F(MSG_ZPROBE_XOFFSET));  // Probe X Offset
2608
-        Draw_Menu_LineF(2, ICON_ProbeOffsetY, GET_TEXT_F(MSG_ZPROBE_YOFFSET));  // Probe Y Offset
2611
+        Draw_Menu_Line(1, ICON_ProbeOffsetX, GET_TEXT_F(MSG_ZPROBE_XOFFSET));  // Probe X Offset
2612
+        Draw_Menu_Line(2, ICON_ProbeOffsetY, GET_TEXT_F(MSG_ZPROBE_YOFFSET));  // Probe Y Offset
2609 2613
       #else
2610 2614
         say_probe_offs_en(1); say_x_en(75, 1);  // "Probe Offset X"
2611 2615
         say_probe_offs_en(2); say_y_en(75, 2);  // "Probe Offset Y"
@@ -3090,7 +3094,7 @@ void HMI_Temperature() {
3090 3094
           }
3091 3095
           else {
3092 3096
             #ifdef USE_STRING_HEADINGS
3093
-              Draw_Title(PREHEAT_1_LABEL " Settings"); // TODO: GET_TEXT_F
3097
+              Draw_Title(F(PREHEAT_1_LABEL " Settings")); // TODO: GET_TEXT_F
3094 3098
             #else
3095 3099
               DWIN_Frame_TitleCopy(56, 15, 85, 14);                       // "Temperature"  TODO: "PLA Settings"
3096 3100
             #endif
@@ -3169,7 +3173,7 @@ void HMI_Temperature() {
3169 3173
           }
3170 3174
           else {
3171 3175
             #ifdef USE_STRING_HEADINGS
3172
-              Draw_Title("ABS Settings"); // TODO: GET_TEXT_F
3176
+              Draw_Title(F("ABS Settings")); // TODO: GET_TEXT_F
3173 3177
             #else
3174 3178
               DWIN_Frame_TitleCopy(56, 15, 85, 14);                       // "Temperature"  TODO: "ABS Settings"
3175 3179
             #endif
@@ -3252,7 +3256,7 @@ void Draw_Max_Speed_Menu() {
3252 3256
   }
3253 3257
   else {
3254 3258
     #ifdef USE_STRING_HEADINGS
3255
-      Draw_Title("Max Speed (mm/s)"); // TODO: GET_TEXT_F
3259
+      Draw_Title(F("Max Speed (mm/s)")); // TODO: GET_TEXT_F
3256 3260
     #else
3257 3261
       DWIN_Frame_TitleCopy(144, 16, 46, 11);                  // "Max Speed (mm/s)"
3258 3262
     #endif

+ 40
- 33
Marlin/src/lcd/e3v2/enhanced/dwin.cpp Целия файл

@@ -486,24 +486,31 @@ void Clear_Popup_Area() {
486 486
   DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, 31, DWIN_WIDTH, DWIN_HEIGHT);
487 487
 }
488 488
 
489
-void DWIN_Draw_Popup(uint8_t icon=0, const char * const msg1=nullptr, const char * const msg2=nullptr, uint8_t button=0) {
489
+void DWIN_Draw_Popup1(const uint8_t icon) {
490 490
   DWINUI::ClearMenuArea();
491 491
   Draw_Popup_Bkgd_60();
492 492
   if (icon) DWINUI::Draw_Icon(icon, 101, 105);
493
-  if (msg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, msg1);
494
-  if (msg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, msg2);
493
+}
494
+void DWIN_Draw_Popup2(FSTR_P const fmsg2, uint8_t button) {
495
+  if (fmsg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, fmsg2);
495 496
   if (button) DWINUI::Draw_Icon(button, 86, 280);
496 497
 }
497 498
 
498
-void DWIN_Popup_Confirm(uint8_t icon, const char * const msg1, const char * const msg2) {
499
-  HMI_SaveProcessID(WaitResponse);
500
-  DWIN_Draw_Popup(icon, msg1, msg2, ICON_Confirm_E);  // Button Confirm
501
-  DWIN_UpdateLCD();
499
+void DWIN_Draw_Popup(const uint8_t icon, const char * const cmsg1, FSTR_P const fmsg2, uint8_t button) {
500
+  DWIN_Draw_Popup1(icon);
501
+  if (cmsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, cmsg1);
502
+  DWIN_Draw_Popup2(fmsg2, button);
503
+}
504
+
505
+void DWIN_Draw_Popup(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2, uint8_t button) {
506
+  DWIN_Draw_Popup1(icon);
507
+  if (fmsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, fmsg1);
508
+  DWIN_Draw_Popup2(fmsg2, button);
502 509
 }
503 510
 
504
-void DWIN_Popup_Continue(uint8_t icon, const char * const msg1, const char * const msg2) {
511
+void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) {
505 512
   HMI_SaveProcessID(WaitResponse);
506
-  DWIN_Draw_Popup(icon, msg1, msg2, ICON_Continue_E);  // Button Continue
513
+  DWIN_Draw_Popup(icon, fmsg1, fmsg2, ICON_Continue_E);  // Button Continue
507 514
   DWIN_UpdateLCD();
508 515
 }
509 516
 
@@ -521,7 +528,7 @@ void DWIN_Popup_Continue(uint8_t icon, const char * const msg1, const char * con
521 528
       DWIN_UpdateLCD();
522 529
     }
523 530
     else
524
-      DWIN_Popup_Confirm(ICON_TempTooLow, "Nozzle is too cold", "Preheat the hotend");
531
+      DWIN_Popup_Confirm(ICON_TempTooLow, F("Nozzle is too cold"), F("Preheat the hotend"));
525 532
   }
526 533
 
527 534
 #endif
@@ -565,7 +572,7 @@ void Popup_window_PauseOrStop() {
565 572
     DWINUI::Draw_Icon(ICON_Cancel_C, 146, 280);
566 573
   }
567 574
   else {
568
-    DWIN_Draw_Popup(ICON_BLTouch, "Please confirm", select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT(MSG_PAUSE_PRINT) : GET_TEXT(MSG_STOP_PRINT));
575
+    DWIN_Draw_Popup(ICON_BLTouch, F("Please confirm"), select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT_F(MSG_PAUSE_PRINT) : GET_TEXT_F(MSG_STOP_PRINT));
569 576
     DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280);
570 577
     DWINUI::Draw_Icon(ICON_Cancel_E, 146, 280);
571 578
   }
@@ -1386,7 +1393,7 @@ void HMI_PauseOrStop() {
1386 1393
         #ifdef ACTION_ON_CANCEL
1387 1394
           host_action_cancel();
1388 1395
         #endif
1389
-        DWIN_Draw_Popup(ICON_BLTouch, "Stopping..." , "Please wait until done.");
1396
+        DWIN_Draw_Popup(ICON_BLTouch, F("Stopping...") , F("Please wait until done."));
1390 1397
       }
1391 1398
       else
1392 1399
         Goto_PrintProcess(); // cancel stop
@@ -1644,7 +1651,7 @@ void HMI_SaveProcessID(const uint8_t id) {
1644 1651
 void DWIN_StartHoming() {
1645 1652
   HMI_flag.home_flag = true;
1646 1653
   HMI_SaveProcessID(Homing);
1647
-  DWIN_Draw_Popup(ICON_BLTouch, "Axis Homing", "Please wait until done.");
1654
+  DWIN_Draw_Popup(ICON_BLTouch, F("Axis Homing"), F("Please wait until done."));
1648 1655
 }
1649 1656
 
1650 1657
 void DWIN_CompletedHoming() {
@@ -1659,7 +1666,7 @@ void DWIN_CompletedHoming() {
1659 1666
 void DWIN_MeshLevelingStart() {
1660 1667
   #if HAS_ONESTEP_LEVELING
1661 1668
     HMI_SaveProcessID(Leveling);
1662
-    DWIN_Draw_Popup(ICON_AutoLeveling, GET_TEXT(MSG_BED_LEVELING), "Please wait until done.");
1669
+    DWIN_Draw_Popup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), F("Please wait until done."));
1663 1670
   #elif ENABLED(MESH_BED_LEVELING)
1664 1671
     Draw_ManualMesh_Menu();
1665 1672
   #endif
@@ -1682,27 +1689,27 @@ void DWIN_PidTuning(pidresult_t result) {
1682 1689
   switch (result) {
1683 1690
     case PID_BED_START:
1684 1691
       HMI_SaveProcessID(NothingToDo);
1685
-      DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT(MSG_PID_AUTOTUNE), "for BED is running.");
1692
+      DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for BED is running."));
1686 1693
       break;
1687 1694
     case PID_EXTR_START:
1688 1695
       HMI_SaveProcessID(NothingToDo);
1689
-      DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT(MSG_PID_AUTOTUNE), "for Nozzle is running.");
1696
+      DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for Nozzle is running."));
1690 1697
       break;
1691 1698
     case PID_BAD_EXTRUDER_NUM:
1692 1699
       checkkey = last_checkkey;
1693
-      DWIN_Popup_Confirm(ICON_TempTooLow, "PID Autotune failed!", "Bad extruder");
1700
+      DWIN_Popup_Confirm(ICON_TempTooLow, F("PID Autotune failed!"), F("Bad extruder"));
1694 1701
       break;
1695 1702
     case PID_TUNING_TIMEOUT:
1696 1703
       checkkey = last_checkkey;
1697
-      DWIN_Popup_Confirm(ICON_TempTooHigh, "Error", GET_TEXT(MSG_PID_TIMEOUT));
1704
+      DWIN_Popup_Confirm(ICON_TempTooHigh, F("Error"), GET_TEXT_F(MSG_PID_TIMEOUT));
1698 1705
       break;
1699 1706
     case PID_TEMP_TOO_HIGH:
1700 1707
       checkkey = last_checkkey;
1701
-      DWIN_Popup_Confirm(ICON_TempTooHigh, "PID Autotune failed!", "Temperature too high");
1708
+      DWIN_Popup_Confirm(ICON_TempTooHigh, F("PID Autotune failed!"), F("Temperature too high"));
1702 1709
       break;
1703 1710
     case PID_DONE:
1704 1711
       checkkey = last_checkkey;
1705
-      DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT(MSG_PID_AUTOTUNE), GET_TEXT(MSG_BUTTON_DONE));
1712
+      DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE));
1706 1713
       break;
1707 1714
     default:
1708 1715
       checkkey = last_checkkey;
@@ -1864,24 +1871,24 @@ void DWIN_Redraw_screen() {
1864 1871
 
1865 1872
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
1866 1873
 
1867
-  void DWIN_Popup_Pause(const char *msg, uint8_t button = 0) {
1874
+  void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button = 0) {
1868 1875
     HMI_SaveProcessID(button ? WaitResponse : NothingToDo);
1869
-    DWIN_Draw_Popup(ICON_BLTouch, "Advanced Pause", msg, button);
1876
+    DWIN_Draw_Popup(ICON_BLTouch, F("Advanced Pause"), fmsg, button);
1870 1877
     ui.reset_status(true);
1871 1878
   }
1872 1879
 
1873 1880
   void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) {
1874 1881
     switch (message) {
1875
-      case PAUSE_MESSAGE_PARKING:  DWIN_Popup_Pause(GET_TEXT(MSG_PAUSE_PRINT_PARKING));    break;
1876
-      case PAUSE_MESSAGE_CHANGING: DWIN_Popup_Pause(GET_TEXT(MSG_FILAMENT_CHANGE_INIT));   break;
1877
-      case PAUSE_MESSAGE_UNLOAD:   DWIN_Popup_Pause(GET_TEXT(MSG_FILAMENT_CHANGE_UNLOAD)); break;
1878
-      case PAUSE_MESSAGE_WAITING:  DWIN_Popup_Pause(GET_TEXT(MSG_ADVANCED_PAUSE_WAITING), ICON_Continue_E); break;
1879
-      case PAUSE_MESSAGE_INSERT:   DWIN_Popup_Continue(ICON_BLTouch, "Advanced Pause", GET_TEXT(MSG_FILAMENT_CHANGE_INSERT)); break;
1880
-      case PAUSE_MESSAGE_LOAD:     DWIN_Popup_Pause(GET_TEXT(MSG_FILAMENT_CHANGE_LOAD));   break;
1881
-      case PAUSE_MESSAGE_PURGE:    DWIN_Popup_Pause(GET_TEXT(MSG_FILAMENT_CHANGE_PURGE));  break;
1882
+      case PAUSE_MESSAGE_PARKING:  DWIN_Popup_Pause(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING));    break;
1883
+      case PAUSE_MESSAGE_CHANGING: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT));   break;
1884
+      case PAUSE_MESSAGE_UNLOAD:   DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break;
1885
+      case PAUSE_MESSAGE_WAITING:  DWIN_Popup_Pause(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), ICON_Continue_E); break;
1886
+      case PAUSE_MESSAGE_INSERT:   DWIN_Popup_Continue(ICON_BLTouch, F("Advanced Pause"), GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break;
1887
+      case PAUSE_MESSAGE_LOAD:     DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD));   break;
1888
+      case PAUSE_MESSAGE_PURGE:    DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE));  break;
1882 1889
       case PAUSE_MESSAGE_OPTION:   DWIN_Popup_FilamentPurge(); break;
1883
-      case PAUSE_MESSAGE_RESUME:   DWIN_Popup_Pause(GET_TEXT(MSG_FILAMENT_CHANGE_RESUME)); break;
1884
-      case PAUSE_MESSAGE_HEAT:     DWIN_Popup_Pause(GET_TEXT(MSG_FILAMENT_CHANGE_HEAT), ICON_Continue_E);   break;
1890
+      case PAUSE_MESSAGE_RESUME:   DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break;
1891
+      case PAUSE_MESSAGE_HEAT:     DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), ICON_Continue_E);   break;
1885 1892
       case PAUSE_MESSAGE_HEATING:  ui.set_status_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEATING)); break;
1886 1893
       case PAUSE_MESSAGE_STATUS:   HMI_ReturnScreen(); break;
1887 1894
       default: break;
@@ -1889,7 +1896,7 @@ void DWIN_Redraw_screen() {
1889 1896
   }
1890 1897
 
1891 1898
   void Draw_Popup_FilamentPurge() {
1892
-    DWIN_Draw_Popup(ICON_BLTouch, "Advanced Pause", "Purge or Continue?");
1899
+    DWIN_Draw_Popup(ICON_BLTouch, F("Advanced Pause"), F("Purge or Continue?"));
1893 1900
     DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280);
1894 1901
     DWINUI::Draw_Icon(ICON_Continue_E, 146, 280);
1895 1902
     Draw_Select_Highlight(true);
@@ -1928,7 +1935,7 @@ void DWIN_Redraw_screen() {
1928 1935
 #if HAS_MESH
1929 1936
   void DWIN_MeshViewer() {
1930 1937
     if (!leveling_is_valid())
1931
-      DWIN_Popup_Continue(ICON_BLTouch, "Mesh viewer", "No valid mesh");
1938
+      DWIN_Popup_Continue(ICON_BLTouch, F("Mesh viewer"), F("No valid mesh"));
1932 1939
     else {
1933 1940
       HMI_SaveProcessID(WaitResponse);
1934 1941
       MeshViewer.Draw();

+ 20
- 10
Marlin/src/lcd/e3v2/enhanced/dwin.h Целия файл

@@ -152,16 +152,6 @@ extern HMI_data_t HMI_data;
152 152
 extern uint8_t checkkey;
153 153
 extern millis_t dwin_heat_time;
154 154
 
155
-// Popup windows
156
-void DWIN_Popup_Confirm(uint8_t icon, const char * const msg1, const char * const msg2);
157
-#if HAS_HOTEND || HAS_HEATED_BED
158
-  void DWIN_Popup_Temperature(const bool toohigh);
159
-#endif
160
-#if HAS_HOTEND
161
-  void Popup_Window_ETempTooLow();
162
-#endif
163
-void Popup_Window_Resume();
164
-
165 155
 // SD Card
166 156
 void HMI_SDCardInit();
167 157
 void HMI_SDCardUpdate();
@@ -278,3 +268,23 @@ void Draw_Steps_Menu();
278 268
 #if EITHER(HAS_BED_PROBE, BABYSTEPPING)
279 269
   void Draw_ZOffsetWiz_Menu();
280 270
 #endif
271
+
272
+// Popup windows
273
+
274
+void DWIN_Draw_Popup(const uint8_t icon, const char * const cmsg1, FSTR_P const fmsg2, uint8_t button=0);
275
+void DWIN_Draw_Popup(const uint8_t icon, FSTR_P const fmsg1=nullptr, FSTR_P const fmsg2=nullptr, uint8_t button=0);
276
+
277
+template<typename T, typename U>
278
+void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) {
279
+  HMI_SaveProcessID(WaitResponse);
280
+  DWIN_Draw_Popup(icon, amsg1, amsg2, ICON_Confirm_E);  // Button Confirm
281
+  DWIN_UpdateLCD();
282
+}
283
+
284
+#if HAS_HOTEND || HAS_HEATED_BED
285
+  void DWIN_Popup_Temperature(const bool toohigh);
286
+#endif
287
+#if HAS_HOTEND
288
+  void Popup_Window_ETempTooLow();
289
+#endif
290
+void Popup_Window_Resume();

+ 329
- 313
Marlin/src/lcd/e3v2/jyersui/dwin.cpp
Файловите разлики са ограничени, защото са твърде много
Целия файл


+ 4
- 2
Marlin/src/lcd/e3v2/jyersui/dwin.h Целия файл

@@ -175,7 +175,9 @@ public:
175 175
   static uint16_t GetColor(uint8_t color, uint16_t original, bool light=false);
176 176
   static void Draw_Checkbox(uint8_t row, bool value);
177 177
   static void Draw_Title(const char * title);
178
+  static void Draw_Title(FSTR_P const title);
178 179
   static void Draw_Menu_Item(uint8_t row, uint8_t icon=0, const char * const label1=nullptr, const char * const label2=nullptr, bool more=false, bool centered=false);
180
+  static void Draw_Menu_Item(uint8_t row, uint8_t icon=0, FSTR_P const flabel1=nullptr, FSTR_P const flabel2=nullptr, bool more=false, bool centered=false);
179 181
   static void Draw_Menu(uint8_t menu, uint8_t select=0, uint8_t scroll=0);
180 182
   static void Redraw_Menu(bool lastprocess=true, bool lastselection=false, bool lastmenu=false);
181 183
   static void Redraw_Screen();
@@ -194,7 +196,7 @@ public:
194 196
   static void Draw_SD_Item(uint8_t item, uint8_t row);
195 197
   static void Draw_SD_List(bool removed=false);
196 198
   static void Draw_Status_Area(bool icons=false);
197
-  static void Draw_Popup(PGM_P const line1, PGM_P const line2, PGM_P const line3, uint8_t mode, uint8_t icon=0);
199
+  static void Draw_Popup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon=0);
198 200
   static void Popup_Select();
199 201
   static void Update_Status_Bar(bool refresh=false);
200 202
 
@@ -203,7 +205,7 @@ public:
203 205
     static void Set_Mesh_Viewer_Status();
204 206
   #endif
205 207
 
206
-  static const char * Get_Menu_Title(uint8_t menu);
208
+  static FSTR_P Get_Menu_Title(uint8_t menu);
207 209
   static uint8_t Get_Menu_Size(uint8_t menu);
208 210
   static void Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw=true);
209 211
 

Loading…
Отказ
Запис