🎨 Apply F() to some ExtUI functions

This commit is contained in:
Scott Lahteine 2021-09-25 22:11:48 -05:00
parent 7626d859a6
commit c3ae221a10
37 changed files with 277 additions and 278 deletions

View File

@ -961,7 +961,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER); LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER);
BUZZ(200, 404); BUZZ(200, 404);
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR))); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("MMU2 Eject Recover"))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("MMU2 Eject Recover")));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response()); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
BUZZ(200, 404); BUZZ(200, 404);
BUZZ(200, 404); BUZZ(200, 404);

View File

@ -194,7 +194,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
KEEPALIVE_STATE(PAUSED_FOR_USER); KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = true; // LCD click or M108 will clear this wait_for_user = true; // LCD click or M108 will clear this
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament"))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Load Filament")));
#if ENABLED(HOST_PROMPT_SUPPORT) #if ENABLED(HOST_PROMPT_SUPPORT)
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder); 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
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE); if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_PURGE))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)));
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR))); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR)));
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT(MSG_FILAMENT_CHANGE_PURGE), CONTINUE_STR)); TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT(MSG_FILAMENT_CHANGE_PURGE), CONTINUE_STR));
wait_for_user = true; // A click or M108 breaks the purge_length loop 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
// Wait for filament insert by user and press button // Wait for filament insert by user and press button
KEEPALIVE_STATE(PAUSED_FOR_USER); KEEPALIVE_STATE(PAUSED_FOR_USER);
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_NOZZLE_PARKED), FPSTR(CONTINUE_STR))); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_NOZZLE_PARKED), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_NOZZLE_PARKED))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_NOZZLE_PARKED)));
wait_for_user = true; // LCD click or M108 will clear this wait_for_user = true; // LCD click or M108 will clear this
while (wait_for_user) { while (wait_for_user) {
impatient_beep(max_beep_count); impatient_beep(max_beep_count);
@ -530,13 +530,13 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_HEATER_TIMEOUT), GET_TEXT_F(MSG_REHEAT))); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_HEATER_TIMEOUT), GET_TEXT_F(MSG_REHEAT)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_HEATER_TIMEOUT))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_HEATER_TIMEOUT)));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(0, true)); // Wait for LCD click or M108 TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(0, true)); // Wait for LCD click or M108
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, GET_TEXT_F(MSG_REHEATING))); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, GET_TEXT_F(MSG_REHEATING)));
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged_P(GET_TEXT(MSG_REHEATING))); TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(GET_TEXT_F(MSG_REHEATING)));
TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_REHEATING)); TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_REHEATING));
@ -555,7 +555,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout); HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_REHEATDONE), FPSTR(CONTINUE_STR))); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_REHEATDONE), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_REHEATDONE))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_REHEATDONE)));
TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_REHEATDONE)); TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_REHEATDONE));
IF_DISABLED(PAUSE_REHEAT_FAST_RESUME, wait_for_user = true); IF_DISABLED(PAUSE_REHEAT_FAST_RESUME, wait_for_user = true);

View File

@ -345,7 +345,7 @@ void GcodeSuite::M43() {
KEEPALIVE_STATE(PAUSED_FOR_USER); KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = true; wait_for_user = true;
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("M43 Wait Called"), FPSTR(CONTINUE_STR))); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("M43 Wait Called"), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("M43 Wait Called"))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("M43 Wait Called")));
#endif #endif
for (;;) { for (;;) {

View File

@ -69,7 +69,7 @@ void GcodeSuite::M0_M1() {
if (parser.string_arg) if (parser.string_arg)
ExtUI::onUserConfirmRequired(parser.string_arg); // Can this take an SRAM string?? ExtUI::onUserConfirmRequired(parser.string_arg); // Can this take an SRAM string??
else else
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT)); ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_USERWAIT));
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED) #elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
if (parser.string_arg) if (parser.string_arg)
DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT)); DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT));

View File

@ -96,7 +96,7 @@ void GcodeSuite::M1001() {
#if HAS_LEDS_OFF_FLAG #if HAS_LEDS_OFF_FLAG
if (long_print) { if (long_print) {
printerEventLEDs.onPrintCompleted(); printerEventLEDs.onPrintCompleted();
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PRINT_DONE)));
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_PRINT_DONE), FPSTR(CONTINUE_STR))); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_PRINT_DONE), FPSTR(CONTINUE_STR)));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(SEC_TO_MS(TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30)))); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(SEC_TO_MS(TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30))));
printerEventLEDs.onResumeAfterWait(); printerEventLEDs.onResumeAfterWait();

View File

@ -157,7 +157,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
// The new panel ignores entries that don't end in .GCO or .gcode so add and pad them. // The new panel ignores entries that don't end in .GCO or .gcode so add and pad them.
if (paneltype == AC_panel_new) { if (paneltype == AC_panel_new) {
TFTSer.println("<<.GCO"); TFTSer.println("<<.GCO");
Chiron.SendtoTFTLN(PSTR(".. .gcode")); Chiron.SendtoTFTLN(F(".. .gcode"));
} }
else { else {
TFTSer.println("<<"); TFTSer.println("<<");

View File

@ -99,7 +99,7 @@ void ChironTFT::Startup() {
// Enable leveling and Disable end stops during print // Enable leveling and Disable end stops during print
// as Z home places nozzle above the bed so we need to allow it past the end stops // as Z home places nozzle above the bed so we need to allow it past the end stops
injectCommands_P(AC_cmnd_enable_leveling); injectCommands(AC_cmnd_enable_leveling);
// Startup tunes are defined in Tunes.h // Startup tunes are defined in Tunes.h
PlayTune(BEEPER_PIN, TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn), 1); PlayTune(BEEPER_PIN, TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn), 1);
@ -244,7 +244,7 @@ void ChironTFT::StatusChange(const char * const msg) {
// If probing completes ok save the mesh and park // If probing completes ok save the mesh and park
// Ignore the custom machine name // Ignore the custom machine name
if (strcmp_P(msg + strlen(CUSTOM_MACHINE_NAME), MARLIN_msg_ready) == 0) { if (strcmp_P(msg + strlen(CUSTOM_MACHINE_NAME), MARLIN_msg_ready) == 0) {
injectCommands_P(PSTR("M500\nG27")); injectCommands(F("M500\nG27"));
SendtoTFTLN(AC_msg_probing_complete); SendtoTFTLN(AC_msg_probing_complete);
printer_state = AC_printer_idle; printer_state = AC_printer_idle;
msg_matched = true; msg_matched = true;
@ -252,7 +252,7 @@ void ChironTFT::StatusChange(const char * const msg) {
// If probing fails don't save the mesh raise the probe above the bad point // If probing fails don't save the mesh raise the probe above the bad point
if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) { if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) {
PlayTune(BEEPER_PIN, BeepBeepBeeep, 1); PlayTune(BEEPER_PIN, BeepBeepBeeep, 1);
injectCommands_P(PSTR("G1 Z50 F500")); injectCommands(F("G1 Z50 F500"));
SendtoTFTLN(AC_msg_probing_complete); SendtoTFTLN(AC_msg_probing_complete);
printer_state = AC_printer_idle; printer_state = AC_printer_idle;
msg_matched = true; msg_matched = true;
@ -315,19 +315,20 @@ void ChironTFT::PrintComplete() {
setSoftEndstopState(true); // enable endstops setSoftEndstopState(true); // enable endstops
} }
void ChironTFT::SendtoTFT(PGM_P str) { // A helper to print PROGMEM string to the panel void ChironTFT::SendtoTFT(FSTR_P const fstr) { // A helper to print PROGMEM string to the panel
#if ACDEBUG(AC_SOME) #if ACDEBUG(AC_SOME)
SERIAL_ECHOPGM_P(str); SERIAL_ECHOF(fstr);
#endif #endif
PGM_P str = FTOP(fstr);
while (const char c = pgm_read_byte(str++)) TFTSer.write(c); while (const char c = pgm_read_byte(str++)) TFTSer.write(c);
} }
void ChironTFT::SendtoTFTLN(PGM_P str = nullptr) { void ChironTFT::SendtoTFTLN(FSTR_P const fstr) {
if (str) { if (fstr) {
#if ACDEBUG(AC_SOME) #if ACDEBUG(AC_SOME)
SERIAL_ECHOPGM("> "); SERIAL_ECHOPGM("> ");
#endif #endif
SendtoTFT(str); SendtoTFT(fstr);
#if ACDEBUG(AC_SOME) #if ACDEBUG(AC_SOME)
SERIAL_EOL(); SERIAL_EOL();
#endif #endif
@ -426,9 +427,9 @@ void ChironTFT::SendFileList(int8_t startindex) {
#if ACDEBUG(AC_INFO) #if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPGM("## SendFileList ## ", startindex); SERIAL_ECHOLNPGM("## SendFileList ## ", startindex);
#endif #endif
SendtoTFTLN(PSTR("FN ")); SendtoTFTLN(F("FN "));
filenavigator.getFiles(startindex, panel_type, 4); filenavigator.getFiles(startindex, panel_type, 4);
SendtoTFTLN(PSTR("END")); SendtoTFTLN(F("END"));
} }
void ChironTFT::SelectFile() { void ChironTFT::SelectFile() {
@ -512,55 +513,55 @@ void ChironTFT::PanelInfo(uint8_t req) {
// information requests A0-A8 and A33 // information requests A0-A8 and A33
switch (req) { switch (req) {
case 0: // A0 Get HOTEND Temp case 0: // A0 Get HOTEND Temp
SendtoTFT(PSTR("A0V ")); SendtoTFT(F("A0V "));
TFTSer.println(getActualTemp_celsius(E0)); TFTSer.println(getActualTemp_celsius(E0));
break; break;
case 1: // A1 Get HOTEND Target Temp case 1: // A1 Get HOTEND Target Temp
SendtoTFT(PSTR("A1V ")); SendtoTFT(F("A1V "));
TFTSer.println(getTargetTemp_celsius(E0)); TFTSer.println(getTargetTemp_celsius(E0));
break; break;
case 2: // A2 Get BED Temp case 2: // A2 Get BED Temp
SendtoTFT(PSTR("A2V ")); SendtoTFT(F("A2V "));
TFTSer.println(getActualTemp_celsius(BED)); TFTSer.println(getActualTemp_celsius(BED));
break; break;
case 3: // A3 Get BED Target Temp case 3: // A3 Get BED Target Temp
SendtoTFT(PSTR("A3V ")); SendtoTFT(F("A3V "));
TFTSer.println(getTargetTemp_celsius(BED)); TFTSer.println(getTargetTemp_celsius(BED));
break; break;
case 4: // A4 Get FAN Speed case 4: // A4 Get FAN Speed
SendtoTFT(PSTR("A4V ")); SendtoTFT(F("A4V "));
TFTSer.println(getActualFan_percent(FAN0)); TFTSer.println(getActualFan_percent(FAN0));
break; break;
case 5: // A5 Get Current Coordinates case 5: // A5 Get Current Coordinates
SendtoTFT(PSTR("A5V X: ")); SendtoTFT(F("A5V X: "));
TFTSer.print(getAxisPosition_mm(X)); TFTSer.print(getAxisPosition_mm(X));
SendtoTFT(PSTR(" Y: ")); SendtoTFT(F(" Y: "));
TFTSer.print(getAxisPosition_mm(Y)); TFTSer.print(getAxisPosition_mm(Y));
SendtoTFT(PSTR(" Z: ")); SendtoTFT(F(" Z: "));
TFTSer.println(getAxisPosition_mm(Z)); TFTSer.println(getAxisPosition_mm(Z));
break; break;
case 6: // A6 Get printing progress case 6: // A6 Get printing progress
if (isPrintingFromMedia()) { if (isPrintingFromMedia()) {
SendtoTFT(PSTR("A6V ")); SendtoTFT(F("A6V "));
TFTSer.println(ui8tostr2(getProgress_percent())); TFTSer.println(ui8tostr2(getProgress_percent()));
} }
else else
SendtoTFTLN(PSTR("A6V ---")); SendtoTFTLN(F("A6V ---"));
break; break;
case 7: { // A7 Get Printing Time case 7: { // A7 Get Printing Time
uint32_t time = getProgress_seconds_elapsed() / 60; uint32_t time = getProgress_seconds_elapsed() / 60;
SendtoTFT(PSTR("A7V ")); SendtoTFT(F("A7V "));
TFTSer.print(ui8tostr2(time / 60)); TFTSer.print(ui8tostr2(time / 60));
SendtoTFT(PSTR(" H ")); SendtoTFT(F(" H "));
TFTSer.print(ui8tostr2(time % 60)); TFTSer.print(ui8tostr2(time % 60));
SendtoTFT(PSTR(" M")); SendtoTFT(F(" M"));
#if ACDEBUG(AC_ALL) #if ACDEBUG(AC_ALL)
SERIAL_ECHOLNPGM("Print time ", ui8tostr2(time / 60), ":", ui8tostr2(time % 60)); SERIAL_ECHOLNPGM("Print time ", ui8tostr2(time / 60), ":", ui8tostr2(time % 60));
#endif #endif
@ -575,9 +576,9 @@ void ChironTFT::PanelInfo(uint8_t req) {
break; break;
case 33: // A33 Get firmware info case 33: // A33 Get firmware info
SendtoTFT(PSTR("J33 ")); SendtoTFT(F("J33 "));
// If there is an error recorded, show that instead of the FW version // If there is an error recorded, show that instead of the FW version
if (!GetLastError()) SendtoTFTLN(PSTR(SHORT_BUILD_VERSION)); if (!GetLastError()) SendtoTFTLN(F(SHORT_BUILD_VERSION));
break; break;
} }
} }
@ -608,7 +609,7 @@ void ChironTFT::PanelAction(uint8_t req) {
} }
else { else {
if (printer_state == AC_printer_resuming_from_power_outage) if (printer_state == AC_printer_resuming_from_power_outage)
injectCommands_P(PSTR("M1000 C")); // Cancel recovery injectCommands(F("M1000 C")); // Cancel recovery
SendtoTFTLN(AC_msg_stop); SendtoTFTLN(AC_msg_stop);
printer_state = AC_printer_idle; printer_state = AC_printer_idle;
} }
@ -625,7 +626,7 @@ void ChironTFT::PanelAction(uint8_t req) {
case 14: { // A14 Start Printing case 14: { // A14 Start Printing
// Allows printer to restart the job if we don't want to recover // Allows printer to restart the job if we don't want to recover
if (printer_state == AC_printer_resuming_from_power_outage) { if (printer_state == AC_printer_resuming_from_power_outage) {
injectCommands_P(PSTR("M1000 C")); // Cancel recovery injectCommands(F("M1000 C")); // Cancel recovery
printer_state = AC_printer_idle; printer_state = AC_printer_idle;
} }
#if ACDebugLevel >= 1 #if ACDebugLevel >= 1
@ -638,8 +639,8 @@ void ChironTFT::PanelAction(uint8_t req) {
case 15: // A15 Resuming from outage case 15: // A15 Resuming from outage
if (printer_state == AC_printer_resuming_from_power_outage) { if (printer_state == AC_printer_resuming_from_power_outage) {
// Need to home here to restore the Z position // Need to home here to restore the Z position
injectCommands_P(AC_cmnd_power_loss_recovery); injectCommands(AC_cmnd_power_loss_recovery);
injectCommands_P(PSTR("M1000")); // home and start recovery injectCommands(F("M1000")); // home and start recovery
} }
break; break;
@ -675,7 +676,7 @@ void ChironTFT::PanelAction(uint8_t req) {
if (panel_command[4] == 'S') if (panel_command[4] == 'S')
setFeedrate_percent(atoi(&panel_command[5])); setFeedrate_percent(atoi(&panel_command[5]));
else { else {
SendtoTFT(PSTR("A20V ")); SendtoTFT(F("A20V "));
TFTSer.println(getFeedrate_percent()); TFTSer.println(getFeedrate_percent());
} }
break; break;
@ -683,9 +684,9 @@ void ChironTFT::PanelAction(uint8_t req) {
case 21: // A21 Home Axis A21 X case 21: // A21 Home Axis A21 X
if (!isPrinting()) { if (!isPrinting()) {
switch ((char)panel_command[4]) { switch ((char)panel_command[4]) {
case 'X': injectCommands_P(PSTR("G28X")); break; case 'X': injectCommands(F("G28X")); break;
case 'Y': injectCommands_P(PSTR("G28Y")); break; case 'Y': injectCommands(F("G28Y")); break;
case 'Z': injectCommands_P(PSTR("G28Z")); break; case 'Z': injectCommands(F("G28Z")); break;
case 'C': injectCommands_P(G28_STR); break; case 'C': injectCommands_P(G28_STR); break;
} }
} }
@ -771,7 +772,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
pos.y = atoi(&panel_command[FindToken('Y')+1]); pos.y = atoi(&panel_command[FindToken('Y')+1]);
pos_z = getMeshPoint(pos); pos_z = getMeshPoint(pos);
SendtoTFT(PSTR("A29V ")); SendtoTFT(F("A29V "));
TFTSer.println(pos_z * 100); TFTSer.println(pos_z * 100);
if (!isPrinting()) { if (!isPrinting()) {
setSoftEndstopState(true); // disable endstops setSoftEndstopState(true); // disable endstops
@ -809,7 +810,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
SendtoTFTLN(AC_msg_start_probing); SendtoTFTLN(AC_msg_start_probing);
injectCommands_P(PSTR("G28\nG29")); injectCommands(F("G28\nG29"));
printer_state = AC_printer_probing; printer_state = AC_printer_probing;
} }
} }
@ -823,7 +824,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
if (FindToken('C') != -1) { // Restore and apply original offsets if (FindToken('C') != -1) { // Restore and apply original offsets
if (!isPrinting()) { if (!isPrinting()) {
injectCommands_P(PSTR("M501\nM420 S1")); injectCommands(F("M501\nM420 S1"));
selectedmeshpoint.x = selectedmeshpoint.y = 99; selectedmeshpoint.x = selectedmeshpoint.y = 99;
SERIAL_ECHOLNF(AC_msg_mesh_changes_abandoned); SERIAL_ECHOLNF(AC_msg_mesh_changes_abandoned);
} }
@ -832,14 +833,14 @@ void ChironTFT::PanelProcess(uint8_t req) {
else if (FindToken('D') != -1) { // Save Z Offset tables and restore leveling state else if (FindToken('D') != -1) { // Save Z Offset tables and restore leveling state
if (!isPrinting()) { if (!isPrinting()) {
setAxisPosition_mm(1.0,Z); // Lift nozzle before any further movements are made setAxisPosition_mm(1.0,Z); // Lift nozzle before any further movements are made
injectCommands_P(PSTR("M500")); injectCommands(F("M500"));
SERIAL_ECHOLNF(AC_msg_mesh_changes_saved); SERIAL_ECHOLNF(AC_msg_mesh_changes_saved);
selectedmeshpoint.x = selectedmeshpoint.y = 99; selectedmeshpoint.x = selectedmeshpoint.y = 99;
} }
} }
else if (FindToken('G') != -1) { // Get current offset else if (FindToken('G') != -1) { // Get current offset
SendtoTFT(PSTR("A31V ")); SendtoTFT(F("A31V "));
// When printing use the live z Offset position // When printing use the live z Offset position
// we will use babystepping to move the print head // we will use babystepping to move the print head
if (isPrinting()) if (isPrinting())
@ -874,7 +875,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
babystepAxis_steps(steps, Z); babystepAxis_steps(steps, Z);
live_Zoffset += Zshift; live_Zoffset += Zshift;
} }
SendtoTFT(PSTR("A31V ")); SendtoTFT(F("A31V "));
TFTSer.println(live_Zoffset); TFTSer.println(live_Zoffset);
} }
else { else {
@ -892,7 +893,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
#endif #endif
setZOffset_mm(currZOffset + Zshift); setZOffset_mm(currZOffset + Zshift);
SendtoTFT(PSTR("A31V ")); SendtoTFT(F("A31V "));
TFTSer.println(getZOffset_mm()); TFTSer.println(getZOffset_mm());
if (isAxisPositionKnown(Z)) { if (isAxisPositionKnown(Z)) {
@ -911,7 +912,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
case 32: { // A32 clean leveling beep flag case 32: { // A32 clean leveling beep flag
// Ignore request if printing // Ignore request if printing
//if (isPrinting()) break; //if (isPrinting()) break;
//injectCommands_P(PSTR("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000")); //injectCommands(F("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000"));
//TFTSer.println(); //TFTSer.println();
} break; } break;
@ -919,7 +920,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
case 34: { // A34 Adjust single mesh point A34 C/S X1 Y1 V123 case 34: { // A34 Adjust single mesh point A34 C/S X1 Y1 V123
if (panel_command[3] == 'C') { // Restore original offsets if (panel_command[3] == 'C') { // Restore original offsets
injectCommands_P(PSTR("M501\nM420 S1")); injectCommands(F("M501\nM420 S1"));
selectedmeshpoint.x = selectedmeshpoint.y = 99; selectedmeshpoint.x = selectedmeshpoint.y = 99;
//printer_state = AC_printer_idle; //printer_state = AC_printer_idle;
} }

View File

@ -59,16 +59,16 @@ class ChironTFT {
public: public:
static void Startup(); static void Startup();
static void IdleLoop(); static void IdleLoop();
static void PrinterKilled(PGM_P,PGM_P); static void PrinterKilled(PGM_P, PGM_P);
static void MediaEvent(media_event_t); static void MediaEvent(media_event_t);
static void TimerEvent(timer_event_t); static void TimerEvent(timer_event_t);
static void FilamentRunout(); static void FilamentRunout();
static void ConfirmationRequest(const char * const ); static void ConfirmationRequest(const char * const);
static void StatusChange(const char * const ); static void StatusChange(const char * const);
static void PowerLossRecovery(); static void PowerLossRecovery();
static void PrintComplete(); static void PrintComplete();
static void SendtoTFT(PGM_P); static void SendtoTFT(FSTR_P const);
static void SendtoTFTLN(PGM_P); static void SendtoTFTLN(FSTR_P const);
private: private:
static void DetectPanelType(); static void DetectPanelType();
static bool ReadTFTCommand(); static bool ReadTFTCommand();

View File

@ -57,46 +57,46 @@
#define AC_LOWEST_MESHPOINT_VAL -10 // The lowest value you can set for a single mesh point offset #define AC_LOWEST_MESHPOINT_VAL -10 // The lowest value you can set for a single mesh point offset
// TFT panel commands // TFT panel commands
#define AC_msg_sd_card_inserted PSTR("J00") #define AC_msg_sd_card_inserted F("J00")
#define AC_msg_sd_card_removed PSTR("J01") #define AC_msg_sd_card_removed F("J01")
#define AC_msg_no_sd_card PSTR("J02") #define AC_msg_no_sd_card F("J02")
#define AC_msg_usb_connected PSTR("J03") #define AC_msg_usb_connected F("J03")
#define AC_msg_print_from_sd_card PSTR("J04") #define AC_msg_print_from_sd_card F("J04")
#define AC_msg_pause PSTR("J05") #define AC_msg_pause F("J05")
#define AC_msg_nozzle_heating PSTR("J06") #define AC_msg_nozzle_heating F("J06")
#define AC_msg_nozzle_heating_done PSTR("J07") #define AC_msg_nozzle_heating_done F("J07")
#define AC_msg_bed_heating PSTR("J08") #define AC_msg_bed_heating F("J08")
#define AC_msg_bed_heating_done PSTR("J09") #define AC_msg_bed_heating_done F("J09")
#define AC_msg_nozzle_temp_abnormal PSTR("J10") #define AC_msg_nozzle_temp_abnormal F("J10")
#define AC_msg_kill_lcd PSTR("J11") #define AC_msg_kill_lcd F("J11")
#define AC_msg_ready PSTR("J12") #define AC_msg_ready F("J12")
#define AC_msg_low_nozzle_temp PSTR("J13") #define AC_msg_low_nozzle_temp F("J13")
#define AC_msg_print_complete PSTR("J14") #define AC_msg_print_complete F("J14")
#define AC_msg_filament_out_alert PSTR("J15") #define AC_msg_filament_out_alert F("J15")
#define AC_msg_stop PSTR("J16") #define AC_msg_stop F("J16")
#define AC_msg_main_board_has_reset PSTR("J17") #define AC_msg_main_board_has_reset F("J17")
#define AC_msg_paused PSTR("J18") #define AC_msg_paused F("J18")
#define AC_msg_j19_unknown PSTR("J19") #define AC_msg_j19_unknown F("J19")
#define AC_msg_sd_file_open_success PSTR("J20") #define AC_msg_sd_file_open_success F("J20")
#define AC_msg_sd_file_open_failed PSTR("J21") #define AC_msg_sd_file_open_failed F("J21")
#define AC_msg_level_monitor_finished PSTR("J22") #define AC_msg_level_monitor_finished F("J22")
#define AC_msg_filament_out_block PSTR("J23") #define AC_msg_filament_out_block F("J23")
#define AC_msg_probing_not_allowed PSTR("J24") #define AC_msg_probing_not_allowed F("J24")
#define AC_msg_probing_complete PSTR("J25") #define AC_msg_probing_complete F("J25")
#define AC_msg_start_probing PSTR("J26") #define AC_msg_start_probing F("J26")
#define AC_msg_version PSTR("J27") #define AC_msg_version F("J27")
#define AC_msg_mesh_changes_abandoned PSTR("Mesh changes abandoned, previous mesh restored.") #define AC_msg_mesh_changes_abandoned F("Mesh changes abandoned, previous mesh restored.")
#define AC_msg_mesh_changes_saved PSTR("Mesh changes saved.") #define AC_msg_mesh_changes_saved F("Mesh changes saved.")
#define AC_msg_old_panel_detected PSTR("Standard TFT panel detected!") #define AC_msg_old_panel_detected F("Standard TFT panel detected!")
#define AC_msg_new_panel_detected PSTR("New TFT panel detected!") #define AC_msg_new_panel_detected F("New TFT panel detected!")
#define AC_msg_powerloss_recovery PSTR("Resuming from power outage! select the same SD file then press resume") #define AC_msg_powerloss_recovery F("Resuming from power outage! select the same SD file then press resume")
// Error messages must not contain spaces // Error messages must not contain spaces
#define AC_msg_error_bed_temp PSTR("Abnormal_bed_temp") #define AC_msg_error_bed_temp F("Abnormal_bed_temp")
#define AC_msg_error_hotend_temp PSTR("Abnormal_hotend_temp") #define AC_msg_error_hotend_temp F("Abnormal_hotend_temp")
#define AC_msg_error_sd_card PSTR("SD_card_error") #define AC_msg_error_sd_card F("SD_card_error")
#define AC_msg_filament_out PSTR("Filament_runout") #define AC_msg_filament_out F("Filament_runout")
#define AC_msg_power_loss PSTR("Power_failure") #define AC_msg_power_loss F("Power_failure")
#define AC_msg_eeprom_version PSTR("EEPROM_ver_wrong") #define AC_msg_eeprom_version F("EEPROM_ver_wrong")
#define MARLIN_msg_start_probing PSTR("Probing Point 1/25") #define MARLIN_msg_start_probing PSTR("Probing Point 1/25")
#define MARLIN_msg_probing_failed PSTR("Probing Failed") #define MARLIN_msg_probing_failed PSTR("Probing Failed")
@ -113,16 +113,16 @@
#define MARLIN_msg_filament_purging PSTR("Filament Purging...") #define MARLIN_msg_filament_purging PSTR("Filament Purging...")
#define MARLIN_msg_special_pause PSTR("PB") #define MARLIN_msg_special_pause PSTR("PB")
#define AC_cmnd_auto_unload_filament PSTR("M701") // Use Marlin unload routine #define AC_cmnd_auto_unload_filament F("M701") // Use Marlin unload routine
#define AC_cmnd_auto_load_filament PSTR("M702 M0 PB") // Use Marlin load routing then pause for user to clean nozzle #define AC_cmnd_auto_load_filament F("M702 M0 PB") // Use Marlin load routing then pause for user to clean nozzle
#define AC_cmnd_manual_load_filament PSTR("M83\nG1 E50 F700\nM82") // replace the manual panel commands with something a little faster #define AC_cmnd_manual_load_filament F("M83\nG1 E50 F700\nM82") // replace the manual panel commands with something a little faster
#define AC_cmnd_manual_unload_filament PSTR("M83\nG1 E-50 F1200\nM82") #define AC_cmnd_manual_unload_filament F("M83\nG1 E-50 F1200\nM82")
#define AC_cmnd_enable_leveling PSTR("M420SV") #define AC_cmnd_enable_leveling F("M420SV")
#define AC_cmnd_power_loss_recovery PSTR("G28XYR5\nG28Z") // Lift, home X and Y then home Z when in 'safe' position #define AC_cmnd_power_loss_recovery F("G28XYR5\nG28Z") // Lift, home X and Y then home Z when in 'safe' position
#define AC_Test_for_OldPanel PSTR("SIZE") // An old panel will respond with 'SXY 480 320' a new panel wont respond. #define AC_Test_for_OldPanel F("SIZE") // An old panel will respond with 'SXY 480 320' a new panel wont respond.
#define AC_Test_for_NewPanel PSTR("J200") // A new panel will respond with '[0]=0 [1]=0' to '[19]=0 ' an old panel wont respond #define AC_Test_for_NewPanel F("J200") // A new panel will respond with '[0]=0 [1]=0' to '[19]=0 ' an old panel wont respond
namespace Anycubic { namespace Anycubic {
enum heater_state_t : uint8_t { enum heater_state_t : uint8_t {

View File

@ -104,7 +104,7 @@ void AnycubicTFTClass::OnSetup() {
SelectedFile[0] = 0; SelectedFile[0] = 0;
#if ENABLED(STARTUP_CHIME) #if ENABLED(STARTUP_CHIME)
injectCommands_P(PSTR("M300 P250 S554\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P500 S831")); injectCommands(F("M300 P250 S554\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P500 S831"));
#endif #endif
#if ENABLED(ANYCUBIC_LCD_DEBUG) #if ENABLED(ANYCUBIC_LCD_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: Finished startup"); SERIAL_ECHOLNPGM("TFT Serial Debug: Finished startup");
@ -122,7 +122,7 @@ void AnycubicTFTClass::OnCommandScan() {
#endif #endif
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
injectCommands_P(PSTR("M84\nM27")); // disable stepper motors and force report of SD status injectCommands(F("M84\nM27")); // disable stepper motors and force report of SD status
delay_ms(200); delay_ms(200);
// tell printer to release resources of print to indicate it is done // tell printer to release resources of print to indicate it is done
SENDLINE_DBG_PGM("J14", "TFT Serial Debug: SD Print Stopped... J14"); SENDLINE_DBG_PGM("J14", "TFT Serial Debug: SD Print Stopped... J14");
@ -249,48 +249,48 @@ void AnycubicTFTClass::HandleSpecialMenu() {
switch (SelectedDirectory[2]) { switch (SelectedDirectory[2]) {
case '1': // "<01ZUp0.1>" case '1': // "<01ZUp0.1>"
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.1"); SERIAL_ECHOLNPGM("Special Menu: Z Up 0.1");
injectCommands_P(PSTR("G91\nG1 Z+0.1\nG90")); injectCommands(F("G91\nG1 Z+0.1\nG90"));
break; break;
case '2': // "<02ZUp0.02>" case '2': // "<02ZUp0.02>"
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.02"); SERIAL_ECHOLNPGM("Special Menu: Z Up 0.02");
injectCommands_P(PSTR("G91\nG1 Z+0.02\nG90")); injectCommands(F("G91\nG1 Z+0.02\nG90"));
break; break;
case '3': // "<03ZDn0.02>" case '3': // "<03ZDn0.02>"
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.02"); SERIAL_ECHOLNPGM("Special Menu: Z Down 0.02");
injectCommands_P(PSTR("G91\nG1 Z-0.02\nG90")); injectCommands(F("G91\nG1 Z-0.02\nG90"));
break; break;
case '4': // "<04ZDn0.1>" case '4': // "<04ZDn0.1>"
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.1"); SERIAL_ECHOLNPGM("Special Menu: Z Down 0.1");
injectCommands_P(PSTR("G91\nG1 Z-0.1\nG90")); injectCommands(F("G91\nG1 Z-0.1\nG90"));
break; break;
case '5': // "<05PrehtBed>" case '5': // "<05PrehtBed>"
SERIAL_ECHOLNPGM("Special Menu: Preheat Bed"); SERIAL_ECHOLNPGM("Special Menu: Preheat Bed");
injectCommands_P(PSTR("M140 S65")); injectCommands(F("M140 S65"));
break; break;
case '6': // "<06SMeshLvl>" case '6': // "<06SMeshLvl>"
SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling"); SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling");
injectCommands_P(PSTR("G29S1")); injectCommands(F("G29S1"));
break; break;
case '7': // "<07MeshNPnt>" case '7': // "<07MeshNPnt>"
SERIAL_ECHOLNPGM("Special Menu: Next Mesh Point"); SERIAL_ECHOLNPGM("Special Menu: Next Mesh Point");
injectCommands_P(PSTR("G29S2")); injectCommands(F("G29S2"));
break; break;
case '8': // "<08HtEndPID>" case '8': // "<08HtEndPID>"
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotend PID"); SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotend PID");
// need to dwell for half a second to give the fan a chance to start before the pid tuning starts // need to dwell for half a second to give the fan a chance to start before the pid tuning starts
injectCommands_P(PSTR("M106 S204\nG4 P500\nM303 E0 S215 C15 U1")); injectCommands(F("M106 S204\nG4 P500\nM303 E0 S215 C15 U1"));
break; break;
case '9': // "<09HtBedPID>" case '9': // "<09HtBedPID>"
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid"); SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid");
injectCommands_P(PSTR("M303 E-1 S65 C6 U1")); injectCommands(F("M303 E-1 S65 C6 U1"));
break; break;
default: default:
@ -302,12 +302,12 @@ void AnycubicTFTClass::HandleSpecialMenu() {
switch (SelectedDirectory[2]) { switch (SelectedDirectory[2]) {
case '0': // "<10FWDeflts>" case '0': // "<10FWDeflts>"
SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults"); SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults");
injectCommands_P(PSTR("M502\nM300 P105 S1661\nM300 P210 S1108")); injectCommands(F("M502\nM300 P105 S1661\nM300 P210 S1108"));
break; break;
case '1': // "<11SvEEPROM>" case '1': // "<11SvEEPROM>"
SERIAL_ECHOLNPGM("Special Menu: Save EEPROM"); SERIAL_ECHOLNPGM("Special Menu: Save EEPROM");
injectCommands_P(PSTR("M500\nM300 P105 S1108\nM300 P210 S1661")); injectCommands(F("M500\nM300 P105 S1108\nM300 P210 S1661"));
break; break;
default: default:
@ -319,38 +319,38 @@ void AnycubicTFTClass::HandleSpecialMenu() {
switch (SelectedDirectory[2]) { switch (SelectedDirectory[2]) {
case '1': // "<01PrehtBed>" case '1': // "<01PrehtBed>"
SERIAL_ECHOLNPGM("Special Menu: Preheat Bed"); SERIAL_ECHOLNPGM("Special Menu: Preheat Bed");
injectCommands_P(PSTR("M140 S65")); injectCommands(F("M140 S65"));
break; break;
case '2': // "<02ABL>" case '2': // "<02ABL>"
SERIAL_ECHOLNPGM("Special Menu: Auto Bed Leveling"); SERIAL_ECHOLNPGM("Special Menu: Auto Bed Leveling");
injectCommands_P(PSTR("G29N")); injectCommands(F("G29N"));
break; break;
case '3': // "<03HtendPID>" case '3': // "<03HtendPID>"
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotend PID"); SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotend PID");
// need to dwell for half a second to give the fan a chance to start before the pid tuning starts // need to dwell for half a second to give the fan a chance to start before the pid tuning starts
injectCommands_P(PSTR("M106 S204\nG4 P500\nM303 E0 S215 C15 U1")); injectCommands(F("M106 S204\nG4 P500\nM303 E0 S215 C15 U1"));
break; break;
case '4': // "<04HtbedPID>" case '4': // "<04HtbedPID>"
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid"); SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid");
injectCommands_P(PSTR("M303 E-1 S65 C6 U1")); injectCommands(F("M303 E-1 S65 C6 U1"));
break; break;
case '5': // "<05FWDeflts>" case '5': // "<05FWDeflts>"
SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults"); SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults");
injectCommands_P(PSTR("M502\nM300 P105 S1661\nM300 P210 S1108")); injectCommands(F("M502\nM300 P105 S1661\nM300 P210 S1108"));
break; break;
case '6': // "<06SvEEPROM>" case '6': // "<06SvEEPROM>"
SERIAL_ECHOLNPGM("Special Menu: Save EEPROM"); SERIAL_ECHOLNPGM("Special Menu: Save EEPROM");
injectCommands_P(PSTR("M500\nM300 P105 S1108\nM300 P210 S1661")); injectCommands(F("M500\nM300 P105 S1108\nM300 P210 S1661"));
break; break;
case '7': // <07SendM108> case '7': // <07SendM108>
SERIAL_ECHOLNPGM("Special Menu: Send User Confirmation"); SERIAL_ECHOLNPGM("Special Menu: Send User Confirmation");
injectCommands_P(PSTR("M108")); injectCommands(F("M108"));
break; break;
default: default:
@ -705,7 +705,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
} }
else if (CodeSeen('C') && !isPrinting()) { else if (CodeSeen('C') && !isPrinting()) {
if (getAxisPosition_mm(Z) < 10) if (getAxisPosition_mm(Z) < 10)
injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS injectCommands(F("G1 Z10")); // RASE Z AXIS
tempvalue = constrain(CodeValue(), 0, 275); tempvalue = constrain(CodeValue(), 0, 275);
setTargetTemp_celsius(tempvalue, (extruder_t)E0); setTargetTemp_celsius(tempvalue, (extruder_t)E0);
} }
@ -756,11 +756,11 @@ void AnycubicTFTClass::GetCommandFromTFT() {
if (!isPrinting() && !isPrintingFromMediaPaused()) { if (!isPrinting() && !isPrintingFromMediaPaused()) {
if (CodeSeen('X') || CodeSeen('Y') || CodeSeen('Z')) { if (CodeSeen('X') || CodeSeen('Y') || CodeSeen('Z')) {
if (CodeSeen('X')) if (CodeSeen('X'))
injectCommands_P(PSTR("G28X")); injectCommands(F("G28X"));
if (CodeSeen('Y')) if (CodeSeen('Y'))
injectCommands_P(PSTR("G28Y")); injectCommands(F("G28Y"));
if (CodeSeen('Z')) if (CodeSeen('Z'))
injectCommands_P(PSTR("G28Z")); injectCommands(F("G28Z"));
} }
else if (CodeSeen('C')) { else if (CodeSeen('C')) {
injectCommands_P(G28_STR); injectCommands_P(G28_STR);
@ -831,7 +831,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
case 23: // A23 preheat pla case 23: // A23 preheat pla
if (!isPrinting()) { if (!isPrinting()) {
if (getAxisPosition_mm(Z) < 10) if (getAxisPosition_mm(Z) < 10)
injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS injectCommands(F("G1 Z10")); // RASE Z AXIS
setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (heater_t)BED); setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (heater_t)BED);
setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (extruder_t)E0); setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (extruder_t)E0);
@ -842,7 +842,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
case 24:// A24 preheat abs case 24:// A24 preheat abs
if (!isPrinting()) { if (!isPrinting()) {
if (getAxisPosition_mm(Z) < 10) if (getAxisPosition_mm(Z) < 10)
injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS injectCommands(F("G1 Z10")); // RASE Z AXIS
setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (heater_t)BED); setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (heater_t)BED);
setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (extruder_t)E0); setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (extruder_t)E0);
@ -933,7 +933,7 @@ void AnycubicTFTClass::DoFilamentRunoutCheck() {
if (READ(FIL_RUNOUT1_PIN)) { if (READ(FIL_RUNOUT1_PIN)) {
if (mediaPrintingState == AMPRINTSTATE_PRINTING || mediaPrintingState == AMPRINTSTATE_PAUSED || mediaPrintingState == AMPRINTSTATE_PAUSE_REQUESTED) { if (mediaPrintingState == AMPRINTSTATE_PRINTING || mediaPrintingState == AMPRINTSTATE_PAUSED || mediaPrintingState == AMPRINTSTATE_PAUSE_REQUESTED) {
// play tone to indicate filament is out // play tone to indicate filament is out
injectCommands_P(PSTR("\nM300 P200 S1567\nM300 P200 S1174\nM300 P200 S1567\nM300 P200 S1174\nM300 P2000 S1567")); injectCommands(F("\nM300 P200 S1567\nM300 P200 S1174\nM300 P200 S1567\nM300 P200 S1174\nM300 P2000 S1567"));
// tell the user that the filament has run out and wait // tell the user that the filament has run out and wait
SENDLINE_DBG_PGM("J23", "TFT Serial Debug: Blocking filament prompt... J23"); SENDLINE_DBG_PGM("J23", "TFT Serial Debug: Blocking filament prompt... J23");
@ -969,7 +969,7 @@ void AnycubicTFTClass::PausePrint() {
SENDLINE_DBG_PGM("J05", "TFT Serial Debug: SD print pause started... J05"); // J05 printing pause SENDLINE_DBG_PGM("J05", "TFT Serial Debug: SD print pause started... J05"); // J05 printing pause
// for some reason pausing the print doesn't retract the extruder so force a manual one here // for some reason pausing the print doesn't retract the extruder so force a manual one here
injectCommands_P(PSTR("G91\nG1 E-2 F1800\nG90")); injectCommands(F("G91\nG1 E-2 F1800\nG90"));
pausePrint(); pausePrint();
} }
#endif #endif
@ -1018,7 +1018,7 @@ void AnycubicTFTClass::StopPrint() {
SENDLINE_DBG_PGM("J16", "TFT Serial Debug: SD print stop called... J16"); SENDLINE_DBG_PGM("J16", "TFT Serial Debug: SD print stop called... J16");
// for some reason stopping the print doesn't retract the extruder so force a manual one here // for some reason stopping the print doesn't retract the extruder so force a manual one here
injectCommands_P(PSTR("G91\nG1 E-2 F1800\nG90")); injectCommands(F("G91\nG1 E-2 F1800\nG90"));
stopPrint(); stopPrint();
#endif #endif
} }

View File

@ -52,26 +52,26 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) {
#endif #endif
if (!ExtUI::isMediaInserted()) { if (!ExtUI::isMediaInserted()) {
dgus_screen_handler.SetStatusMessagePGM(GET_TEXT(MSG_NO_MEDIA)); dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_NO_MEDIA));
return; return;
} }
card.cdroot(); card.cdroot();
#else #else
dgus_screen_handler.SetStatusMessagePGM(GET_TEXT(MSG_NO_MEDIA)); dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_NO_MEDIA));
return; return;
#endif #endif
} }
if (vp.addr == DGUS_Addr::SCREENCHANGE_Idle if (vp.addr == DGUS_Addr::SCREENCHANGE_Idle
&& (ExtUI::isPrinting() || ExtUI::isPrintingPaused())) { && (ExtUI::isPrinting() || ExtUI::isPrintingPaused())) {
dgus_screen_handler.SetStatusMessagePGM(PSTR("Impossible while printing")); dgus_screen_handler.SetStatusMessage(F("Impossible while printing"));
return; return;
} }
if (vp.addr == DGUS_Addr::SCREENCHANGE_Printing if (vp.addr == DGUS_Addr::SCREENCHANGE_Printing
&& (!ExtUI::isPrinting() && !ExtUI::isPrintingPaused())) { && (!ExtUI::isPrinting() && !ExtUI::isPrintingPaused())) {
dgus_screen_handler.SetStatusMessagePGM(PSTR("Impossible while idle")); dgus_screen_handler.SetStatusMessage(F("Impossible while idle"));
return; return;
} }
@ -139,7 +139,7 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) {
UNUSED(data_ptr); UNUSED(data_ptr);
if (dgus_screen_handler.filelist_selected < 0) { if (dgus_screen_handler.filelist_selected < 0) {
dgus_screen_handler.SetStatusMessagePGM(PSTR("No file selected")); dgus_screen_handler.SetStatusMessage(F("No file selected"));
return; return;
} }
@ -149,7 +149,7 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) {
} }
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -207,7 +207,7 @@ void DGUSRxHandler::PrintResume(DGUS_VP &vp, void *data_ptr) {
} }
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -364,7 +364,7 @@ void DGUSRxHandler::TempCool(DGUS_VP &vp, void *data_ptr) {
#endif #endif
} }
dgus_screen_handler.SetStatusMessagePGM(PSTR("Cooling...")); dgus_screen_handler.SetStatusMessage(F("Cooling..."));
dgus_screen_handler.TriggerFullUpdate(); dgus_screen_handler.TriggerFullUpdate();
} }
@ -390,12 +390,12 @@ void DGUSRxHandler::ZOffset(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp); UNUSED(vp);
if (!ExtUI::isAxisPositionKnown(ExtUI::Z)) { if (!ExtUI::isAxisPositionKnown(ExtUI::Z)) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_HOMING_REQUIRED); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED));
return; return;
} }
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -414,12 +414,12 @@ void DGUSRxHandler::ZOffsetStep(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp); UNUSED(vp);
if (!ExtUI::isAxisPositionKnown(ExtUI::Z)) { if (!ExtUI::isAxisPositionKnown(ExtUI::Z)) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_HOMING_REQUIRED); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED));
return; return;
} }
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -456,12 +456,12 @@ void DGUSRxHandler::MoveToPoint(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp); UNUSED(vp);
if (!ExtUI::isPositionKnown()) { if (!ExtUI::isPositionKnown()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_HOMING_REQUIRED); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED));
return; return;
} }
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -506,17 +506,17 @@ void DGUSRxHandler::Probe(DGUS_VP &vp, void *data_ptr) {
UNUSED(data_ptr); UNUSED(data_ptr);
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_ABL_REQUIRED); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_ABL_REQUIRED));
return; return;
#endif #endif
if (!ExtUI::isPositionKnown()) { if (!ExtUI::isPositionKnown()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_HOMING_REQUIRED); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED));
return; return;
} }
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -535,7 +535,7 @@ void DGUSRxHandler::DisableABL(DGUS_VP &vp, void *data_ptr) {
UNUSED(data_ptr); UNUSED(data_ptr);
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -576,7 +576,7 @@ void DGUSRxHandler::FilamentMove(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp); UNUSED(vp);
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -600,7 +600,7 @@ void DGUSRxHandler::FilamentMove(DGUS_VP &vp, void *data_ptr) {
} }
if (ExtUI::getActualTemp_celsius(extruder) < (float)EXTRUDE_MINTEMP) { if (ExtUI::getActualTemp_celsius(extruder) < (float)EXTRUDE_MINTEMP) {
dgus_screen_handler.SetStatusMessagePGM(PSTR("Temperature too low")); dgus_screen_handler.SetStatusMessage(F("Temperature too low"));
return; return;
} }
@ -620,7 +620,7 @@ void DGUSRxHandler::Home(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp); UNUSED(vp);
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -664,7 +664,7 @@ void DGUSRxHandler::Move(DGUS_VP &vp, void *data_ptr) {
} }
if (!ExtUI::isAxisPositionKnown(axis)) { if (!ExtUI::isAxisPositionKnown(axis)) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_HOMING_REQUIRED); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED));
return; return;
} }
@ -720,7 +720,7 @@ void DGUSRxHandler::MoveStep(DGUS_VP &vp, void *data_ptr) {
} }
if (!ExtUI::isAxisPositionKnown(axis)) { if (!ExtUI::isAxisPositionKnown(axis)) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_HOMING_REQUIRED); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED));
return; return;
} }
@ -757,7 +757,7 @@ void DGUSRxHandler::GcodeExecute(DGUS_VP &vp, void *data_ptr) {
} }
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -780,7 +780,7 @@ void DGUSRxHandler::ResetEEPROM(DGUS_VP &vp, void *data_ptr) {
} }
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -798,7 +798,7 @@ void DGUSRxHandler::SettingsExtra(DGUS_VP &vp, void *data_ptr) {
case DGUS_Data::Extra::BUTTON1: case DGUS_Data::Extra::BUTTON1:
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -844,7 +844,7 @@ void DGUSRxHandler::PIDSetTemp(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp); UNUSED(vp);
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -875,7 +875,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
UNUSED(data_ptr); UNUSED(data_ptr);
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -889,7 +889,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
heater = H_BED; heater = H_BED;
break; break;
#else #else
dgus_screen_handler.SetStatusMessagePGM(PSTR("Bed PID disabled")); dgus_screen_handler.SetStatusMessage(F("Bed PID disabled"));
return; return;
#endif #endif
case DGUS_Data::Heater::H0: case DGUS_Data::Heater::H0:
@ -897,7 +897,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
heater = H_E0; heater = H_E0;
break; break;
#else #else
dgus_screen_handler.SetStatusMessagePGM(PSTR("PID disabled")); dgus_screen_handler.SetStatusMessage(F("PID disabled"));
return; return;
#endif #endif
#if HOTENDS > 1 #if HOTENDS > 1
@ -906,7 +906,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
heater = H_E1; heater = H_E1;
break; break;
#else #else
dgus_screen_handler.SetStatusMessagePGM(PSTR("PID disabled")); dgus_screen_handler.SetStatusMessage(F("PID disabled"));
return; return;
#endif #endif
#endif #endif
@ -936,7 +936,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
} }
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
@ -955,12 +955,12 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
} }
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return; return;
} }
if (!recovery.valid()) { if (!recovery.valid()) {
dgus_screen_handler.SetStatusMessagePGM(PSTR("Invalid recovery data")); dgus_screen_handler.SetStatusMessage(F("Invalid recovery data"));
return; return;
} }

View File

@ -135,20 +135,17 @@ void DGUSScreenHandler::Loop() {
return; return;
} }
if (current_screen == DGUS_Screen::LEVELING_PROBING if (current_screen == DGUS_Screen::LEVELING_PROBING && IsPrinterIdle()) {
&& IsPrinterIdle()) {
dgus_display.PlaySound(3); dgus_display.PlaySound(3);
SetStatusMessagePGM(ExtUI::getMeshValid() ? SetStatusMessage(ExtUI::getMeshValid() ? F("Probing successful") : F("Probing failed"));
PSTR("Probing successful")
: PSTR("Probing failed"));
MoveToScreen(DGUS_Screen::LEVELING_AUTOMATIC); MoveToScreen(DGUS_Screen::LEVELING_AUTOMATIC);
return; return;
} }
if (status_expire > 0 && ELAPSED(ms, status_expire)) { if (status_expire > 0 && ELAPSED(ms, status_expire)) {
SetStatusMessagePGM(NUL_STR, 0); SetStatusMessage(FPSTR(NUL_STR), 0);
return; return;
} }
@ -194,7 +191,7 @@ void DGUSScreenHandler::SettingsReset() {
Ready(); Ready();
} }
SetStatusMessagePGM(PSTR("EEPROM reset")); SetStatusMessage(F("EEPROM reset"));
} }
void DGUSScreenHandler::StoreSettings(char *buff) { void DGUSScreenHandler::StoreSettings(char *buff) {
@ -229,13 +226,13 @@ void DGUSScreenHandler::LoadSettings(const char *buff) {
void DGUSScreenHandler::ConfigurationStoreWritten(bool success) { void DGUSScreenHandler::ConfigurationStoreWritten(bool success) {
if (!success) { if (!success) {
SetStatusMessagePGM(PSTR("EEPROM write failed")); SetStatusMessage(F("EEPROM write failed"));
} }
} }
void DGUSScreenHandler::ConfigurationStoreRead(bool success) { void DGUSScreenHandler::ConfigurationStoreRead(bool success) {
if (!success) { if (!success) {
SetStatusMessagePGM(PSTR("EEPROM read failed")); SetStatusMessage(F("EEPROM read failed"));
} }
else if (!settings_ready) { else if (!settings_ready) {
settings_ready = true; settings_ready = true;
@ -324,7 +321,7 @@ void DGUSScreenHandler::FilamentRunout(const ExtUI::extruder_t extruder) {
} }
void DGUSScreenHandler::SDCardError() { void DGUSScreenHandler::SDCardError() {
SetStatusMessagePGM(GET_TEXT(MSG_MEDIA_READ_ERROR)); SetStatusMessage(GET_TEXT_F(MSG_MEDIA_READ_ERROR));
if (current_screen == DGUS_Screen::PRINT) { if (current_screen == DGUS_Screen::PRINT) {
TriggerScreenChange(DGUS_Screen::HOME); TriggerScreenChange(DGUS_Screen::HOME);
@ -346,19 +343,19 @@ void DGUSScreenHandler::FilamentRunout(const ExtUI::extruder_t extruder) {
void DGUSScreenHandler::PidTuning(const ExtUI::result_t rst) { void DGUSScreenHandler::PidTuning(const ExtUI::result_t rst) {
switch (rst) { switch (rst) {
case ExtUI::PID_STARTED: case ExtUI::PID_STARTED:
SetStatusMessagePGM(GET_TEXT(MSG_PID_AUTOTUNE)); SetStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE));
break; break;
case ExtUI::PID_BAD_EXTRUDER_NUM: case ExtUI::PID_BAD_EXTRUDER_NUM:
SetStatusMessagePGM(GET_TEXT(MSG_PID_BAD_EXTRUDER_NUM)); SetStatusMessage(GET_TEXT_F(MSG_PID_BAD_EXTRUDER_NUM));
break; break;
case ExtUI::PID_TEMP_TOO_HIGH: case ExtUI::PID_TEMP_TOO_HIGH:
SetStatusMessagePGM(GET_TEXT(MSG_PID_TEMP_TOO_HIGH)); SetStatusMessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH));
break; break;
case ExtUI::PID_TUNING_TIMEOUT: case ExtUI::PID_TUNING_TIMEOUT:
SetStatusMessagePGM(GET_TEXT(MSG_PID_TIMEOUT)); SetStatusMessage(GET_TEXT_F(MSG_PID_TIMEOUT));
break; break;
case ExtUI::PID_DONE: case ExtUI::PID_DONE:
SetStatusMessagePGM(GET_TEXT(MSG_PID_AUTOTUNE_DONE)); SetStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE));
break; break;
default: default:
return; return;
@ -411,8 +408,8 @@ void DGUSScreenHandler::SetStatusMessage(const char* msg, const millis_t duratio
status_expire = (duration > 0 ? ExtUI::safe_millis() + duration : 0); status_expire = (duration > 0 ? ExtUI::safe_millis() + duration : 0);
} }
void DGUSScreenHandler::SetStatusMessagePGM(PGM_P msg, const millis_t duration) { void DGUSScreenHandler::SetStatusMessage(FSTR_P const fmsg, const millis_t duration) {
dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Status, msg, DGUS_STATUS_LEN, false, true); dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Status, FTOP(msg), DGUS_STATUS_LEN, false, true);
status_expire = (duration > 0 ? ExtUI::safe_millis() + duration : 0); status_expire = (duration > 0 ? ExtUI::safe_millis() + duration : 0);
} }

View File

@ -73,7 +73,7 @@ public:
static void SetMessageLinePGM(PGM_P msg, uint8_t line); static void SetMessageLinePGM(PGM_P msg, uint8_t line);
static void SetStatusMessage(const char* msg, const millis_t duration = DGUS_STATUS_EXPIRATION_MS); static void SetStatusMessage(const char* msg, const millis_t duration = DGUS_STATUS_EXPIRATION_MS);
static void SetStatusMessagePGM(PGM_P msg, const millis_t duration = DGUS_STATUS_EXPIRATION_MS); static void SetStatusMessage(FSTR_P const msg, const millis_t duration = DGUS_STATUS_EXPIRATION_MS);
static void ShowWaitScreen(DGUS_Screen return_screen, bool has_continue = false); static void ShowWaitScreen(DGUS_Screen return_screen, bool has_continue = false);

View File

@ -68,7 +68,7 @@ bool DGUSSetupHandler::LevelingMenu() {
ExtUI::setLevelingActive(dgus_screen_handler.leveling_active); ExtUI::setLevelingActive(dgus_screen_handler.leveling_active);
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return false; return false;
} }
@ -99,7 +99,7 @@ bool DGUSSetupHandler::LevelingManual() {
} }
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return false; return false;
} }
@ -118,7 +118,7 @@ bool DGUSSetupHandler::LevelingOffset() {
dgus_screen_handler.offset_steps = DGUS_Data::StepSize::MMP1; dgus_screen_handler.offset_steps = DGUS_Data::StepSize::MMP1;
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return false; return false;
} }
@ -175,7 +175,7 @@ bool DGUSSetupHandler::Move() {
dgus_screen_handler.move_steps = DGUS_Data::StepSize::MM10; dgus_screen_handler.move_steps = DGUS_Data::StepSize::MM10;
if (!dgus_screen_handler.IsPrinterIdle()) { if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_BUSY); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
return false; return false;
} }
@ -186,7 +186,7 @@ bool DGUSSetupHandler::Gcode() {
ZERO(dgus_screen_handler.gcode); ZERO(dgus_screen_handler.gcode);
if (dgus_display.gui_version < 0x30 || dgus_display.os_version < 0x21) { if (dgus_display.gui_version < 0x30 || dgus_display.os_version < 0x21) {
dgus_screen_handler.SetStatusMessagePGM(DGUS_MSG_FW_OUTDATED); dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_FW_OUTDATED));
return false; return false;
} }

View File

@ -52,7 +52,7 @@ bool StatusScreen::jog_xy;
bool StatusScreen::fine_motion; bool StatusScreen::fine_motion;
void StatusScreen::unlockMotors() { void StatusScreen::unlockMotors() {
injectCommands_P(PSTR("M84 XY")); injectCommands(F("M84 XY"));
jog_xy = false; jog_xy = false;
} }
@ -305,7 +305,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
case 12: case 12:
if (!jog_xy) { if (!jog_xy) {
jog_xy = true; jog_xy = true;
injectCommands_P(PSTR("M17")); injectCommands(F("M17"));
} }
jog({ 0, 0, 0 }); jog({ 0, 0, 0 });
break; break;

View File

@ -81,7 +81,7 @@ bool LevelingMenu::onTouchEnd(uint8_t tag) {
case 2: BedMeshViewScreen::doProbe(); break; case 2: BedMeshViewScreen::doProbe(); break;
case 3: BedMeshViewScreen::show(); break; case 3: BedMeshViewScreen::show(); break;
case 4: BedMeshEditScreen::show(); break; case 4: BedMeshEditScreen::show(); break;
case 5: injectCommands_P(PSTR("M280 P0 S60")); break; case 5: injectCommands(F("M280 P0 S60")); break;
case 6: SpinnerDialogBox::enqueueAndWait(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break; case 6: SpinnerDialogBox::enqueueAndWait(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break;
default: return false; default: return false;
} }

View File

@ -86,7 +86,7 @@ bool MainMenu::onTouchEnd(uint8_t tag) {
case 6: GOTO_SCREEN(FeedratePercentScreen); break; case 6: GOTO_SCREEN(FeedratePercentScreen); break;
case 7: GOTO_SCREEN(FlowPercentScreen); break; case 7: GOTO_SCREEN(FlowPercentScreen); break;
case 8: GOTO_SCREEN(AdvancedSettingsMenu); break; case 8: GOTO_SCREEN(AdvancedSettingsMenu); break;
case 9: injectCommands_P(PSTR("M84")); break; case 9: injectCommands(F("M84")); break;
#if HAS_LEVELING #if HAS_LEVELING
case 10: GOTO_SCREEN(LevelingMenu); break; case 10: GOTO_SCREEN(LevelingMenu); break;
#endif #endif

View File

@ -74,37 +74,37 @@ bool PreheatMenu::onTouchEnd(uint8_t tag) {
case 1: GOTO_PREVIOUS(); break; case 1: GOTO_PREVIOUS(); break;
case 2: case 2:
#ifdef COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_INT_SCRIPT #ifdef COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_INT_SCRIPT
injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_INT_SCRIPT)); injectCommands(F(COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_INT_SCRIPT));
#endif #endif
GOTO_SCREEN(PreheatTimerScreen); GOTO_SCREEN(PreheatTimerScreen);
break; break;
case 3: case 3:
#ifdef COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_INT_SCRIPT #ifdef COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_INT_SCRIPT
injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_INT_SCRIPT)); injectCommands(F(COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_INT_SCRIPT));
#endif #endif
GOTO_SCREEN(PreheatTimerScreen); GOTO_SCREEN(PreheatTimerScreen);
break; break;
case 4: case 4:
#ifdef COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_INT_SCRIPT #ifdef COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_INT_SCRIPT
injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_INT_SCRIPT)); injectCommands(F(COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_INT_SCRIPT));
#endif #endif
GOTO_SCREEN(PreheatTimerScreen); GOTO_SCREEN(PreheatTimerScreen);
break; break;
case 5: case 5:
#ifdef COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_EXT_SCRIPT #ifdef COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_EXT_SCRIPT
injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_EXT_SCRIPT)); injectCommands(F(COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_EXT_SCRIPT));
#endif #endif
GOTO_SCREEN(PreheatTimerScreen); GOTO_SCREEN(PreheatTimerScreen);
break; break;
case 6: case 6:
#ifdef COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_EXT_SCRIPT #ifdef COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_EXT_SCRIPT
injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_EXT_SCRIPT)); injectCommands(F(COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_EXT_SCRIPT));
#endif #endif
GOTO_SCREEN(PreheatTimerScreen); GOTO_SCREEN(PreheatTimerScreen);
break; break;
case 7: case 7:
#ifdef COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_EXT_SCRIPT #ifdef COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_EXT_SCRIPT
injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_EXT_SCRIPT)); injectCommands(F(COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_EXT_SCRIPT));
#endif #endif
GOTO_SCREEN(PreheatTimerScreen); GOTO_SCREEN(PreheatTimerScreen);
break; break;

View File

@ -174,11 +174,11 @@ bool BedMeshEditScreen::onTouchEnd(uint8_t tag) {
case 1: case 1:
// On Cancel, reload saved mesh, discarding changes // On Cancel, reload saved mesh, discarding changes
GOTO_PREVIOUS(); GOTO_PREVIOUS();
injectCommands_P(PSTR("G29 L1")); injectCommands(F("G29 L1"));
return true; return true;
case 2: case 2:
saveAdjustedHighlightedValue(); saveAdjustedHighlightedValue();
injectCommands_P(PSTR("G29 S1")); injectCommands(F("G29 S1"));
mydata.needSave = false; mydata.needSave = false;
return true; return true;
case 3: case 3:

View File

@ -154,11 +154,11 @@ void BedMeshViewScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI
void BedMeshViewScreen::doProbe() { void BedMeshViewScreen::doProbe() {
GOTO_SCREEN(BedMeshViewScreen); GOTO_SCREEN(BedMeshViewScreen);
mydata.count = 0; mydata.count = 0;
injectCommands_P(PSTR(BED_LEVELING_COMMANDS)); injectCommands(F(BED_LEVELING_COMMANDS));
} }
void BedMeshViewScreen::show() { void BedMeshViewScreen::show() {
injectCommands_P(PSTR("G29 L1")); injectCommands(F("G29 L1"));
GOTO_SCREEN(BedMeshViewScreen); GOTO_SCREEN(BedMeshViewScreen);
} }

View File

@ -37,7 +37,7 @@ bool ConfirmAutoCalibrationDialogBox::onTouchEnd(uint8_t tag) {
switch (tag) { switch (tag) {
case 1: case 1:
GOTO_SCREEN(StatusScreen); GOTO_SCREEN(StatusScreen);
injectCommands_P(PSTR("G425")); injectCommands(F("G425"));
return true; return true;
default: default:
return DialogBoxBaseClass::onTouchEnd(tag); return DialogBoxBaseClass::onTouchEnd(tag);

View File

@ -33,7 +33,7 @@ using namespace Theme;
#define _USER_DESC(N) MAIN_MENU_ITEM_##N##_DESC #define _USER_DESC(N) MAIN_MENU_ITEM_##N##_DESC
#define _USER_GCODE(N) MAIN_MENU_ITEM_##N##_GCODE #define _USER_GCODE(N) MAIN_MENU_ITEM_##N##_GCODE
#define _USER_ITEM(N) .tag(_ITEM_TAG(N)).button(USER_ITEM_POS(N), _USER_DESC(N)) #define _USER_ITEM(N) .tag(_ITEM_TAG(N)).button(USER_ITEM_POS(N), _USER_DESC(N))
#define _USER_ACTION(N) case _ITEM_TAG(N): injectCommands_P(PSTR(_USER_GCODE(N))); TERN_(USER_SCRIPT_RETURN, GOTO_SCREEN(StatusScreen)); break; #define _USER_ACTION(N) case _ITEM_TAG(N): injectCommands(F(_USER_GCODE(N))); TERN_(USER_SCRIPT_RETURN, GOTO_SCREEN(StatusScreen)); break;
void CustomUserMenus::onRedraw(draw_mode_t what) { void CustomUserMenus::onRedraw(draw_mode_t what) {
if (what & BACKGROUND) { if (what & BACKGROUND) {

View File

@ -125,11 +125,11 @@ bool LevelingMenu::onTouchEnd(uint8_t tag) {
#if ENABLED(G26_MESH_VALIDATION) #if ENABLED(G26_MESH_VALIDATION)
case 6: case 6:
GOTO_SCREEN(StatusScreen); GOTO_SCREEN(StatusScreen);
injectCommands_P(PSTR("G28\nM117 Heating...\nG26 R X0 Y0\nG27")); injectCommands(F("G28\nM117 Heating...\nG26 R X0 Y0\nG27"));
break; break;
#endif #endif
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
case 7: injectCommands_P(PSTR("M280 P0 S60")); break; case 7: injectCommands(F("M280 P0 S60")); break;
case 8: SpinnerDialogBox::enqueueAndWait(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break; case 8: SpinnerDialogBox::enqueueAndWait(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break;
#endif #endif
default: return false; default: return false;

View File

@ -106,10 +106,10 @@ bool MainMenu::onTouchEnd(uint8_t tag) {
case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
case 2: SpinnerDialogBox::enqueueAndWait(F("G28")); break; case 2: SpinnerDialogBox::enqueueAndWait(F("G28")); break;
#if ENABLED(NOZZLE_CLEAN_FEATURE) #if ENABLED(NOZZLE_CLEAN_FEATURE)
case 3: injectCommands_P(PSTR("G12")); GOTO_SCREEN(StatusScreen); break; case 3: injectCommands(F("G12")); GOTO_SCREEN(StatusScreen); break;
#endif #endif
case 4: GOTO_SCREEN(MoveAxisScreen); break; case 4: GOTO_SCREEN(MoveAxisScreen); break;
case 5: injectCommands_P(PSTR("M84")); break; case 5: injectCommands(F("M84")); break;
case 6: GOTO_SCREEN(TemperatureScreen); break; case 6: GOTO_SCREEN(TemperatureScreen); break;
case 7: GOTO_SCREEN(ChangeFilamentScreen); break; case 7: GOTO_SCREEN(ChangeFilamentScreen); break;
case 8: GOTO_SCREEN(AdvancedSettingsMenu); break; case 8: GOTO_SCREEN(AdvancedSettingsMenu); break;

View File

@ -35,7 +35,7 @@ void RestoreFailsafeDialogBox::onRedraw(draw_mode_t) {
bool RestoreFailsafeDialogBox::onTouchEnd(uint8_t tag) { bool RestoreFailsafeDialogBox::onTouchEnd(uint8_t tag) {
switch (tag) { switch (tag) {
case 1: case 1:
ExtUI::injectCommands_P(PSTR("M502")); ExtUI::injectCommands(F("M502"));
AlertDialogBox::show(GET_TEXT_F(MSG_EEPROM_RESET)); AlertDialogBox::show(GET_TEXT_F(MSG_EEPROM_RESET));
// Remove RestoreFailsafeDialogBox from the stack // Remove RestoreFailsafeDialogBox from the stack
// so the alert box doesn't return to it. // so the alert box doesn't return to it.

View File

@ -38,7 +38,7 @@ bool SaveSettingsDialogBox::onTouchEnd(uint8_t tag) {
needs_save = false; needs_save = false;
switch (tag) { switch (tag) {
case 1: case 1:
injectCommands_P(PSTR("M500")); injectCommands(F("M500"));
AlertDialogBox::show(GET_TEXT_F(MSG_EEPROM_SAVED)); AlertDialogBox::show(GET_TEXT_F(MSG_EEPROM_SAVED));
// Remove SaveSettingsDialogBox from the stack // Remove SaveSettingsDialogBox from the stack
// so the alert box doesn't return to me. // so the alert box doesn't return to me.

View File

@ -60,7 +60,7 @@ void SpinnerDialogBox::onRefresh() {
void SpinnerDialogBox::onRedraw(draw_mode_t) { void SpinnerDialogBox::onRedraw(draw_mode_t) {
} }
void SpinnerDialogBox::show(FSTR_P message) { void SpinnerDialogBox::show(FSTR_P fstr) {
CommandProcessor cmd; CommandProcessor cmd;
if (AT_SCREEN(SpinnerDialogBox)) cmd.stop().execute(); if (AT_SCREEN(SpinnerDialogBox)) cmd.stop().execute();
cmd.cmd(CMD_DLSTART) cmd.cmd(CMD_DLSTART)
@ -68,7 +68,7 @@ void SpinnerDialogBox::show(FSTR_P message) {
.cmd(CLEAR(true,true,true)) .cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled)) .cmd(COLOR_RGB(bg_text_enabled))
.tag(0); .tag(0);
draw_text_box(cmd, BTN_POS(1,1), BTN_SIZE(2,3), message, OPT_CENTER, font_large); draw_text_box(cmd, BTN_POS(1,1), BTN_SIZE(2,3), fstr, OPT_CENTER, font_large);
DLCache dlcache(SPINNER_CACHE); DLCache dlcache(SPINNER_CACHE);
if (!dlcache.store(SPINNER_DL_SIZE)) { if (!dlcache.store(SPINNER_DL_SIZE)) {
SERIAL_ECHO_MSG("CachedScreen::storeBackground() failed: not enough DL cache space"); SERIAL_ECHO_MSG("CachedScreen::storeBackground() failed: not enough DL cache space");
@ -86,14 +86,14 @@ void SpinnerDialogBox::hide() {
GOTO_PREVIOUS(); GOTO_PREVIOUS();
} }
void SpinnerDialogBox::enqueueAndWait(FSTR_P message, FSTR_P commands) { void SpinnerDialogBox::enqueueAndWait(FSTR_P fstr, FSTR_P commands) {
show(message); show(fstr);
ExtUI::injectCommands_P((const char*)commands); ExtUI::injectCommands(commands);
mydata.auto_hide = true; mydata.auto_hide = true;
} }
void SpinnerDialogBox::enqueueAndWait(FSTR_P message, char *commands) { void SpinnerDialogBox::enqueueAndWait(FSTR_P fstr, char *commands) {
show(message); show(fstr);
ExtUI::injectCommands(commands); ExtUI::injectCommands(commands);
mydata.auto_hide = true; mydata.auto_hide = true;
} }

View File

@ -84,7 +84,7 @@ void StressTestScreen::runTestOnBootup(bool enable) {
// whether or not we need to re-run the test // whether or not we need to re-run the test
// at startup. // at startup.
LockScreen::set_hash(enable ? 0xDEAD : 0); LockScreen::set_hash(enable ? 0xDEAD : 0);
injectCommands_P(PSTR("M500")); injectCommands(F("M500"));
} }
void StressTestScreen::startupCheck() { void StressTestScreen::startupCheck() {
@ -122,7 +122,7 @@ void StressTestScreen::onIdle() {
injectCommands_P(G28_STR); injectCommands_P(G28_STR);
} }
else { else {
injectCommands_P(PSTR( injectCommands(F(
"G0 X100 Y100 Z100 F6000\n" "G0 X100 Y100 Z100 F6000\n"
"T0\nG4 S1" "T0\nG4 S1"
E_TERN_("\nT1\nG4 S1") E_TERN_("\nT1\nG4 S1")

View File

@ -83,46 +83,46 @@ void FileNavigator::getFiles(uint16_t index) {
#endif #endif
if (currentindex == 0 && folderdepth > 0) { // Add a link to go up a folder if (currentindex == 0 && folderdepth > 0) { // Add a link to go up a folder
nextion.SendtoTFT(PSTR("vis p0,1")); nextion.SendtoTFT(F("vis p0,1"));
nextion.SendtoTFT(PSTR("\xFF\xFF\xFF")); nextion.SendtoTFT(F("\xFF\xFF\xFF"));
SEND_VAL("tmpUP", "0"); SEND_VAL("tmpUP", "0");
files--; files--;
} }
else { else {
nextion.SendtoTFT(PSTR("vis p0,0")); nextion.SendtoTFT(F("vis p0,0"));
nextion.SendtoTFT(PSTR("\xFF\xFF\xFF")); nextion.SendtoTFT(F("\xFF\xFF\xFF"));
} }
for (uint16_t seek = currentindex; seek < currentindex + files; seek++) { for (uint16_t seek = currentindex; seek < currentindex + files; seek++) {
if (filelist.seek(seek)) { if (filelist.seek(seek)) {
nextion.SendtoTFT(PSTR("s")); nextion.SendtoTFT(F("s"));
LCD_SERIAL.print(fcnt); LCD_SERIAL.print(fcnt);
nextion.SendtoTFT(PSTR(".txt=\"")); nextion.SendtoTFT(F(".txt=\""));
if (filelist.isDir()) { if (filelist.isDir()) {
LCD_SERIAL.print(filelist.shortFilename()); LCD_SERIAL.print(filelist.shortFilename());
nextion.SendtoTFT(PSTR("/\"")); nextion.SendtoTFT(F("/\""));
nextion.SendtoTFT(PSTR("\xFF\xFF\xFF")); nextion.SendtoTFT(F("\xFF\xFF\xFF"));
nextion.SendtoTFT(PSTR("l")); nextion.SendtoTFT(F("l"));
LCD_SERIAL.print(fcnt); LCD_SERIAL.print(fcnt);
nextion.SendtoTFT(PSTR(".txt=\"")); nextion.SendtoTFT(F(".txt=\""));
LCD_SERIAL.print(filelist.filename()); LCD_SERIAL.print(filelist.filename());
nextion.SendtoTFT(PSTR("\"")); nextion.SendtoTFT(F("\""));
nextion.SendtoTFT(PSTR("\xFF\xFF\xFF")); nextion.SendtoTFT(F("\xFF\xFF\xFF"));
SEND_PCO2("l", fcnt, "1055"); SEND_PCO2("l", fcnt, "1055");
} }
else { else {
LCD_SERIAL.print(currentfoldername); LCD_SERIAL.print(currentfoldername);
LCD_SERIAL.print(filelist.shortFilename()); LCD_SERIAL.print(filelist.shortFilename());
nextion.SendtoTFT(PSTR("\"")); nextion.SendtoTFT(F("\""));
nextion.SendtoTFT(PSTR("\xFF\xFF\xFF")); nextion.SendtoTFT(F("\xFF\xFF\xFF"));
nextion.SendtoTFT(PSTR("l")); nextion.SendtoTFT(F("l"));
LCD_SERIAL.print(fcnt); LCD_SERIAL.print(fcnt);
nextion.SendtoTFT(PSTR(".txt=\"")); nextion.SendtoTFT(F(".txt=\""));
LCD_SERIAL.print(filelist.longFilename()); LCD_SERIAL.print(filelist.longFilename());
nextion.SendtoTFT(PSTR("\"")); nextion.SendtoTFT(F("\""));
nextion.SendtoTFT(PSTR("\xFF\xFF\xFF")); nextion.SendtoTFT(F("\xFF\xFF\xFF"));
} }
fcnt++; fcnt++;
fseek = seek; fseek = seek;

View File

@ -110,12 +110,12 @@ void NextionTFT::StatusChange(const char * const msg) {
SEND_VALasTXT("tmppage.M117", msg); SEND_VALasTXT("tmppage.M117", msg);
} }
void NextionTFT::SendtoTFT(PGM_P str) { // A helper to print PROGMEM string to the panel void NextionTFT::SendtoTFT(FSTR_P fstr) { // A helper to print PROGMEM string to the panel
#if NEXDEBUG(N_SOME) #if NEXDEBUG(N_SOME)
DEBUG_ECHOPGM_P(str); DEBUG_ECHOF(fstr);
#endif #endif
while (const char c = pgm_read_byte(str++)) PGM_P str = FTOP(fstr);
LCD_SERIAL.write(c); while (const char c = pgm_read_byte(str++)) LCD_SERIAL.write(c);
} }
bool NextionTFT::ReadTFTCommand() { bool NextionTFT::ReadTFTCommand() {
@ -522,7 +522,7 @@ void NextionTFT::PanelAction(uint8_t req) {
case 66: // Refresh SD case 66: // Refresh SD
if (!isPrinting()) { if (!isPrinting()) {
injectCommands_P(PSTR("M21")); injectCommands(F("M21"));
filenavigator.reset(); filenavigator.reset();
} }
break; break;
@ -546,8 +546,8 @@ void NextionTFT::PanelAction(uint8_t req) {
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
if (canMove(getActiveTool())) { if (canMove(getActiveTool())) {
switch (nextion_command[4]) { switch (nextion_command[4]) {
case 'L': injectCommands_P(PSTR("M701")); break; case 'L': injectCommands(F("M701")); break;
case 'U': injectCommands_P(PSTR("M702")); break; case 'U': injectCommands(F("M702")); break;
} }
} }
else { else {

View File

@ -43,9 +43,9 @@ class NextionTFT {
static void Startup(); static void Startup();
static void IdleLoop(); static void IdleLoop();
static void PrinterKilled(PGM_P, PGM_P); static void PrinterKilled(PGM_P, PGM_P);
static void ConfirmationRequest(const char * const ); static void ConfirmationRequest(const char * const);
static void StatusChange(const char * const ); static void StatusChange(const char * const);
static void SendtoTFT(PGM_P); static void SendtoTFT(FSTR_P const);
static void UpdateOnChange(); static void UpdateOnChange();
static void PrintFinished(); static void PrintFinished();
static void PanelInfo(uint8_t); static void PanelInfo(uint8_t);

View File

@ -54,10 +54,10 @@
// TFT panel commands // TFT panel commands
#define msg_welcome MACHINE_NAME " Ready." #define msg_welcome MACHINE_NAME " Ready."
#define SEND_TEMP(x,y,t,z) (nextion.SendtoTFT(PSTR(x)), nextion.SendtoTFT(PSTR(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(PSTR(t)), LCD_SERIAL.print(z), nextion.SendtoTFT(PSTR("\"\xFF\xFF\xFF"))) #define SEND_TEMP(x,y,t,z) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(F(t)), LCD_SERIAL.print(z), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
#define SEND_VAL(x,y) (nextion.SendtoTFT(PSTR(x)), nextion.SendtoTFT(PSTR(".val=")), LCD_SERIAL.print(y), nextion.SendtoTFT(PSTR("\xFF\xFF\xFF"))) #define SEND_VAL(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".val=")), LCD_SERIAL.print(y), nextion.SendtoTFT(F("\xFF\xFF\xFF")))
#define SEND_TXT(x,y) (nextion.SendtoTFT(PSTR(x)), nextion.SendtoTFT(PSTR(".txt=\"")), nextion.SendtoTFT(PSTR(y)), nextion.SendtoTFT(PSTR("\"\xFF\xFF\xFF"))) #define SEND_TXT(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(F(y)), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
#define SEND_TXT_P(x,y) (nextion.SendtoTFT(PSTR(x)), nextion.SendtoTFT(PSTR(".txt=\"")), nextion.SendtoTFT(y), nextion.SendtoTFT(PSTR("\"\xFF\xFF\xFF"))) #define SEND_TXT_P(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(y), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
#define SEND_VALasTXT(x,y) (nextion.SendtoTFT(PSTR(x)), nextion.SendtoTFT(PSTR(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(PSTR("\"\xFF\xFF\xFF"))) #define SEND_VALasTXT(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
#define SEND_TXT_END(x) (nextion.SendtoTFT(PSTR(x)), nextion.SendtoTFT(PSTR("\xFF\xFF\xFF"))) #define SEND_TXT_END(x) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F("\xFF\xFF\xFF")))
#define SEND_PCO2(x,y,z) (nextion.SendtoTFT(PSTR(x)), LCD_SERIAL.print(y), nextion.SendtoTFT(PSTR(".pco=")), nextion.SendtoTFT(PSTR(z)), nextion.SendtoTFT(PSTR("\xFF\xFF\xFF"))) #define SEND_PCO2(x,y,z) (nextion.SendtoTFT(F(x)), LCD_SERIAL.print(y), nextion.SendtoTFT(F(".pco=")), nextion.SendtoTFT(F(z)), nextion.SendtoTFT(F("\xFF\xFF\xFF")))

View File

@ -1077,15 +1077,15 @@ namespace ExtUI {
void resumePrint() { ui.resume_print(); } void resumePrint() { ui.resume_print(); }
void stopPrint() { ui.abort_print(); } void stopPrint() { ui.abort_print(); }
void onUserConfirmRequired_P(PGM_P const pstr) { void onUserConfirmRequired(FSTR_P const fstr) {
char msg[strlen_P(pstr) + 1]; char msg[strlen_P(FTOP(fstr)) + 1];
strcpy_P(msg, pstr); strcpy_P(msg, FTOP(fstr));
onUserConfirmRequired(msg); onUserConfirmRequired(msg);
} }
void onStatusChanged_P(PGM_P const pstr) { void onStatusChanged(FSTR_P const fstr) {
char msg[strlen_P(pstr) + 1]; char msg[strlen_P(FTOP(fstr)) + 1];
strcpy_P(msg, pstr); strcpy_P(msg, FTOP(fstr));
onStatusChanged(msg); onStatusChanged(msg);
} }

View File

@ -79,6 +79,7 @@ namespace ExtUI {
bool canMove(const axis_t); bool canMove(const axis_t);
bool canMove(const extruder_t); bool canMove(const extruder_t);
void injectCommands_P(PGM_P const); void injectCommands_P(PGM_P const);
inline void injectCommands(FSTR_P const fstr) { injectCommands_P(FTOP(fstr)); }
void injectCommands(char * const); void injectCommands(char * const);
bool commandsInQueue(); bool commandsInQueue();
@ -400,9 +401,9 @@ namespace ExtUI {
void onPrintFinished(); void onPrintFinished();
void onFilamentRunout(const extruder_t extruder); void onFilamentRunout(const extruder_t extruder);
void onUserConfirmRequired(const char * const msg); void onUserConfirmRequired(const char * const msg);
void onUserConfirmRequired_P(PGM_P const pstr); void onUserConfirmRequired(FSTR_P const fstr);
void onStatusChanged(const char * const msg); void onStatusChanged(const char * const msg);
void onStatusChanged_P(PGM_P const pstr); void onStatusChanged(FSTR_P const fstr);
void onHomingStart(); void onHomingStart();
void onHomingComplete(); void onHomingComplete();
void onSteppersDisabled(); void onSteppersDisabled();

View File

@ -1741,18 +1741,18 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
pause_mode = mode; pause_mode = mode;
ExtUI::pauseModeStatus = message; ExtUI::pauseModeStatus = message;
switch (message) { switch (message) {
case PAUSE_MESSAGE_PARKING: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PAUSE_PRINT_PARKING)); break; case PAUSE_MESSAGE_PARKING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break;
case PAUSE_MESSAGE_CHANGING: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_INIT)); break; case PAUSE_MESSAGE_CHANGING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break;
case PAUSE_MESSAGE_UNLOAD: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_UNLOAD)); break; case PAUSE_MESSAGE_UNLOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break;
case PAUSE_MESSAGE_WAITING: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_ADVANCED_PAUSE_WAITING)); break; case PAUSE_MESSAGE_WAITING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING)); break;
case PAUSE_MESSAGE_INSERT: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_INSERT)); break; case PAUSE_MESSAGE_INSERT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break;
case PAUSE_MESSAGE_LOAD: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_LOAD)); break; case PAUSE_MESSAGE_LOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break;
case PAUSE_MESSAGE_PURGE: case PAUSE_MESSAGE_PURGE:
ExtUI::onUserConfirmRequired_P(GET_TEXT(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE))); break; ExtUI::onUserConfirmRequired(GET_TEXT_F(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE))); break;
case PAUSE_MESSAGE_RESUME: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_RESUME)); break; case PAUSE_MESSAGE_RESUME: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break;
case PAUSE_MESSAGE_HEAT: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEAT)); break; case PAUSE_MESSAGE_HEAT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT)); break;
case PAUSE_MESSAGE_HEATING: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEATING)); break; case PAUSE_MESSAGE_HEATING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break;
case PAUSE_MESSAGE_OPTION: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_OPTION_HEADER)); break; case PAUSE_MESSAGE_OPTION: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_OPTION_HEADER)); break;
case PAUSE_MESSAGE_STATUS: case PAUSE_MESSAGE_STATUS:
default: break; default: break;
} }

View File

@ -65,7 +65,7 @@ void _man_probe_pt(const xy_pos_t &xy) {
_man_probe_pt(xy); _man_probe_pt(xy);
ui.defer_status_screen(); ui.defer_status_screen();
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("Delta Calibration in progress"), FPSTR(CONTINUE_STR))); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("Delta Calibration in progress"), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Delta Calibration in progress"))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Delta Calibration in progress")));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response()); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
ui.goto_previous_screen_no_defer(); ui.goto_previous_screen_no_defer();
return current_position.z; return current_position.z;

View File

@ -296,7 +296,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
SERIAL_ECHOLNF(ds_str); SERIAL_ECHOLNF(ds_str);
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("Stow Probe"), FPSTR(CONTINUE_STR))); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("Stow Probe"), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Stow Probe"))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Stow Probe")));
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, PSTR("Stow Probe"), CONTINUE_STR)); TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, PSTR("Stow Probe"), CONTINUE_STR));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response()); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
ui.reset_status(); ui.reset_status();