Browse Source

🎨 Apply F() to E3V2 titles, popups

Scott Lahteine 3 years ago
parent
commit
64a919da2a

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

71
     else
71
     else
72
       ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT));
72
       ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT));
73
   #elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
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
   #else
78
   #else
76
 
79
 
77
     if (parser.string_arg) {
80
     if (parser.string_arg) {

+ 4
- 3
Marlin/src/lcd/e3v2/common/dwin_api.h View File

174
 //  rlimit: For draw less chars than string length use rlimit
174
 //  rlimit: For draw less chars than string length use rlimit
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);
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
 // Draw a positive integer
183
 // Draw a positive integer

+ 27
- 23
Marlin/src/lcd/e3v2/creality/dwin.cpp View File

359
   DWIN_Draw_Box(1, Color_Bg_Blue, 0, 0, DWIN_WIDTH, TITLE_HEIGHT);
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
 inline void Clear_Menu_Area() {
366
 inline void Clear_Menu_Area() {
420
   return card.get_num_Files() + !card.flag.workDirIsRoot;
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
 void Draw_Menu_Icon(const uint8_t line, const uint8_t icon) {
423
 void Draw_Menu_Icon(const uint8_t line, const uint8_t icon) {
424
   DWIN_ICON_Show(ICON, icon, 26, MBASE(line) - 3);
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
 void Draw_Menu_Item(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) {
431
 void Draw_Menu_Item(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) {
432
   if (label) DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, (char*)label);
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
 void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) {
440
 void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) {
439
   DWIN_Draw_Line(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34);
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
 void Draw_Checkbox_Line(const uint8_t line, const bool ison) {
450
 void Draw_Checkbox_Line(const uint8_t line, const bool ison) {
447
   const uint16_t x = 225, y = EBASE(line) - 2;
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
   DWIN_Draw_Rectangle(0, Color_White, x + 2, y + 2, x + 16, y + 16);
453
   DWIN_Draw_Rectangle(0, Color_White, x + 2, y + 2, x + 16, y + 16);
450
 }
454
 }
451
 
455
 
1853
   if (row < 0) row = item + 1 + MROWS - index_file;
1857
   if (row < 0) row = item + 1 + MROWS - index_file;
1854
   const bool is_subdir = !card.flag.workDirIsRoot;
1858
   const bool is_subdir = !card.flag.workDirIsRoot;
1855
   if (is_subdir && item == 0) {
1859
   if (is_subdir && item == 0) {
1856
-    Draw_Menu_Line(row, ICON_Folder, "..");
1860
+    Draw_Menu_Line(row, ICON_Folder, F(".."));
1857
     return;
1861
     return;
1858
   }
1862
   }
1859
 
1863
 
2531
   }
2535
   }
2532
   else {
2536
   else {
2533
     #ifdef USE_STRING_TITLES
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
     #else
2539
     #else
2536
       say_home_offs_en(row); say_x_en(75, row);   // "Home Offset X"
2540
       say_home_offs_en(row); say_x_en(75, row);   // "Home Offset X"
2537
     #endif
2541
     #endif
2546
   }
2550
   }
2547
   else {
2551
   else {
2548
     #ifdef USE_STRING_TITLES
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
     #else
2554
     #else
2551
       say_home_offs_en(row); say_y_en(75, row);   // "Home Offset X"
2555
       say_home_offs_en(row); say_y_en(75, row);   // "Home Offset X"
2552
     #endif
2556
     #endif
2561
   }
2565
   }
2562
   else {
2566
   else {
2563
     #ifdef USE_STRING_TITLES
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
     #else
2569
     #else
2566
       say_home_offs_en(row); say_z_en(75, row);   // "Home Offset Z"
2570
       say_home_offs_en(row); say_z_en(75, row);   // "Home Offset Z"
2567
     #endif
2571
     #endif
2604
         DWIN_Frame_TitleCopy(124, 431, 91, 12);                             // "Probe Offsets"
2608
         DWIN_Frame_TitleCopy(124, 431, 91, 12);                             // "Probe Offsets"
2605
       #endif
2609
       #endif
2606
       #ifdef USE_STRING_TITLES
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
       #else
2613
       #else
2610
         say_probe_offs_en(1); say_x_en(75, 1);  // "Probe Offset X"
2614
         say_probe_offs_en(1); say_x_en(75, 1);  // "Probe Offset X"
2611
         say_probe_offs_en(2); say_y_en(75, 2);  // "Probe Offset Y"
2615
         say_probe_offs_en(2); say_y_en(75, 2);  // "Probe Offset Y"
3090
           }
3094
           }
3091
           else {
3095
           else {
3092
             #ifdef USE_STRING_HEADINGS
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
             #else
3098
             #else
3095
               DWIN_Frame_TitleCopy(56, 15, 85, 14);                       // "Temperature"  TODO: "PLA Settings"
3099
               DWIN_Frame_TitleCopy(56, 15, 85, 14);                       // "Temperature"  TODO: "PLA Settings"
3096
             #endif
3100
             #endif
3169
           }
3173
           }
3170
           else {
3174
           else {
3171
             #ifdef USE_STRING_HEADINGS
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
             #else
3177
             #else
3174
               DWIN_Frame_TitleCopy(56, 15, 85, 14);                       // "Temperature"  TODO: "ABS Settings"
3178
               DWIN_Frame_TitleCopy(56, 15, 85, 14);                       // "Temperature"  TODO: "ABS Settings"
3175
             #endif
3179
             #endif
3252
   }
3256
   }
3253
   else {
3257
   else {
3254
     #ifdef USE_STRING_HEADINGS
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
     #else
3260
     #else
3257
       DWIN_Frame_TitleCopy(144, 16, 46, 11);                  // "Max Speed (mm/s)"
3261
       DWIN_Frame_TitleCopy(144, 16, 46, 11);                  // "Max Speed (mm/s)"
3258
     #endif
3262
     #endif

+ 40
- 33
Marlin/src/lcd/e3v2/enhanced/dwin.cpp View File

486
   DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, 31, DWIN_WIDTH, DWIN_HEIGHT);
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
   DWINUI::ClearMenuArea();
490
   DWINUI::ClearMenuArea();
491
   Draw_Popup_Bkgd_60();
491
   Draw_Popup_Bkgd_60();
492
   if (icon) DWINUI::Draw_Icon(icon, 101, 105);
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
   if (button) DWINUI::Draw_Icon(button, 86, 280);
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
   HMI_SaveProcessID(WaitResponse);
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
   DWIN_UpdateLCD();
514
   DWIN_UpdateLCD();
508
 }
515
 }
509
 
516
 
521
       DWIN_UpdateLCD();
528
       DWIN_UpdateLCD();
522
     }
529
     }
523
     else
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
 #endif
534
 #endif
565
     DWINUI::Draw_Icon(ICON_Cancel_C, 146, 280);
572
     DWINUI::Draw_Icon(ICON_Cancel_C, 146, 280);
566
   }
573
   }
567
   else {
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
     DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280);
576
     DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280);
570
     DWINUI::Draw_Icon(ICON_Cancel_E, 146, 280);
577
     DWINUI::Draw_Icon(ICON_Cancel_E, 146, 280);
571
   }
578
   }
1386
         #ifdef ACTION_ON_CANCEL
1393
         #ifdef ACTION_ON_CANCEL
1387
           host_action_cancel();
1394
           host_action_cancel();
1388
         #endif
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
       else
1398
       else
1392
         Goto_PrintProcess(); // cancel stop
1399
         Goto_PrintProcess(); // cancel stop
1644
 void DWIN_StartHoming() {
1651
 void DWIN_StartHoming() {
1645
   HMI_flag.home_flag = true;
1652
   HMI_flag.home_flag = true;
1646
   HMI_SaveProcessID(Homing);
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
 void DWIN_CompletedHoming() {
1657
 void DWIN_CompletedHoming() {
1659
 void DWIN_MeshLevelingStart() {
1666
 void DWIN_MeshLevelingStart() {
1660
   #if HAS_ONESTEP_LEVELING
1667
   #if HAS_ONESTEP_LEVELING
1661
     HMI_SaveProcessID(Leveling);
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
   #elif ENABLED(MESH_BED_LEVELING)
1670
   #elif ENABLED(MESH_BED_LEVELING)
1664
     Draw_ManualMesh_Menu();
1671
     Draw_ManualMesh_Menu();
1665
   #endif
1672
   #endif
1682
   switch (result) {
1689
   switch (result) {
1683
     case PID_BED_START:
1690
     case PID_BED_START:
1684
       HMI_SaveProcessID(NothingToDo);
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
       break;
1693
       break;
1687
     case PID_EXTR_START:
1694
     case PID_EXTR_START:
1688
       HMI_SaveProcessID(NothingToDo);
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
       break;
1697
       break;
1691
     case PID_BAD_EXTRUDER_NUM:
1698
     case PID_BAD_EXTRUDER_NUM:
1692
       checkkey = last_checkkey;
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
       break;
1701
       break;
1695
     case PID_TUNING_TIMEOUT:
1702
     case PID_TUNING_TIMEOUT:
1696
       checkkey = last_checkkey;
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
       break;
1705
       break;
1699
     case PID_TEMP_TOO_HIGH:
1706
     case PID_TEMP_TOO_HIGH:
1700
       checkkey = last_checkkey;
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
       break;
1709
       break;
1703
     case PID_DONE:
1710
     case PID_DONE:
1704
       checkkey = last_checkkey;
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
       break;
1713
       break;
1707
     default:
1714
     default:
1708
       checkkey = last_checkkey;
1715
       checkkey = last_checkkey;
1864
 
1871
 
1865
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
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
     HMI_SaveProcessID(button ? WaitResponse : NothingToDo);
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
     ui.reset_status(true);
1877
     ui.reset_status(true);
1871
   }
1878
   }
1872
 
1879
 
1873
   void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) {
1880
   void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) {
1874
     switch (message) {
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
       case PAUSE_MESSAGE_OPTION:   DWIN_Popup_FilamentPurge(); break;
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
       case PAUSE_MESSAGE_HEATING:  ui.set_status_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEATING)); break;
1892
       case PAUSE_MESSAGE_HEATING:  ui.set_status_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEATING)); break;
1886
       case PAUSE_MESSAGE_STATUS:   HMI_ReturnScreen(); break;
1893
       case PAUSE_MESSAGE_STATUS:   HMI_ReturnScreen(); break;
1887
       default: break;
1894
       default: break;
1889
   }
1896
   }
1890
 
1897
 
1891
   void Draw_Popup_FilamentPurge() {
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
     DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280);
1900
     DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280);
1894
     DWINUI::Draw_Icon(ICON_Continue_E, 146, 280);
1901
     DWINUI::Draw_Icon(ICON_Continue_E, 146, 280);
1895
     Draw_Select_Highlight(true);
1902
     Draw_Select_Highlight(true);
1928
 #if HAS_MESH
1935
 #if HAS_MESH
1929
   void DWIN_MeshViewer() {
1936
   void DWIN_MeshViewer() {
1930
     if (!leveling_is_valid())
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
     else {
1939
     else {
1933
       HMI_SaveProcessID(WaitResponse);
1940
       HMI_SaveProcessID(WaitResponse);
1934
       MeshViewer.Draw();
1941
       MeshViewer.Draw();

+ 20
- 10
Marlin/src/lcd/e3v2/enhanced/dwin.h View File

152
 extern uint8_t checkkey;
152
 extern uint8_t checkkey;
153
 extern millis_t dwin_heat_time;
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
 // SD Card
155
 // SD Card
166
 void HMI_SDCardInit();
156
 void HMI_SDCardInit();
167
 void HMI_SDCardUpdate();
157
 void HMI_SDCardUpdate();
278
 #if EITHER(HAS_BED_PROBE, BABYSTEPPING)
268
 #if EITHER(HAS_BED_PROBE, BABYSTEPPING)
279
   void Draw_ZOffsetWiz_Menu();
269
   void Draw_ZOffsetWiz_Menu();
280
 #endif
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
File diff suppressed because it is too large
View File


+ 4
- 2
Marlin/src/lcd/e3v2/jyersui/dwin.h View File

175
   static uint16_t GetColor(uint8_t color, uint16_t original, bool light=false);
175
   static uint16_t GetColor(uint8_t color, uint16_t original, bool light=false);
176
   static void Draw_Checkbox(uint8_t row, bool value);
176
   static void Draw_Checkbox(uint8_t row, bool value);
177
   static void Draw_Title(const char * title);
177
   static void Draw_Title(const char * title);
178
+  static void Draw_Title(FSTR_P const title);
178
   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);
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
   static void Draw_Menu(uint8_t menu, uint8_t select=0, uint8_t scroll=0);
181
   static void Draw_Menu(uint8_t menu, uint8_t select=0, uint8_t scroll=0);
180
   static void Redraw_Menu(bool lastprocess=true, bool lastselection=false, bool lastmenu=false);
182
   static void Redraw_Menu(bool lastprocess=true, bool lastselection=false, bool lastmenu=false);
181
   static void Redraw_Screen();
183
   static void Redraw_Screen();
194
   static void Draw_SD_Item(uint8_t item, uint8_t row);
196
   static void Draw_SD_Item(uint8_t item, uint8_t row);
195
   static void Draw_SD_List(bool removed=false);
197
   static void Draw_SD_List(bool removed=false);
196
   static void Draw_Status_Area(bool icons=false);
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
   static void Popup_Select();
200
   static void Popup_Select();
199
   static void Update_Status_Bar(bool refresh=false);
201
   static void Update_Status_Bar(bool refresh=false);
200
 
202
 
203
     static void Set_Mesh_Viewer_Status();
205
     static void Set_Mesh_Viewer_Status();
204
   #endif
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
   static uint8_t Get_Menu_Size(uint8_t menu);
209
   static uint8_t Get_Menu_Size(uint8_t menu);
208
   static void Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw=true);
210
   static void Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw=true);
209
 
211
 

Loading…
Cancel
Save