Skip to content

Commit c3ae221

Browse files
committed
🎨 Apply F() to some ExtUI functions
1 parent 7626d85 commit c3ae221

37 files changed

+277
-278
lines changed

Marlin/src/feature/mmu/mmu2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
961961
LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER);
962962
BUZZ(200, 404);
963963
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR)));
964-
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("MMU2 Eject Recover")));
964+
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("MMU2 Eject Recover")));
965965
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
966966
BUZZ(200, 404);
967967
BUZZ(200, 404);

Marlin/src/feature/pause.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
194194
KEEPALIVE_STATE(PAUSED_FOR_USER);
195195
wait_for_user = true; // LCD click or M108 will clear this
196196

197-
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
197+
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Load Filament")));
198198

199199
#if ENABLED(HOST_PROMPT_SUPPORT)
200200
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
@@ -252,7 +252,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
252252

253253
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);
254254

255-
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_PURGE)));
255+
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)));
256256
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR)));
257257
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT(MSG_FILAMENT_CHANGE_PURGE), CONTINUE_STR));
258258
wait_for_user = true; // A click or M108 breaks the purge_length loop
@@ -513,7 +513,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
513513
// Wait for filament insert by user and press button
514514
KEEPALIVE_STATE(PAUSED_FOR_USER);
515515
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_NOZZLE_PARKED), FPSTR(CONTINUE_STR)));
516-
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_NOZZLE_PARKED)));
516+
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_NOZZLE_PARKED)));
517517
wait_for_user = true; // LCD click or M108 will clear this
518518
while (wait_for_user) {
519519
impatient_beep(max_beep_count);
@@ -530,13 +530,13 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
530530

531531
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_HEATER_TIMEOUT), GET_TEXT_F(MSG_REHEAT)));
532532

533-
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_HEATER_TIMEOUT)));
533+
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_HEATER_TIMEOUT)));
534534

535535
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(0, true)); // Wait for LCD click or M108
536536

537537
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, GET_TEXT_F(MSG_REHEATING)));
538538

539-
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged_P(GET_TEXT(MSG_REHEATING)));
539+
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(GET_TEXT_F(MSG_REHEATING)));
540540

541541
TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_REHEATING));
542542

@@ -555,7 +555,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
555555
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
556556

557557
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_REHEATDONE), FPSTR(CONTINUE_STR)));
558-
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_REHEATDONE)));
558+
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_REHEATDONE)));
559559
TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_REHEATDONE));
560560

561561
IF_DISABLED(PAUSE_REHEAT_FAST_RESUME, wait_for_user = true);

Marlin/src/gcode/config/M43.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ void GcodeSuite::M43() {
345345
KEEPALIVE_STATE(PAUSED_FOR_USER);
346346
wait_for_user = true;
347347
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("M43 Wait Called"), FPSTR(CONTINUE_STR)));
348-
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("M43 Wait Called")));
348+
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("M43 Wait Called")));
349349
#endif
350350

351351
for (;;) {

Marlin/src/gcode/lcd/M0_M1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void GcodeSuite::M0_M1() {
6969
if (parser.string_arg)
7070
ExtUI::onUserConfirmRequired(parser.string_arg); // Can this take an SRAM string??
7171
else
72-
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT));
72+
ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_USERWAIT));
7373
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
7474
if (parser.string_arg)
7575
DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT));

Marlin/src/gcode/sd/M1001.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void GcodeSuite::M1001() {
9696
#if HAS_LEDS_OFF_FLAG
9797
if (long_print) {
9898
printerEventLEDs.onPrintCompleted();
99-
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE)));
99+
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PRINT_DONE)));
100100
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_PRINT_DONE), FPSTR(CONTINUE_STR)));
101101
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(SEC_TO_MS(TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30))));
102102
printerEventLEDs.onResumeAfterWait();

Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
157157
// The new panel ignores entries that don't end in .GCO or .gcode so add and pad them.
158158
if (paneltype == AC_panel_new) {
159159
TFTSer.println("<<.GCO");
160-
Chiron.SendtoTFTLN(PSTR(".. .gcode"));
160+
Chiron.SendtoTFTLN(F(".. .gcode"));
161161
}
162162
else {
163163
TFTSer.println("<<");

Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void ChironTFT::Startup() {
9999

100100
// Enable leveling and Disable end stops during print
101101
// as Z home places nozzle above the bed so we need to allow it past the end stops
102-
injectCommands_P(AC_cmnd_enable_leveling);
102+
injectCommands(AC_cmnd_enable_leveling);
103103

104104
// Startup tunes are defined in Tunes.h
105105
PlayTune(BEEPER_PIN, TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn), 1);
@@ -244,15 +244,15 @@ void ChironTFT::StatusChange(const char * const msg) {
244244
// If probing completes ok save the mesh and park
245245
// Ignore the custom machine name
246246
if (strcmp_P(msg + strlen(CUSTOM_MACHINE_NAME), MARLIN_msg_ready) == 0) {
247-
injectCommands_P(PSTR("M500\nG27"));
247+
injectCommands(F("M500\nG27"));
248248
SendtoTFTLN(AC_msg_probing_complete);
249249
printer_state = AC_printer_idle;
250250
msg_matched = true;
251251
}
252252
// If probing fails don't save the mesh raise the probe above the bad point
253253
if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) {
254254
PlayTune(BEEPER_PIN, BeepBeepBeeep, 1);
255-
injectCommands_P(PSTR("G1 Z50 F500"));
255+
injectCommands(F("G1 Z50 F500"));
256256
SendtoTFTLN(AC_msg_probing_complete);
257257
printer_state = AC_printer_idle;
258258
msg_matched = true;
@@ -315,19 +315,20 @@ void ChironTFT::PrintComplete() {
315315
setSoftEndstopState(true); // enable endstops
316316
}
317317

318-
void ChironTFT::SendtoTFT(PGM_P str) { // A helper to print PROGMEM string to the panel
318+
void ChironTFT::SendtoTFT(FSTR_P const fstr) { // A helper to print PROGMEM string to the panel
319319
#if ACDEBUG(AC_SOME)
320-
SERIAL_ECHOPGM_P(str);
320+
SERIAL_ECHOF(fstr);
321321
#endif
322+
PGM_P str = FTOP(fstr);
322323
while (const char c = pgm_read_byte(str++)) TFTSer.write(c);
323324
}
324325

325-
void ChironTFT::SendtoTFTLN(PGM_P str = nullptr) {
326-
if (str) {
326+
void ChironTFT::SendtoTFTLN(FSTR_P const fstr) {
327+
if (fstr) {
327328
#if ACDEBUG(AC_SOME)
328329
SERIAL_ECHOPGM("> ");
329330
#endif
330-
SendtoTFT(str);
331+
SendtoTFT(fstr);
331332
#if ACDEBUG(AC_SOME)
332333
SERIAL_EOL();
333334
#endif
@@ -426,9 +427,9 @@ void ChironTFT::SendFileList(int8_t startindex) {
426427
#if ACDEBUG(AC_INFO)
427428
SERIAL_ECHOLNPGM("## SendFileList ## ", startindex);
428429
#endif
429-
SendtoTFTLN(PSTR("FN "));
430+
SendtoTFTLN(F("FN "));
430431
filenavigator.getFiles(startindex, panel_type, 4);
431-
SendtoTFTLN(PSTR("END"));
432+
SendtoTFTLN(F("END"));
432433
}
433434

434435
void ChironTFT::SelectFile() {
@@ -512,55 +513,55 @@ void ChironTFT::PanelInfo(uint8_t req) {
512513
// information requests A0-A8 and A33
513514
switch (req) {
514515
case 0: // A0 Get HOTEND Temp
515-
SendtoTFT(PSTR("A0V "));
516+
SendtoTFT(F("A0V "));
516517
TFTSer.println(getActualTemp_celsius(E0));
517518
break;
518519

519520
case 1: // A1 Get HOTEND Target Temp
520-
SendtoTFT(PSTR("A1V "));
521+
SendtoTFT(F("A1V "));
521522
TFTSer.println(getTargetTemp_celsius(E0));
522523
break;
523524

524525
case 2: // A2 Get BED Temp
525-
SendtoTFT(PSTR("A2V "));
526+
SendtoTFT(F("A2V "));
526527
TFTSer.println(getActualTemp_celsius(BED));
527528
break;
528529

529530
case 3: // A3 Get BED Target Temp
530-
SendtoTFT(PSTR("A3V "));
531+
SendtoTFT(F("A3V "));
531532
TFTSer.println(getTargetTemp_celsius(BED));
532533
break;
533534

534535
case 4: // A4 Get FAN Speed
535-
SendtoTFT(PSTR("A4V "));
536+
SendtoTFT(F("A4V "));
536537
TFTSer.println(getActualFan_percent(FAN0));
537538
break;
538539

539540
case 5: // A5 Get Current Coordinates
540-
SendtoTFT(PSTR("A5V X: "));
541+
SendtoTFT(F("A5V X: "));
541542
TFTSer.print(getAxisPosition_mm(X));
542-
SendtoTFT(PSTR(" Y: "));
543+
SendtoTFT(F(" Y: "));
543544
TFTSer.print(getAxisPosition_mm(Y));
544-
SendtoTFT(PSTR(" Z: "));
545+
SendtoTFT(F(" Z: "));
545546
TFTSer.println(getAxisPosition_mm(Z));
546547
break;
547548

548549
case 6: // A6 Get printing progress
549550
if (isPrintingFromMedia()) {
550-
SendtoTFT(PSTR("A6V "));
551+
SendtoTFT(F("A6V "));
551552
TFTSer.println(ui8tostr2(getProgress_percent()));
552553
}
553554
else
554-
SendtoTFTLN(PSTR("A6V ---"));
555+
SendtoTFTLN(F("A6V ---"));
555556
break;
556557

557558
case 7: { // A7 Get Printing Time
558559
uint32_t time = getProgress_seconds_elapsed() / 60;
559-
SendtoTFT(PSTR("A7V "));
560+
SendtoTFT(F("A7V "));
560561
TFTSer.print(ui8tostr2(time / 60));
561-
SendtoTFT(PSTR(" H "));
562+
SendtoTFT(F(" H "));
562563
TFTSer.print(ui8tostr2(time % 60));
563-
SendtoTFT(PSTR(" M"));
564+
SendtoTFT(F(" M"));
564565
#if ACDEBUG(AC_ALL)
565566
SERIAL_ECHOLNPGM("Print time ", ui8tostr2(time / 60), ":", ui8tostr2(time % 60));
566567
#endif
@@ -575,9 +576,9 @@ void ChironTFT::PanelInfo(uint8_t req) {
575576
break;
576577

577578
case 33: // A33 Get firmware info
578-
SendtoTFT(PSTR("J33 "));
579+
SendtoTFT(F("J33 "));
579580
// If there is an error recorded, show that instead of the FW version
580-
if (!GetLastError()) SendtoTFTLN(PSTR(SHORT_BUILD_VERSION));
581+
if (!GetLastError()) SendtoTFTLN(F(SHORT_BUILD_VERSION));
581582
break;
582583
}
583584
}
@@ -608,7 +609,7 @@ void ChironTFT::PanelAction(uint8_t req) {
608609
}
609610
else {
610611
if (printer_state == AC_printer_resuming_from_power_outage)
611-
injectCommands_P(PSTR("M1000 C")); // Cancel recovery
612+
injectCommands(F("M1000 C")); // Cancel recovery
612613
SendtoTFTLN(AC_msg_stop);
613614
printer_state = AC_printer_idle;
614615
}
@@ -625,7 +626,7 @@ void ChironTFT::PanelAction(uint8_t req) {
625626
case 14: { // A14 Start Printing
626627
// Allows printer to restart the job if we don't want to recover
627628
if (printer_state == AC_printer_resuming_from_power_outage) {
628-
injectCommands_P(PSTR("M1000 C")); // Cancel recovery
629+
injectCommands(F("M1000 C")); // Cancel recovery
629630
printer_state = AC_printer_idle;
630631
}
631632
#if ACDebugLevel >= 1
@@ -638,8 +639,8 @@ void ChironTFT::PanelAction(uint8_t req) {
638639
case 15: // A15 Resuming from outage
639640
if (printer_state == AC_printer_resuming_from_power_outage) {
640641
// Need to home here to restore the Z position
641-
injectCommands_P(AC_cmnd_power_loss_recovery);
642-
injectCommands_P(PSTR("M1000")); // home and start recovery
642+
injectCommands(AC_cmnd_power_loss_recovery);
643+
injectCommands(F("M1000")); // home and start recovery
643644
}
644645
break;
645646

@@ -675,17 +676,17 @@ void ChironTFT::PanelAction(uint8_t req) {
675676
if (panel_command[4] == 'S')
676677
setFeedrate_percent(atoi(&panel_command[5]));
677678
else {
678-
SendtoTFT(PSTR("A20V "));
679+
SendtoTFT(F("A20V "));
679680
TFTSer.println(getFeedrate_percent());
680681
}
681682
break;
682683

683684
case 21: // A21 Home Axis A21 X
684685
if (!isPrinting()) {
685686
switch ((char)panel_command[4]) {
686-
case 'X': injectCommands_P(PSTR("G28X")); break;
687-
case 'Y': injectCommands_P(PSTR("G28Y")); break;
688-
case 'Z': injectCommands_P(PSTR("G28Z")); break;
687+
case 'X': injectCommands(F("G28X")); break;
688+
case 'Y': injectCommands(F("G28Y")); break;
689+
case 'Z': injectCommands(F("G28Z")); break;
689690
case 'C': injectCommands_P(G28_STR); break;
690691
}
691692
}
@@ -771,7 +772,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
771772
pos.y = atoi(&panel_command[FindToken('Y')+1]);
772773
pos_z = getMeshPoint(pos);
773774

774-
SendtoTFT(PSTR("A29V "));
775+
SendtoTFT(F("A29V "));
775776
TFTSer.println(pos_z * 100);
776777
if (!isPrinting()) {
777778
setSoftEndstopState(true); // disable endstops
@@ -809,7 +810,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
809810

810811

811812
SendtoTFTLN(AC_msg_start_probing);
812-
injectCommands_P(PSTR("G28\nG29"));
813+
injectCommands(F("G28\nG29"));
813814
printer_state = AC_printer_probing;
814815
}
815816
}
@@ -823,7 +824,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
823824

824825
if (FindToken('C') != -1) { // Restore and apply original offsets
825826
if (!isPrinting()) {
826-
injectCommands_P(PSTR("M501\nM420 S1"));
827+
injectCommands(F("M501\nM420 S1"));
827828
selectedmeshpoint.x = selectedmeshpoint.y = 99;
828829
SERIAL_ECHOLNF(AC_msg_mesh_changes_abandoned);
829830
}
@@ -832,14 +833,14 @@ void ChironTFT::PanelProcess(uint8_t req) {
832833
else if (FindToken('D') != -1) { // Save Z Offset tables and restore leveling state
833834
if (!isPrinting()) {
834835
setAxisPosition_mm(1.0,Z); // Lift nozzle before any further movements are made
835-
injectCommands_P(PSTR("M500"));
836+
injectCommands(F("M500"));
836837
SERIAL_ECHOLNF(AC_msg_mesh_changes_saved);
837838
selectedmeshpoint.x = selectedmeshpoint.y = 99;
838839
}
839840
}
840841

841842
else if (FindToken('G') != -1) { // Get current offset
842-
SendtoTFT(PSTR("A31V "));
843+
SendtoTFT(F("A31V "));
843844
// When printing use the live z Offset position
844845
// we will use babystepping to move the print head
845846
if (isPrinting())
@@ -874,7 +875,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
874875
babystepAxis_steps(steps, Z);
875876
live_Zoffset += Zshift;
876877
}
877-
SendtoTFT(PSTR("A31V "));
878+
SendtoTFT(F("A31V "));
878879
TFTSer.println(live_Zoffset);
879880
}
880881
else {
@@ -892,7 +893,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
892893
#endif
893894

894895
setZOffset_mm(currZOffset + Zshift);
895-
SendtoTFT(PSTR("A31V "));
896+
SendtoTFT(F("A31V "));
896897
TFTSer.println(getZOffset_mm());
897898

898899
if (isAxisPositionKnown(Z)) {
@@ -911,15 +912,15 @@ void ChironTFT::PanelProcess(uint8_t req) {
911912
case 32: { // A32 clean leveling beep flag
912913
// Ignore request if printing
913914
//if (isPrinting()) break;
914-
//injectCommands_P(PSTR("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000"));
915+
//injectCommands(F("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000"));
915916
//TFTSer.println();
916917
} break;
917918

918919
// A33 firmware info request see PanelInfo()
919920

920921
case 34: { // A34 Adjust single mesh point A34 C/S X1 Y1 V123
921922
if (panel_command[3] == 'C') { // Restore original offsets
922-
injectCommands_P(PSTR("M501\nM420 S1"));
923+
injectCommands(F("M501\nM420 S1"));
923924
selectedmeshpoint.x = selectedmeshpoint.y = 99;
924925
//printer_state = AC_printer_idle;
925926
}

Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,16 @@ class ChironTFT {
5959
public:
6060
static void Startup();
6161
static void IdleLoop();
62-
static void PrinterKilled(PGM_P,PGM_P);
62+
static void PrinterKilled(PGM_P, PGM_P);
6363
static void MediaEvent(media_event_t);
6464
static void TimerEvent(timer_event_t);
6565
static void FilamentRunout();
66-
static void ConfirmationRequest(const char * const );
67-
static void StatusChange(const char * const );
66+
static void ConfirmationRequest(const char * const);
67+
static void StatusChange(const char * const);
6868
static void PowerLossRecovery();
6969
static void PrintComplete();
70-
static void SendtoTFT(PGM_P);
71-
static void SendtoTFTLN(PGM_P);
70+
static void SendtoTFT(FSTR_P const);
71+
static void SendtoTFTLN(FSTR_P const);
7272
private:
7373
static void DetectPanelType();
7474
static bool ReadTFTCommand();

0 commit comments

Comments
 (0)