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
 
280
 
281
       #if E_STEPPERS
281
       #if E_STEPPERS
282
         case E_AXIS: {
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
           if (target_e_stepper < 0) return;
284
           if (target_e_stepper < 0) return;
285
           switch (target_e_stepper) {
285
           switch (target_e_stepper) {
286
             #if AXIS_IS_L64XX(E0)
286
             #if AXIS_IS_L64XX(E0)

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

133
  */
133
  */
134
 void GcodeSuite::M569() {
134
 void GcodeSuite::M569() {
135
   if (parser.seen('S'))
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
   else
137
   else
138
     say_stealth_status();
138
     say_stealth_status();
139
 }
139
 }

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

104
 
104
 
105
       #if E_STEPPERS
105
       #if E_STEPPERS
106
         case E_AXIS: {
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
           if (target_e_stepper < 0) return;
108
           if (target_e_stepper < 0) return;
109
           switch (target_e_stepper) {
109
           switch (target_e_stepper) {
110
             #if AXIS_IS_TMC(E0)
110
             #if AXIS_IS_TMC(E0)

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

268
           break;
268
           break;
269
         #if E_STEPPERS
269
         #if E_STEPPERS
270
           case E_AXIS: {
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
             if (target_e_stepper < 0) return;
272
             if (target_e_stepper < 0) return;
273
             switch (target_e_stepper) {
273
             switch (target_e_stepper) {
274
               TERN_(E0_HAS_STEALTHCHOP, case 0: TMC_SET_PWMTHRS_E(0); break;)
274
               TERN_(E0_HAS_STEALTHCHOP, case 0: TMC_SET_PWMTHRS_E(0); break;)

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

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
   if (WITHIN(e, 0, E_STEPPERS - 1)) return e;
146
   if (WITHIN(e, 0, E_STEPPERS - 1)) return e;
146
 
147
 
147
   SERIAL_ECHO_START();
148
   SERIAL_ECHO_START();

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

390
   static void say_units();
390
   static void say_units();
391
 
391
 
392
   static int8_t get_target_extruder_from_command();
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
   static void get_destination_from_command();
394
   static void get_destination_from_command();
395
 
395
 
396
   static void process_parsed_command(const bool no_ok=false);
396
   static void process_parsed_command(const bool no_ok=false);

Loading…
Cancel
Save