Browse Source

Unify M91x parameter I meaning, simplify reports (#11249)

pull/1/head
Scott Lahteine 6 years ago
committed by GitHub
parent
commit
fd8a76493b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 76
      Marlin/src/gcode/feature/trinamic/M906.cpp
  2. 132
      Marlin/src/gcode/feature/trinamic/M911-M915.cpp

76
Marlin/src/gcode/feature/trinamic/M906.cpp

@ -88,48 +88,40 @@ void GcodeSuite::M906() {
} }
} }
if (report) LOOP_XYZE(i) switch (i) { if (report) {
case X_AXIS: #if X_IS_TRINAMIC
#if X_IS_TRINAMIC TMC_SAY_CURRENT(X);
TMC_SAY_CURRENT(X); #endif
#endif #if X2_IS_TRINAMIC
#if X2_IS_TRINAMIC TMC_SAY_CURRENT(X2);
TMC_SAY_CURRENT(X2); #endif
#endif #if Y_IS_TRINAMIC
break; TMC_SAY_CURRENT(Y);
case Y_AXIS: #endif
#if Y_IS_TRINAMIC #if Y2_IS_TRINAMIC
TMC_SAY_CURRENT(Y); TMC_SAY_CURRENT(Y2);
#endif #endif
#if Y2_IS_TRINAMIC #if Z_IS_TRINAMIC
TMC_SAY_CURRENT(Y2); TMC_SAY_CURRENT(Z);
#endif #endif
break; #if Z2_IS_TRINAMIC
case Z_AXIS: TMC_SAY_CURRENT(Z2);
#if Z_IS_TRINAMIC #endif
TMC_SAY_CURRENT(Z); #if E0_IS_TRINAMIC
#endif TMC_SAY_CURRENT(E0);
#if Z2_IS_TRINAMIC #endif
TMC_SAY_CURRENT(Z2); #if E1_IS_TRINAMIC
#endif TMC_SAY_CURRENT(E1);
break; #endif
case E_AXIS: #if E2_IS_TRINAMIC
#if E0_IS_TRINAMIC TMC_SAY_CURRENT(E2);
TMC_SAY_CURRENT(E0); #endif
#endif #if E3_IS_TRINAMIC
#if E1_IS_TRINAMIC TMC_SAY_CURRENT(E3);
TMC_SAY_CURRENT(E1); #endif
#endif #if E4_IS_TRINAMIC
#if E2_IS_TRINAMIC TMC_SAY_CURRENT(E4);
TMC_SAY_CURRENT(E2); #endif
#endif
#if E3_IS_TRINAMIC
TMC_SAY_CURRENT(E3);
#endif
#if E4_IS_TRINAMIC
TMC_SAY_CURRENT(E4);
#endif
break;
} }
} }

132
Marlin/src/gcode/feature/trinamic/M911-M915.cpp

@ -208,48 +208,40 @@ void GcodeSuite::M912() {
} }
} }
if (report) LOOP_XYZE(i) switch (i) { if (report) {
case X_AXIS: #if X_IS_TRINAMIC
#if X_IS_TRINAMIC TMC_SAY_PWMTHRS(X,X);
TMC_SAY_PWMTHRS(X,X); #endif
#endif #if X2_IS_TRINAMIC
#if X2_IS_TRINAMIC TMC_SAY_PWMTHRS(X,X2);
TMC_SAY_PWMTHRS(X,X2); #endif
#endif #if Y_IS_TRINAMIC
break; TMC_SAY_PWMTHRS(Y,Y);
case Y_AXIS: #endif
#if Y_IS_TRINAMIC #if Y2_IS_TRINAMIC
TMC_SAY_PWMTHRS(Y,Y); TMC_SAY_PWMTHRS(Y,Y2);
#endif #endif
#if Y2_IS_TRINAMIC #if Z_IS_TRINAMIC
TMC_SAY_PWMTHRS(Y,Y2); TMC_SAY_PWMTHRS(Z,Z);
#endif #endif
break; #if Z2_IS_TRINAMIC
case Z_AXIS: TMC_SAY_PWMTHRS(Z,Z2);
#if Z_IS_TRINAMIC #endif
TMC_SAY_PWMTHRS(Z,Z); #if E0_IS_TRINAMIC
#endif TMC_SAY_PWMTHRS_E(0);
#if Z2_IS_TRINAMIC #endif
TMC_SAY_PWMTHRS(Z,Z2); #if E_STEPPERS > 1 && E1_IS_TRINAMIC
#endif TMC_SAY_PWMTHRS_E(1);
break; #endif
case E_AXIS: #if E_STEPPERS > 2 && E2_IS_TRINAMIC
#if E0_IS_TRINAMIC TMC_SAY_PWMTHRS_E(2);
TMC_SAY_PWMTHRS_E(0); #endif
#endif #if E_STEPPERS > 3 && E3_IS_TRINAMIC
#if E_STEPPERS > 1 && E1_IS_TRINAMIC TMC_SAY_PWMTHRS_E(3);
TMC_SAY_PWMTHRS_E(1); #endif
#endif #if E_STEPPERS > 4 && E4_IS_TRINAMIC
#if E_STEPPERS > 2 && E2_IS_TRINAMIC TMC_SAY_PWMTHRS_E(4);
TMC_SAY_PWMTHRS_E(2); #endif
#endif
#if E_STEPPERS > 3 && E3_IS_TRINAMIC
TMC_SAY_PWMTHRS_E(3);
#endif
#if E_STEPPERS > 4 && E4_IS_TRINAMIC
TMC_SAY_PWMTHRS_E(4);
#endif
break;
} }
} }
#endif // HYBRID_THRESHOLD #endif // HYBRID_THRESHOLD
@ -271,66 +263,60 @@ void GcodeSuite::M912() {
#if X_SENSORLESS #if X_SENSORLESS
case X_AXIS: case X_AXIS:
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
if (index == 0) TMC_SET_SGT(X); if (index < 2) TMC_SET_SGT(X);
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if ENABLED(X2_IS_TMC2130)
if (index == 1) TMC_SET_SGT(X2); if (!(index & 1)) TMC_SET_SGT(X2);
#endif #endif
break; break;
#endif #endif
#if Y_SENSORLESS #if Y_SENSORLESS
case Y_AXIS: case Y_AXIS:
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS) #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
if (index == 0) TMC_SET_SGT(Y); if (index < 2) TMC_SET_SGT(Y);
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if ENABLED(Y2_IS_TMC2130)
if (index == 1) TMC_SET_SGT(Y2); if (!(index & 1)) TMC_SET_SGT(Y2);
#endif #endif
break; break;
#endif #endif
#if Z_SENSORLESS #if Z_SENSORLESS
case Z_AXIS: case Z_AXIS:
#if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS) #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
if (index == 0) TMC_SET_SGT(Z); if (index < 2) TMC_SET_SGT(Z);
#endif #endif
#if ENABLED(Z2_IS_TMC2130) #if ENABLED(Z2_IS_TMC2130)
if (index == 1) TMC_SET_SGT(Z2); if (!(index & 1)) TMC_SET_SGT(Z2);
#endif #endif
break; break;
#endif #endif
} }
} }
if (report) LOOP_XYZ(i) switch (i) { if (report) {
#if X_SENSORLESS #if X_SENSORLESS
case X_AXIS: #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) TMC_SAY_SGT(X);
TMC_SAY_SGT(X); #endif
#endif #if ENABLED(X2_IS_TMC2130)
#if ENABLED(X2_IS_TMC2130) TMC_SAY_SGT(X2);
TMC_SAY_SGT(X2); #endif
#endif
break;
#endif #endif
#if Y_SENSORLESS #if Y_SENSORLESS
case Y_AXIS: #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS) TMC_SAY_SGT(Y);
TMC_SAY_SGT(Y); #endif
#endif #if ENABLED(Y2_IS_TMC2130)
#if ENABLED(Y2_IS_TMC2130) TMC_SAY_SGT(Y2);
TMC_SAY_SGT(Y2); #endif
#endif
break;
#endif #endif
#if Z_SENSORLESS #if Z_SENSORLESS
case Z_AXIS: #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
#if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS) TMC_SAY_SGT(Z);
TMC_SAY_SGT(Z); #endif
#endif #if ENABLED(Z2_IS_TMC2130)
#if ENABLED(Z2_IS_TMC2130) TMC_SAY_SGT(Z2);
TMC_SAY_SGT(Z2); #endif
#endif
break;
#endif #endif
} }
} }

Loading…
Cancel
Save