Skip to content

Commit 59503c6

Browse files
committed
🎨 Apply F() to E3V2 titles, popups
1 parent 0309fce commit 59503c6

File tree

7 files changed

+428
-385
lines changed

7 files changed

+428
-385
lines changed

Marlin/src/gcode/lcd/M0_M1.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ void GcodeSuite::M0_M1() {
7171
else
7272
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT));
7373
#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));
7578
#else
7679

7780
if (parser.string_arg) {

Marlin/src/lcd/e3v2/common/dwin_api.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,10 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
175175
// rlimit: For draw less chars than string length use rlimit
176176
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);
177177

178-
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) {
179-
// Note that this won't work on AVR, only 32-bit systems!
180-
DWIN_Draw_String(bShow, size, color, bColor, x, y, FTOP(title));
178+
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) {
179+
char ctitle[strlen_P(FTOP(ftitle)) + 1];
180+
strcpy_P(ctitle, FTOP(ftitle));
181+
DWIN_Draw_String(bShow, size, color, bColor, x, y, ctitle);
181182
}
182183

183184
// Draw a positive integer

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

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,8 @@ inline void Clear_Title_Bar() {
359359
DWIN_Draw_Box(1, Color_Bg_Blue, 0, 0, DWIN_WIDTH, TITLE_HEIGHT);
360360
}
361361

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);
368364
}
369365

370366
inline void Clear_Menu_Area() {
@@ -420,32 +416,40 @@ inline uint16_t nr_sd_menu_items() {
420416
return card.get_num_Files() + !card.flag.workDirIsRoot;
421417
}
422418

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+
423423
void Draw_Menu_Icon(const uint8_t line, const uint8_t icon) {
424424
DWIN_ICON_Show(ICON, icon, 26, MBASE(line) - 3);
425425
}
426426

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);
429430
}
430-
431431
void Draw_Menu_Item(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) {
432432
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);
435438
}
436439

437440
void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) {
438441
Draw_Menu_Item(line, icon, label, more);
439442
DWIN_Draw_Line(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34);
440443
}
441444

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);
444448
}
445449

446450
void Draw_Checkbox_Line(const uint8_t line, const bool ison) {
447451
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(" "));
449453
DWIN_Draw_Rectangle(0, Color_White, x + 2, y + 2, x + 16, y + 16);
450454
}
451455

@@ -1853,7 +1857,7 @@ void Draw_SDItem(const uint16_t item, int16_t row=-1) {
18531857
if (row < 0) row = item + 1 + MROWS - index_file;
18541858
const bool is_subdir = !card.flag.workDirIsRoot;
18551859
if (is_subdir && item == 0) {
1856-
Draw_Menu_Line(row, ICON_Folder, "..");
1860+
Draw_Menu_Line(row, ICON_Folder, F(".."));
18571861
return;
18581862
}
18591863

@@ -2531,7 +2535,7 @@ void Item_HomeOffs_X(const uint8_t row) {
25312535
}
25322536
else {
25332537
#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));
25352539
#else
25362540
say_home_offs_en(row); say_x_en(75, row); // "Home Offset X"
25372541
#endif
@@ -2546,7 +2550,7 @@ void Item_HomeOffs_Y(const uint8_t row) {
25462550
}
25472551
else {
25482552
#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));
25502554
#else
25512555
say_home_offs_en(row); say_y_en(75, row); // "Home Offset X"
25522556
#endif
@@ -2561,7 +2565,7 @@ void Item_HomeOffs_Z(const uint8_t row) {
25612565
}
25622566
else {
25632567
#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));
25652569
#else
25662570
say_home_offs_en(row); say_z_en(75, row); // "Home Offset Z"
25672571
#endif
@@ -2604,8 +2608,8 @@ void Draw_HomeOff_Menu() {
26042608
DWIN_Frame_TitleCopy(124, 431, 91, 12); // "Probe Offsets"
26052609
#endif
26062610
#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
26092613
#else
26102614
say_probe_offs_en(1); say_x_en(75, 1); // "Probe Offset X"
26112615
say_probe_offs_en(2); say_y_en(75, 2); // "Probe Offset Y"
@@ -3090,7 +3094,7 @@ void HMI_Temperature() {
30903094
}
30913095
else {
30923096
#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
30943098
#else
30953099
DWIN_Frame_TitleCopy(56, 15, 85, 14); // "Temperature" TODO: "PLA Settings"
30963100
#endif
@@ -3169,7 +3173,7 @@ void HMI_Temperature() {
31693173
}
31703174
else {
31713175
#ifdef USE_STRING_HEADINGS
3172-
Draw_Title("ABS Settings"); // TODO: GET_TEXT_F
3176+
Draw_Title(F("ABS Settings")); // TODO: GET_TEXT_F
31733177
#else
31743178
DWIN_Frame_TitleCopy(56, 15, 85, 14); // "Temperature" TODO: "ABS Settings"
31753179
#endif
@@ -3252,7 +3256,7 @@ void Draw_Max_Speed_Menu() {
32523256
}
32533257
else {
32543258
#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
32563260
#else
32573261
DWIN_Frame_TitleCopy(144, 16, 46, 11); // "Max Speed (mm/s)"
32583262
#endif

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

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -486,24 +486,31 @@ void Clear_Popup_Area() {
486486
DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, 31, DWIN_WIDTH, DWIN_HEIGHT);
487487
}
488488

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) {
490490
DWINUI::ClearMenuArea();
491491
Draw_Popup_Bkgd_60();
492492
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);
495496
if (button) DWINUI::Draw_Icon(button, 86, 280);
496497
}
497498

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);
502509
}
503510

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) {
505512
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
507514
DWIN_UpdateLCD();
508515
}
509516

@@ -521,7 +528,7 @@ void DWIN_Popup_Continue(uint8_t icon, const char * const msg1, const char * con
521528
DWIN_UpdateLCD();
522529
}
523530
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"));
525532
}
526533

527534
#endif
@@ -565,7 +572,7 @@ void Popup_window_PauseOrStop() {
565572
DWINUI::Draw_Icon(ICON_Cancel_C, 146, 280);
566573
}
567574
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));
569576
DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280);
570577
DWINUI::Draw_Icon(ICON_Cancel_E, 146, 280);
571578
}
@@ -1386,7 +1393,7 @@ void HMI_PauseOrStop() {
13861393
#ifdef ACTION_ON_CANCEL
13871394
host_action_cancel();
13881395
#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."));
13901397
}
13911398
else
13921399
Goto_PrintProcess(); // cancel stop
@@ -1644,7 +1651,7 @@ void HMI_SaveProcessID(const uint8_t id) {
16441651
void DWIN_StartHoming() {
16451652
HMI_flag.home_flag = true;
16461653
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."));
16481655
}
16491656

16501657
void DWIN_CompletedHoming() {
@@ -1659,7 +1666,7 @@ void DWIN_CompletedHoming() {
16591666
void DWIN_MeshLevelingStart() {
16601667
#if HAS_ONESTEP_LEVELING
16611668
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."));
16631670
#elif ENABLED(MESH_BED_LEVELING)
16641671
Draw_ManualMesh_Menu();
16651672
#endif
@@ -1682,27 +1689,27 @@ void DWIN_PidTuning(pidresult_t result) {
16821689
switch (result) {
16831690
case PID_BED_START:
16841691
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."));
16861693
break;
16871694
case PID_EXTR_START:
16881695
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."));
16901697
break;
16911698
case PID_BAD_EXTRUDER_NUM:
16921699
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"));
16941701
break;
16951702
case PID_TUNING_TIMEOUT:
16961703
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));
16981705
break;
16991706
case PID_TEMP_TOO_HIGH:
17001707
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"));
17021709
break;
17031710
case PID_DONE:
17041711
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));
17061713
break;
17071714
default:
17081715
checkkey = last_checkkey;
@@ -1864,32 +1871,32 @@ void DWIN_Redraw_screen() {
18641871

18651872
#if ENABLED(ADVANCED_PAUSE_FEATURE)
18661873

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) {
18681875
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);
18701877
ui.reset_status(true);
18711878
}
18721879

18731880
void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) {
18741881
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;
18821889
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;
18851892
case PAUSE_MESSAGE_HEATING: ui.set_status_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEATING)); break;
18861893
case PAUSE_MESSAGE_STATUS: HMI_ReturnScreen(); break;
18871894
default: break;
18881895
}
18891896
}
18901897

18911898
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?"));
18931900
DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280);
18941901
DWINUI::Draw_Icon(ICON_Continue_E, 146, 280);
18951902
Draw_Select_Highlight(true);
@@ -1928,7 +1935,7 @@ void DWIN_Redraw_screen() {
19281935
#if HAS_MESH
19291936
void DWIN_MeshViewer() {
19301937
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"));
19321939
else {
19331940
HMI_SaveProcessID(WaitResponse);
19341941
MeshViewer.Draw();

Marlin/src/lcd/e3v2/enhanced/dwin.h

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,6 @@ extern HMI_data_t HMI_data;
152152
extern uint8_t checkkey;
153153
extern millis_t dwin_heat_time;
154154

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-
165155
// SD Card
166156
void HMI_SDCardInit();
167157
void HMI_SDCardUpdate();
@@ -278,3 +268,23 @@ void Draw_Steps_Menu();
278268
#if EITHER(HAS_BED_PROBE, BABYSTEPPING)
279269
void Draw_ZOffsetWiz_Menu();
280270
#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();

0 commit comments

Comments
 (0)