Optimize some G-code strings
This commit is contained in:
parent
e351ea2ee8
commit
aabd40a7a2
@ -38,7 +38,7 @@
|
|||||||
#include "../../feature/probe_temp_comp.h"
|
#include "../../feature/probe_temp_comp.h"
|
||||||
|
|
||||||
#include "../../lcd/marlinui.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)
|
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||||
#include "../../module/printcounter.h"
|
#include "../../module/printcounter.h"
|
||||||
@ -168,7 +168,7 @@ void GcodeSuite::G76() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
process_subcommands_now_P(PSTR("G28"));
|
process_subcommands_now_P(G28_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
remember_feedrate_scaling_off();
|
remember_feedrate_scaling_off();
|
||||||
|
@ -2332,7 +2332,7 @@ void HMI_Prepare() {
|
|||||||
case PREPARE_CASE_HOME: // Homing
|
case PREPARE_CASE_HOME: // Homing
|
||||||
checkkey = Last_Prepare;
|
checkkey = Last_Prepare;
|
||||||
index_prepare = MROWS;
|
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();
|
Popup_Window_Home();
|
||||||
break;
|
break;
|
||||||
#if HAS_ZOFFSET_ITEM
|
#if HAS_ZOFFSET_ITEM
|
||||||
|
@ -623,7 +623,7 @@ namespace Anycubic {
|
|||||||
case 'X': injectCommands_P(PSTR("G28X")); break;
|
case 'X': injectCommands_P(PSTR("G28X")); break;
|
||||||
case 'Y': injectCommands_P(PSTR("G28Y")); break;
|
case 'Y': injectCommands_P(PSTR("G28Y")); break;
|
||||||
case 'Z': injectCommands_P(PSTR("G28Z")); break;
|
case 'Z': injectCommands_P(PSTR("G28Z")); break;
|
||||||
case 'C': injectCommands_P(PSTR("G28")); break;
|
case 'C': injectCommands_P(G28_STR); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 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 ((selectedmeshpoint.x == pos.x) && (selectedmeshpoint.y == pos.y)) {
|
||||||
if (!isPositionKnown())
|
if (!isPositionKnown())
|
||||||
injectCommands_P(PSTR("G28")); // home
|
injectCommands_P(G28_STR); // home
|
||||||
|
|
||||||
if (isPositionKnown()) {
|
if (isPositionKnown()) {
|
||||||
#if ACDEBUG(AC_INFO)
|
#if ACDEBUG(AC_INFO)
|
||||||
@ -746,7 +746,7 @@ namespace Anycubic {
|
|||||||
if (isPrinting())
|
if (isPrinting())
|
||||||
SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling
|
SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling
|
||||||
else {
|
else {
|
||||||
injectCommands_P(isMachineHomed() ? PSTR("G29") : PSTR("G28\nG29"));
|
injectCommands_P(PSTR("G28O\nG29"));
|
||||||
printer_state = AC_printer_probing;
|
printer_state = AC_printer_probing;
|
||||||
SendtoTFTLN(AC_msg_start_probing);
|
SendtoTFTLN(AC_msg_start_probing);
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@
|
|||||||
|
|
||||||
#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 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_manual_unload_filament PSTR("M83\nG1 E-50 F1200\nM82")
|
||||||
#define AC_cmnd_enable_leveling PSTR("M420 S1 V1")
|
#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
|
#define AC_cmnd_power_loss_recovery PSTR("G28XYR5\nG28Z") // Lift, home X and Y then home Z when in 'safe' position
|
||||||
|
|
||||||
namespace Anycubic {
|
namespace Anycubic {
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "../../../../libs/numtostr.h"
|
#include "../../../../libs/numtostr.h"
|
||||||
#include "../../../../module/motion.h" // for A20 read printing speed feedrate_percentage
|
#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"
|
#include "../../../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
// command sending macro's with debugging capability
|
// command sending macro's with debugging capability
|
||||||
@ -765,7 +765,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
|
|||||||
ExtUI::injectCommands_P(PSTR("G28Z"));
|
ExtUI::injectCommands_P(PSTR("G28Z"));
|
||||||
}
|
}
|
||||||
else if (CodeSeen('C')) {
|
else if (CodeSeen('C')) {
|
||||||
ExtUI::injectCommands_P(PSTR("G28"));
|
ExtUI::injectCommands_P(G28_STR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
#include "../../../../gcode/queue.h"
|
#include "../../../../gcode/queue.h"
|
||||||
#include "../../../../inc/MarlinConfig.h"
|
#include "../../../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
|
extern const char G28_STR[];
|
||||||
|
|
||||||
extern lv_group_t *g;
|
extern lv_group_t *g;
|
||||||
static lv_obj_t *scr;
|
static lv_obj_t *scr;
|
||||||
|
|
||||||
@ -48,16 +50,16 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
|||||||
if (event != LV_EVENT_RELEASED) return;
|
if (event != LV_EVENT_RELEASED) return;
|
||||||
switch (obj->mks_obj_id) {
|
switch (obj->mks_obj_id) {
|
||||||
case ID_H_ALL:
|
case ID_H_ALL:
|
||||||
queue.inject_P(PSTR("G28"));
|
queue.inject_P(G28_STR);
|
||||||
break;
|
break;
|
||||||
case ID_H_X:
|
case ID_H_X:
|
||||||
queue.inject_P(PSTR("G28 X0"));
|
queue.inject_P(PSTR("G28X"));
|
||||||
break;
|
break;
|
||||||
case ID_H_Y:
|
case ID_H_Y:
|
||||||
queue.inject_P(PSTR("G28 Y0"));
|
queue.inject_P(PSTR("G28Y"));
|
||||||
break;
|
break;
|
||||||
case ID_H_Z:
|
case ID_H_Z:
|
||||||
queue.inject_P(PSTR("G28 Z0"));
|
queue.inject_P(PSTR("G28Z"));
|
||||||
break;
|
break;
|
||||||
case ID_H_OFF_ALL:
|
case ID_H_OFF_ALL:
|
||||||
queue.inject_P(PSTR("M84"));
|
queue.inject_P(PSTR("M84"));
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include "../../../../gcode/queue.h"
|
#include "../../../../gcode/queue.h"
|
||||||
#include "../../../../inc/MarlinConfig.h"
|
#include "../../../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
|
extern const char G28_STR[];
|
||||||
|
|
||||||
extern lv_group_t *g;
|
extern lv_group_t *g;
|
||||||
static lv_obj_t *scr;
|
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;
|
if (event != LV_EVENT_RELEASED) return;
|
||||||
|
|
||||||
switch (obj->mks_obj_id) {
|
switch (obj->mks_obj_id) {
|
||||||
case ID_M_POINT1:
|
case ID_M_POINT1 ... ID_M_POINT5:
|
||||||
if (queue.length == 0) {
|
if (queue.length == 0) {
|
||||||
if (uiCfg.leveling_first_time) {
|
if (uiCfg.leveling_first_time) {
|
||||||
queue.enqueue_now_P(PSTR("G28"));
|
uiCfg.leveling_first_time = false;
|
||||||
uiCfg.leveling_first_time = 0;
|
queue.inject_P(G28_STR);
|
||||||
}
|
}
|
||||||
queue.enqueue_now_P(PSTR("G1 Z10"));
|
const int ind = obj->mks_obj_id - ID_M_POINT1;
|
||||||
sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), (int)gCfgItems.levelingPos[0][0], (int)gCfgItems.levelingPos[0][1]);
|
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.enqueue_one_now(public_buf_l);
|
queue.inject(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:
|
|
||||||
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[4][0], (int)gCfgItems.levelingPos[4][1]);
|
|
||||||
queue.enqueue_one_now(public_buf_l);
|
|
||||||
queue.enqueue_now_P(PSTR("G1 Z0"));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_MANUAL_RETURN:
|
case ID_MANUAL_RETURN:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user