diff --git a/Marlin/src/gcode/calibrate/G76_M192_M871.cpp b/Marlin/src/gcode/calibrate/G76_M192_M871.cpp index dbe2339f45..7438b0e83d 100644 --- a/Marlin/src/gcode/calibrate/G76_M192_M871.cpp +++ b/Marlin/src/gcode/calibrate/G76_M192_M871.cpp @@ -38,7 +38,7 @@ #include "../../feature/probe_temp_comp.h" #include "../../lcd/marlinui.h" -#include "../../MarlinCore.h" // for wait_for_heatup and idle() +#include "../../MarlinCore.h" // for wait_for_heatup, idle(), G28_STR #if ENABLED(PRINTJOB_TIMER_AUTOSTART) #include "../../module/printcounter.h" @@ -168,7 +168,7 @@ void GcodeSuite::G76() { return; } - process_subcommands_now_P(PSTR("G28")); + process_subcommands_now_P(G28_STR); } remember_feedrate_scaling_off(); diff --git a/Marlin/src/lcd/dwin/e3v2/dwin.cpp b/Marlin/src/lcd/dwin/e3v2/dwin.cpp index 3126c46fb8..e1655d0ed9 100644 --- a/Marlin/src/lcd/dwin/e3v2/dwin.cpp +++ b/Marlin/src/lcd/dwin/e3v2/dwin.cpp @@ -2332,7 +2332,7 @@ void HMI_Prepare() { case PREPARE_CASE_HOME: // Homing checkkey = Last_Prepare; index_prepare = MROWS; - queue.inject_P(PSTR("G28")); // G28 will set home_flag + queue.inject_P(G28_STR); // G28 will set home_flag Popup_Window_Home(); break; #if HAS_ZOFFSET_ITEM diff --git a/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp b/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp index 2c3217b224..b0053895a7 100644 --- a/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp @@ -620,10 +620,10 @@ namespace Anycubic { case 21: // A21 Home Axis A21 X if (!isPrinting()) { switch ((char)panel_command[4]) { - case 'X': injectCommands_P(PSTR("G28 X")); break; - case 'Y': injectCommands_P(PSTR("G28 Y")); break; - case 'Z': injectCommands_P(PSTR("G28 Z")); break; - case 'C': injectCommands_P(PSTR("G28")); break; + case 'X': injectCommands_P(PSTR("G28X")); break; + case 'Y': injectCommands_P(PSTR("G28Y")); break; + case 'Z': injectCommands_P(PSTR("G28Z")); break; + case 'C': injectCommands_P(G28_STR); break; } } break; @@ -718,7 +718,7 @@ namespace Anycubic { // If the same meshpoint is selected twice in a row, move the head to that ready for adjustment if ((selectedmeshpoint.x == pos.x) && (selectedmeshpoint.y == pos.y)) { if (!isPositionKnown()) - injectCommands_P(PSTR("G28")); // home + injectCommands_P(G28_STR); // home if (isPositionKnown()) { #if ACDEBUG(AC_INFO) @@ -746,7 +746,7 @@ namespace Anycubic { if (isPrinting()) SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling else { - injectCommands_P(isMachineHomed() ? PSTR("G29") : PSTR("G28\nG29")); + injectCommands_P(PSTR("G28O\nG29")); printer_state = AC_printer_probing; SendtoTFTLN(AC_msg_start_probing); } diff --git a/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft_defs.h b/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft_defs.h index 408c0d7484..7012e98d92 100644 --- a/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft_defs.h +++ b/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft_defs.h @@ -105,8 +105,8 @@ #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_unload_filament PSTR("M83\nG1 E-50 F1200\nM82") -#define AC_cmnd_enable_leveling PSTR("M420 S1 V1") -#define AC_cmnd_power_loss_recovery PSTR("G28 X Y R5\nG28 Z") // Lift, home X and Y then home Z when in 'safe' position +#define AC_cmnd_enable_leveling PSTR("M420SV") +#define AC_cmnd_power_loss_recovery PSTR("G28XYR5\nG28Z") // Lift, home X and Y then home Z when in 'safe' position namespace Anycubic { enum heater_state_t : uint8_t { diff --git a/Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp b/Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp index 72e5f1d14d..9c1fb90635 100644 --- a/Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -28,7 +28,7 @@ #include "../../../../libs/numtostr.h" #include "../../../../module/motion.h" // for A20 read printing speed feedrate_percentage -#include "../../../../MarlinCore.h" // for quickstop_stepper and disable_steppers +#include "../../../../MarlinCore.h" // for quickstop_stepper, disable_steppers, G28_STR #include "../../../../inc/MarlinConfig.h" // command sending macro's with debugging capability @@ -274,12 +274,12 @@ void AnycubicTFTClass::HandleSpecialMenu() { case '6': // "<06SMeshLvl>" SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling"); - ExtUI::injectCommands_P(PSTR("G29 S1")); + ExtUI::injectCommands_P(PSTR("G29S1")); break; case '7': // "<07MeshNPnt>" SERIAL_ECHOLNPGM("Special Menu: Next Mesh Point"); - ExtUI::injectCommands_P(PSTR("G29 S2")); + ExtUI::injectCommands_P(PSTR("G29S2")); break; case '8': // "<08HtEndPID>" @@ -758,14 +758,14 @@ void AnycubicTFTClass::GetCommandFromTFT() { if (!ExtUI::isPrinting() && !ExtUI::isPrintingFromMediaPaused()) { if (CodeSeen('X') || CodeSeen('Y') || CodeSeen('Z')) { if (CodeSeen('X')) - ExtUI::injectCommands_P(PSTR("G28 X")); + ExtUI::injectCommands_P(PSTR("G28X")); if (CodeSeen('Y')) - ExtUI::injectCommands_P(PSTR("G28 Y")); + ExtUI::injectCommands_P(PSTR("G28Y")); if (CodeSeen('Z')) - ExtUI::injectCommands_P(PSTR("G28 Z")); + ExtUI::injectCommands_P(PSTR("G28Z")); } else if (CodeSeen('C')) { - ExtUI::injectCommands_P(PSTR("G28")); + ExtUI::injectCommands_P(G28_STR); } } break; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp index fc827e83e3..90d8d6251d 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp @@ -319,7 +319,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) { case 9: GOTO_SCREEN(FilesScreen); break; case 10: GOTO_SCREEN(MainMenu); break; case 13: GOTO_SCREEN(BioConfirmHomeE); break; - case 14: SpinnerDialogBox::enqueueAndWait_P(F("G28 Z")); break; + case 14: SpinnerDialogBox::enqueueAndWait_P(F("G28Z")); break; case 15: GOTO_SCREEN(TemperatureScreen); break; case 16: fine_motion = !fine_motion; break; default: return false; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp index 75c6093955..ba38918b1c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp @@ -94,9 +94,9 @@ bool BaseMoveAxisScreen::onTouchHeld(uint8_t tag) { case 14: UI_DECREMENT_AXIS(E3); screen_data.MoveAxis.e_rel[3] -= increment; break; case 15: UI_INCREMENT_AXIS(E3); screen_data.MoveAxis.e_rel[3] += increment; break; #endif - case 20: SpinnerDialogBox::enqueueAndWait_P(F("G28 X")); break; - case 21: SpinnerDialogBox::enqueueAndWait_P(F("G28 Y")); break; - case 22: SpinnerDialogBox::enqueueAndWait_P(F("G28 Z")); break; + case 20: SpinnerDialogBox::enqueueAndWait_P(F("G28X")); break; + case 21: SpinnerDialogBox::enqueueAndWait_P(F("G28Y")); break; + case 22: SpinnerDialogBox::enqueueAndWait_P(F("G28Z")); break; case 23: SpinnerDialogBox::enqueueAndWait_P(F("G28")); break; default: return false; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp index a737197fce..5b65f990c1 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp @@ -31,6 +31,8 @@ #include "../../../../gcode/queue.h" #include "../../../../inc/MarlinConfig.h" +extern const char G28_STR[]; + extern lv_group_t *g; static lv_obj_t *scr; @@ -48,22 +50,22 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; switch (obj->mks_obj_id) { case ID_H_ALL: - queue.inject_P(PSTR("G28")); + queue.inject_P(G28_STR); break; case ID_H_X: - queue.inject_P(PSTR("G28 X0")); + queue.inject_P(PSTR("G28X")); break; case ID_H_Y: - queue.inject_P(PSTR("G28 Y0")); + queue.inject_P(PSTR("G28Y")); break; case ID_H_Z: - queue.inject_P(PSTR("G28 Z0")); + queue.inject_P(PSTR("G28Z")); break; case ID_H_OFF_ALL: queue.inject_P(PSTR("M84")); break; case ID_H_OFF_XY: - queue.inject_P(PSTR("M84 X Y")); + queue.inject_P(PSTR("M84XY")); break; case ID_H_RETURN: clear_cur_ui(); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp index 51761da8f3..0b09ae391d 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp @@ -29,6 +29,8 @@ #include "../../../../gcode/queue.h" #include "../../../../inc/MarlinConfig.h" +extern const char G28_STR[]; + extern lv_group_t *g; static lv_obj_t *scr; @@ -45,65 +47,15 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; switch (obj->mks_obj_id) { - case ID_M_POINT1: - if (queue.length == 0) { - if (uiCfg.leveling_first_time) { - queue.enqueue_now_P(PSTR("G28")); - uiCfg.leveling_first_time = 0; - } - queue.enqueue_now_P(PSTR("G1 Z10")); - sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), (int)gCfgItems.levelingPos[0][0], (int)gCfgItems.levelingPos[0][1]); - queue.enqueue_one_now(public_buf_l); - queue.enqueue_now_P(PSTR("G1 Z0")); - } - break; - case ID_M_POINT2: - if (queue.length == 0) { - if (uiCfg.leveling_first_time) { - queue.enqueue_now_P(PSTR("G28")); - uiCfg.leveling_first_time = 0; - } - queue.enqueue_now_P(PSTR("G1 Z10")); - sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), (int)gCfgItems.levelingPos[1][0], (int)gCfgItems.levelingPos[1][1]); - queue.enqueue_one_now(public_buf_l); - queue.enqueue_now_P(PSTR("G1 Z0")); - } - break; - case ID_M_POINT3: - if (queue.length == 0) { - if (uiCfg.leveling_first_time) { - queue.enqueue_now_P(PSTR("G28")); - uiCfg.leveling_first_time = 0; - } - queue.enqueue_now_P(PSTR("G1 Z10")); - sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), (int)gCfgItems.levelingPos[2][0], (int)gCfgItems.levelingPos[2][1]); - queue.enqueue_one_now(public_buf_l); - queue.enqueue_now_P(PSTR("G1 Z0")); - } - - break; - case ID_M_POINT4: - if (queue.length == 0) { - if (uiCfg.leveling_first_time) { - queue.enqueue_now_P(PSTR("G28")); - uiCfg.leveling_first_time = 0; - } - queue.enqueue_now_P(PSTR("G1 Z10")); - sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), (int)gCfgItems.levelingPos[3][0], (int)gCfgItems.levelingPos[3][1]); - queue.enqueue_one_now(public_buf_l); - queue.enqueue_now_P(PSTR("G1 Z0")); - } - break; - case ID_M_POINT5: + case ID_M_POINT1 ... ID_M_POINT5: if (queue.length == 0) { if (uiCfg.leveling_first_time) { - queue.enqueue_now_P(PSTR("G28")); - uiCfg.leveling_first_time = 0; + uiCfg.leveling_first_time = false; + queue.inject_P(G28_STR); } - queue.enqueue_now_P(PSTR("G1 Z10")); - sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), (int)gCfgItems.levelingPos[4][0], (int)gCfgItems.levelingPos[4][1]); - queue.enqueue_one_now(public_buf_l); - queue.enqueue_now_P(PSTR("G1 Z0")); + const int ind = obj->mks_obj_id - ID_M_POINT1; + sprintf_P(public_buf_l, PSTR("G1 Z10\nG1 X%d Y%d\nG1 Z0"), (int)gCfgItems.levelingPos[ind][0], (int)gCfgItems.levelingPos[ind][1]); + queue.inject(public_buf_l); } break; case ID_MANUAL_RETURN: diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index 64dca3b04f..04c2152e61 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -103,9 +103,9 @@ ui.wait_for_move = true; ui.goto_screen(_lcd_level_bed_done); #if ENABLED(MESH_BED_LEVELING) - queue.inject_P(PSTR("G29 S2")); + queue.inject_P(PSTR("G29S2")); #elif ENABLED(PROBE_MANUALLY) - queue.inject_P(PSTR("G29 V1")); + queue.inject_P(PSTR("G29V1")); #endif } else @@ -155,9 +155,9 @@ // G29 Records Z, moves, and signals when it pauses ui.wait_for_move = true; #if ENABLED(MESH_BED_LEVELING) - queue.inject_P(manual_probe_index ? PSTR("G29 S2") : PSTR("G29 S1")); + queue.inject_P(manual_probe_index ? PSTR("G29S2") : PSTR("G29S1")); #elif ENABLED(PROBE_MANUALLY) - queue.inject_P(PSTR("G29 V1")); + queue.inject_P(PSTR("G29V1")); #endif } diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index f849d20eca..f997b56f38 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -402,7 +402,7 @@ void menu_motion() { #endif #if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) - GCODES_ITEM(MSG_M48_TEST, PSTR("G28 O\nM48 P10")); + GCODES_ITEM(MSG_M48_TEST, PSTR("G28O\nM48 P10")); #endif //