Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add STARTUP_SCRIPT option. M17 parity with M18. #14953

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
13 changes: 13 additions & 0 deletions Marlin/src/Marlin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ void enable_all_steppers() {
enable_E5();
}

void enable_e_steppers() {
enable_E0();
enable_E1();
enable_E2();
enable_E3();
enable_E4();
enable_E5();
}

void disable_e_steppers() {
disable_E0();
disable_E1();
Expand Down Expand Up @@ -1117,6 +1126,10 @@ void setup() {
init_closedloop();
#endif

#ifdef STARTUP_COMMANDS
queue.inject_P(PSTR(STARTUP_COMMANDS));
#endif

#if ENABLED(INIT_SDCARD_ON_BOOT) && !HAS_SPI_LCD
card.beginautostart();
#endif
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/Marlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ void manage_inactivity(const bool ignore_stepper_queue=false);
/**
* The axis order in all axis related arrays is X, Y, Z, E
*/
void enable_e_steppers();
void enable_all_steppers();
void disable_e_stepper(const uint8_t e);
void disable_e_steppers();
Expand Down
8 changes: 5 additions & 3 deletions Marlin/src/core/drivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@

#define AXIS_DRIVER_TYPE(A,T) AXIS_DRIVER_TYPE_##A(T)

#define HAS_E_DRIVER(T) ( AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \
|| AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \
|| AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )

#define HAS_DRIVER(T) ( AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) \
|| AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) \
|| AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) \
|| AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \
|| AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \
|| AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )
|| HAS_E_DRIVER(T) )

// Test for supported TMC drivers that require advanced configuration
// Does not match standalone configurations
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
planner.settings.retract_acceleration = saved_acceleration;
#endif

// Disable extruders steppers for manual filament changing (only on boards that have separate ENABLE_PINS)
#if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE_E0(TMC2660) || AXIS_DRIVER_TYPE_E1(TMC2660) || AXIS_DRIVER_TYPE_E2(TMC2660) || AXIS_DRIVER_TYPE_E3(TMC2660) || AXIS_DRIVER_TYPE_E4(TMC2660) || AXIS_DRIVER_TYPE_E5(TMC2660)
// Disable E steppers for manual change
#if HAS_E_STEPPER_ENABLE
disable_e_stepper(active_extruder);
safe_delay(100);
#endif
Expand Down
27 changes: 17 additions & 10 deletions Marlin/src/gcode/control/M17_M18_M84.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,21 @@
#endif

/**
* M17: Enable power on all stepper motors
* M17: Enable stepper motors
*/
void GcodeSuite::M17() {
LCD_MESSAGEPGM(MSG_NO_MOVE);
enable_all_steppers();
if (parser.seen("XYZE")) {
if (parser.seen('X')) enable_X();
if (parser.seen('Y')) enable_Y();
if (parser.seen('Z')) enable_Z();
#if HAS_E_STEPPER_ENABLE
if (parser.seen('E')) enable_e_steppers();
#endif
}
else {
LCD_MESSAGEPGM(MSG_NO_MOVE);
enable_all_steppers();
}
thinkyhead marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand All @@ -45,20 +55,17 @@ void GcodeSuite::M18_M84() {
stepper_inactive_time = parser.value_millis_from_seconds();
}
else {
bool all_axis = !(parser.seen('X') || parser.seen('Y') || parser.seen('Z') || parser.seen('E'));
if (all_axis) {
planner.finish_and_disable();
}
else {
if (parser.seen("XYZE")) {
planner.synchronize();
if (parser.seen('X')) disable_X();
if (parser.seen('Y')) disable_Y();
if (parser.seen('Z')) disable_Z();
// Only disable on boards that have separate ENABLE_PINS or another method for disabling the driver
#if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE_E0(TMC2660) || AXIS_DRIVER_TYPE_E1(TMC2660) || AXIS_DRIVER_TYPE_E2(TMC2660) || AXIS_DRIVER_TYPE_E3(TMC2660) || AXIS_DRIVER_TYPE_E4(TMC2660) || AXIS_DRIVER_TYPE_E5(TMC2660)
#if HAS_E_STEPPER_ENABLE
if (parser.seen('E')) disable_e_steppers();
#endif
}
else
planner.finish_and_disable();

#if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) {
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,11 @@
#endif
#endif

#define HAS_E_STEPPER_ENABLE (HAS_E_DRIVER(TMC2660) \
|| ( E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != X_ENABLE_PIN \
&& E0_ENABLE_PIN != Y_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN ) \
)

// Endstops and bed probe
#define _HAS_STOP(A,M) (PIN_EXISTS(A##_##M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_OR_PROBE(A,M))
#define HAS_X_MIN _HAS_STOP(X,MIN)
Expand Down
2 changes: 0 additions & 2 deletions Marlin/src/libs/L6470/L6470_Marlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
#define L6470_ERROR_MASK (STATUS_UVLO | STATUS_TH_WRN | STATUS_TH_SD | STATUS_OCD | STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B)
#define dSPIN_STEP_CLOCK_FWD dSPIN_STEP_CLOCK
#define dSPIN_STEP_CLOCK_REV dSPIN_STEP_CLOCK+1
#define HAS_L6470_EXTRUDER ( AXIS_DRIVER_TYPE_E0(L6470) || AXIS_DRIVER_TYPE_E1(L6470) || AXIS_DRIVER_TYPE_E2(L6470) \
|| AXIS_DRIVER_TYPE_E3(L6470) || AXIS_DRIVER_TYPE_E4(L6470) || AXIS_DRIVER_TYPE_E5(L6470) )

class L6470_Marlin {
public:
Expand Down
7 changes: 7 additions & 0 deletions config/default/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/3DFabXYZ/Migbot/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/AlephObjects/TAZ4/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/Alfawise/U20/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2306,6 +2306,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/AliExpress/UM2pExt/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2305,6 +2305,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/Anet/A2/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/Anet/A2plus/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/Anet/A6/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/Anet/A8/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/Anet/A8plus/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/Anet/E16/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/AnyCubic/i3/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/ArmEd/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2307,6 +2307,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/BIBO/TouchX/cyclops/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/BIBO/TouchX/default/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/BQ/Hephestos/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
7 changes: 7 additions & 0 deletions config/examples/BQ/Hephestos_2/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2311,6 +2311,13 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif

/**
* Startup commands
*
* Execute certain G-code commands immediately after power-on.
*/
//#define STARTUP_COMMANDS "M17 Z"

/**
* G-code Macros
*
Expand Down
Loading