🐛 Fix "no T param" handling

This commit is contained in:
Scott Lahteine
2021-12-31 01:43:25 -06:00
parent c1410020ab
commit ff46d7cae2
5 changed files with 5 additions and 4 deletions

View File

@@ -285,7 +285,7 @@ void GcodeSuite::M906() {
#if E_STEPPERS #if E_STEPPERS
case E_AXIS: { case E_AXIS: {
const int8_t eindex = get_target_e_stepper_from_command(); const int8_t eindex = get_target_e_stepper_from_command(-2);
#if AXIS_IS_L64XX(E0) #if AXIS_IS_L64XX(E0)
if (eindex < 0 || eindex == 0) L6470_SET_KVAL_HOLD(E0); if (eindex < 0 || eindex == 0) L6470_SET_KVAL_HOLD(E0);
#endif #endif

View File

@@ -134,7 +134,7 @@ static void say_stealth_status() {
*/ */
void GcodeSuite::M569() { void GcodeSuite::M569() {
if (parser.seen('S')) 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(-2));
else else
say_stealth_status(); say_stealth_status();
} }

View File

@@ -112,7 +112,7 @@ void GcodeSuite::M906() {
#if E_STEPPERS #if E_STEPPERS
case E_AXIS: { case E_AXIS: {
const int8_t eindex = get_target_e_stepper_from_command(); const int8_t eindex = get_target_e_stepper_from_command(-2);
#if AXIS_IS_TMC(E0) #if AXIS_IS_TMC(E0)
if (eindex < 0 || eindex == 0) TMC_SET_CURRENT(E0); if (eindex < 0 || eindex == 0) TMC_SET_CURRENT(E0);
#endif #endif

View File

@@ -291,7 +291,7 @@
break; break;
#if E_STEPPERS #if E_STEPPERS
case E_AXIS: { case E_AXIS: {
const int8_t eindex = get_target_e_stepper_from_command(); const int8_t eindex = get_target_e_stepper_from_command(-2);
TERN_(E0_HAS_STEALTHCHOP, if (eindex < 0 || eindex == 0) TMC_SET_PWMTHRS_E(0)); TERN_(E0_HAS_STEALTHCHOP, if (eindex < 0 || eindex == 0) TMC_SET_PWMTHRS_E(0));
TERN_(E1_HAS_STEALTHCHOP, if (eindex < 0 || eindex == 1) TMC_SET_PWMTHRS_E(1)); TERN_(E1_HAS_STEALTHCHOP, if (eindex < 0 || eindex == 1) TMC_SET_PWMTHRS_E(1));
TERN_(E2_HAS_STEALTHCHOP, if (eindex < 0 || eindex == 2) TMC_SET_PWMTHRS_E(2)); TERN_(E2_HAS_STEALTHCHOP, if (eindex < 0 || eindex == 2) TMC_SET_PWMTHRS_E(2));

View File

@@ -148,6 +148,7 @@ int8_t GcodeSuite::get_target_extruder_from_command() {
int8_t GcodeSuite::get_target_e_stepper_from_command(const int8_t dval/*=-1*/) { int8_t GcodeSuite::get_target_e_stepper_from_command(const int8_t dval/*=-1*/) {
const int8_t e = parser.intval('T', dval); const int8_t e = parser.intval('T', dval);
if (WITHIN(e, 0, E_STEPPERS - 1)) return e; if (WITHIN(e, 0, E_STEPPERS - 1)) return e;
if (dval == -2) return dval;
SERIAL_ECHO_START(); SERIAL_ECHO_START();
SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum); SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);