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

M569, M906 and M913 should default to E0 when T not specified #23020

Merged
merged 2 commits into from
Oct 25, 2021
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
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/L6470/M906.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void GcodeSuite::M906() {

#if E_STEPPERS
case E_AXIS: {
const int8_t target_e_stepper = get_target_e_stepper_from_command();
const int8_t target_e_stepper = get_target_e_stepper_from_command(0);
if (target_e_stepper < 0) return;
switch (target_e_stepper) {
#if AXIS_IS_L64XX(E0)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/trinamic/M569.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static void say_stealth_status() {
*/
void GcodeSuite::M569() {
if (parser.seen('S'))
set_stealth_status(parser.value_bool(), get_target_e_stepper_from_command());
set_stealth_status(parser.value_bool(), get_target_e_stepper_from_command(0));
else
say_stealth_status();
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/trinamic/M906.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void GcodeSuite::M906() {

#if E_STEPPERS
case E_AXIS: {
const int8_t target_e_stepper = get_target_e_stepper_from_command();
const int8_t target_e_stepper = get_target_e_stepper_from_command(0);
if (target_e_stepper < 0) return;
switch (target_e_stepper) {
#if AXIS_IS_TMC(E0)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/trinamic/M911-M914.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
break;
#if E_STEPPERS
case E_AXIS: {
const int8_t target_e_stepper = get_target_e_stepper_from_command();
const int8_t target_e_stepper = get_target_e_stepper_from_command(0);
if (target_e_stepper < 0) return;
switch (target_e_stepper) {
TERN_(E0_HAS_STEALTHCHOP, case 0: TMC_SET_PWMTHRS_E(0); break;)
Expand Down
9 changes: 5 additions & 4 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ int8_t GcodeSuite::get_target_extruder_from_command() {
}

/**
* Get the target e stepper from the T parameter
* Return -1 if the T parameter is out of range or unspecified
* Get the target E stepper from the 'T' parameter.
* If there is no 'T' parameter then dval will be substituted.
* Returns -1 if the resulting E stepper index is out of range.
*/
int8_t GcodeSuite::get_target_e_stepper_from_command() {
const int8_t e = parser.intval('T', -1);
int8_t GcodeSuite::get_target_e_stepper_from_command(const int8_t dval/*=-1*/) {
const int8_t e = parser.intval('T', dval);
if (WITHIN(e, 0, E_STEPPERS - 1)) return e;

SERIAL_ECHO_START();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class GcodeSuite {
static void say_units();

static int8_t get_target_extruder_from_command();
static int8_t get_target_e_stepper_from_command();
static int8_t get_target_e_stepper_from_command(const int8_t dval=-1);
static void get_destination_from_command();

static void process_parsed_command(const bool no_ok=false);
Expand Down