Browse Source

🚸 Default T0 for M569, M906, M913 (#23020)

tombrazier 2 years ago
parent
commit
73875cf9cc
No account linked to committer's email address

+ 1
- 1
Marlin/src/gcode/feature/L6470/M906.cpp View File

@@ -280,7 +280,7 @@ void GcodeSuite::M906() {
280 280
 
281 281
       #if E_STEPPERS
282 282
         case E_AXIS: {
283
-          const int8_t target_e_stepper = get_target_e_stepper_from_command();
283
+          const int8_t target_e_stepper = get_target_e_stepper_from_command(0);
284 284
           if (target_e_stepper < 0) return;
285 285
           switch (target_e_stepper) {
286 286
             #if AXIS_IS_L64XX(E0)

+ 1
- 1
Marlin/src/gcode/feature/trinamic/M569.cpp View File

@@ -133,7 +133,7 @@ static void say_stealth_status() {
133 133
  */
134 134
 void GcodeSuite::M569() {
135 135
   if (parser.seen('S'))
136
-    set_stealth_status(parser.value_bool(), get_target_e_stepper_from_command());
136
+    set_stealth_status(parser.value_bool(), get_target_e_stepper_from_command(0));
137 137
   else
138 138
     say_stealth_status();
139 139
 }

+ 1
- 1
Marlin/src/gcode/feature/trinamic/M906.cpp View File

@@ -104,7 +104,7 @@ void GcodeSuite::M906() {
104 104
 
105 105
       #if E_STEPPERS
106 106
         case E_AXIS: {
107
-          const int8_t target_e_stepper = get_target_e_stepper_from_command();
107
+          const int8_t target_e_stepper = get_target_e_stepper_from_command(0);
108 108
           if (target_e_stepper < 0) return;
109 109
           switch (target_e_stepper) {
110 110
             #if AXIS_IS_TMC(E0)

+ 1
- 1
Marlin/src/gcode/feature/trinamic/M911-M914.cpp View File

@@ -268,7 +268,7 @@
268 268
           break;
269 269
         #if E_STEPPERS
270 270
           case E_AXIS: {
271
-            const int8_t target_e_stepper = get_target_e_stepper_from_command();
271
+            const int8_t target_e_stepper = get_target_e_stepper_from_command(0);
272 272
             if (target_e_stepper < 0) return;
273 273
             switch (target_e_stepper) {
274 274
               TERN_(E0_HAS_STEALTHCHOP, case 0: TMC_SET_PWMTHRS_E(0); break;)

+ 5
- 4
Marlin/src/gcode/gcode.cpp View File

@@ -137,11 +137,12 @@ int8_t GcodeSuite::get_target_extruder_from_command() {
137 137
 }
138 138
 
139 139
 /**
140
- * Get the target e stepper from the T parameter
141
- * Return -1 if the T parameter is out of range or unspecified
140
+ * Get the target E stepper from the 'T' parameter.
141
+ * If there is no 'T' parameter then dval will be substituted.
142
+ * Returns -1 if the resulting E stepper index is out of range.
142 143
  */
143
-int8_t GcodeSuite::get_target_e_stepper_from_command() {
144
-  const int8_t e = parser.intval('T', -1);
144
+int8_t GcodeSuite::get_target_e_stepper_from_command(const int8_t dval/*=-1*/) {
145
+  const int8_t e = parser.intval('T', dval);
145 146
   if (WITHIN(e, 0, E_STEPPERS - 1)) return e;
146 147
 
147 148
   SERIAL_ECHO_START();

+ 1
- 1
Marlin/src/gcode/gcode.h View File

@@ -390,7 +390,7 @@ public:
390 390
   static void say_units();
391 391
 
392 392
   static int8_t get_target_extruder_from_command();
393
-  static int8_t get_target_e_stepper_from_command();
393
+  static int8_t get_target_e_stepper_from_command(const int8_t dval=-1);
394 394
   static void get_destination_from_command();
395 395
 
396 396
   static void process_parsed_command(const bool no_ok=false);

Loading…
Cancel
Save