|
|
@ -80,46 +80,102 @@ void GcodeSuite::M912() { |
|
|
|
*/ |
|
|
|
#if ENABLED(HYBRID_THRESHOLD) |
|
|
|
void GcodeSuite::M913() { |
|
|
|
uint16_t values[XYZE]; |
|
|
|
LOOP_XYZE(i) values[i] = parser.intval(axis_codes[i]); |
|
|
|
#define TMC_SAY_PWMTHRS(P,Q) tmc_get_pwmthrs(stepper##Q, TMC_##Q, planner.axis_steps_per_mm[P##_AXIS]) |
|
|
|
#define TMC_SET_PWMTHRS(P,Q) tmc_set_pwmthrs(stepper##Q, TMC_##Q, value, planner.axis_steps_per_mm[P##_AXIS]) |
|
|
|
#define TMC_SAY_PWMTHRS_E(E) do{ const uint8_t extruder = E; tmc_get_pwmthrs(stepperE##E, TMC_E##E, planner.axis_steps_per_mm[E_AXIS_N]); }while(0) |
|
|
|
#define TMC_SET_PWMTHRS_E(E) do{ const uint8_t extruder = E; tmc_set_pwmthrs(stepperE##E, TMC_E##E, value, planner.axis_steps_per_mm[E_AXIS_N]); }while(0) |
|
|
|
|
|
|
|
#define TMC_SET_GET_PWMTHRS(P,Q) do { \ |
|
|
|
if (values[P##_AXIS]) tmc_set_pwmthrs(stepper##Q, TMC_##Q, values[P##_AXIS], planner.axis_steps_per_mm[P##_AXIS]); \ |
|
|
|
else tmc_get_pwmthrs(stepper##Q, TMC_##Q, planner.axis_steps_per_mm[P##_AXIS]); } while(0) |
|
|
|
bool report = true; |
|
|
|
LOOP_XYZE(i) if (int32_t value = parser.longval(axis_codes[i])) { |
|
|
|
report = false; |
|
|
|
switch (i) { |
|
|
|
case X_AXIS: |
|
|
|
#if X_IS_TRINAMIC |
|
|
|
TMC_SET_PWMTHRS(X,X); |
|
|
|
#endif |
|
|
|
#if X2_IS_TRINAMIC |
|
|
|
TMC_SET_PWMTHRS(X,X2); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
case Y_AXIS: |
|
|
|
#if Y_IS_TRINAMIC |
|
|
|
TMC_SET_PWMTHRS(Y,Y); |
|
|
|
#endif |
|
|
|
#if Y2_IS_TRINAMIC |
|
|
|
TMC_SET_PWMTHRS(Y,Y2); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
case Z_AXIS: |
|
|
|
#if Z_IS_TRINAMIC |
|
|
|
TMC_SET_PWMTHRS(Z,Z); |
|
|
|
#endif |
|
|
|
#if Z2_IS_TRINAMIC |
|
|
|
TMC_SET_PWMTHRS(Z,Z2); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
case E_AXIS: |
|
|
|
#if E0_IS_TRINAMIC |
|
|
|
TMC_SET_PWMTHRS_E(0); |
|
|
|
#endif |
|
|
|
#if E1_IS_TRINAMIC |
|
|
|
TMC_SET_PWMTHRS_E(1); |
|
|
|
#endif |
|
|
|
#if E2_IS_TRINAMIC |
|
|
|
TMC_SET_PWMTHRS_E(2); |
|
|
|
#endif |
|
|
|
#if E3_IS_TRINAMIC |
|
|
|
TMC_SET_PWMTHRS_E(3); |
|
|
|
#endif |
|
|
|
#if E4_IS_TRINAMIC |
|
|
|
TMC_SET_PWMTHRS_E(4); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if X_IS_TRINAMIC |
|
|
|
TMC_SET_GET_PWMTHRS(X,X); |
|
|
|
#endif |
|
|
|
#if X2_IS_TRINAMIC |
|
|
|
TMC_SET_GET_PWMTHRS(X,X2); |
|
|
|
#endif |
|
|
|
#if Y_IS_TRINAMIC |
|
|
|
TMC_SET_GET_PWMTHRS(Y,Y); |
|
|
|
#endif |
|
|
|
#if Y2_IS_TRINAMIC |
|
|
|
TMC_SET_GET_PWMTHRS(Y,Y2); |
|
|
|
#endif |
|
|
|
#if Z_IS_TRINAMIC |
|
|
|
TMC_SET_GET_PWMTHRS(Z,Z); |
|
|
|
#endif |
|
|
|
#if Z2_IS_TRINAMIC |
|
|
|
TMC_SET_GET_PWMTHRS(Z,Z2); |
|
|
|
#endif |
|
|
|
#if E0_IS_TRINAMIC |
|
|
|
TMC_SET_GET_PWMTHRS(E,E0); |
|
|
|
#endif |
|
|
|
#if E1_IS_TRINAMIC |
|
|
|
TMC_SET_GET_PWMTHRS(E,E1); |
|
|
|
#endif |
|
|
|
#if E2_IS_TRINAMIC |
|
|
|
TMC_SET_GET_PWMTHRS(E,E2); |
|
|
|
#endif |
|
|
|
#if E3_IS_TRINAMIC |
|
|
|
TMC_SET_GET_PWMTHRS(E,E3); |
|
|
|
#endif |
|
|
|
#if E4_IS_TRINAMIC |
|
|
|
TMC_SET_GET_PWMTHRS(E,E4); |
|
|
|
#endif |
|
|
|
if (report) LOOP_XYZE(i) switch (i) { |
|
|
|
case X_AXIS: |
|
|
|
#if X_IS_TRINAMIC |
|
|
|
TMC_SAY_PWMTHRS(X,X); |
|
|
|
#endif |
|
|
|
#if X2_IS_TRINAMIC |
|
|
|
TMC_SAY_PWMTHRS(X,X2); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
case Y_AXIS: |
|
|
|
#if Y_IS_TRINAMIC |
|
|
|
TMC_SAY_PWMTHRS(Y,Y); |
|
|
|
#endif |
|
|
|
#if Y2_IS_TRINAMIC |
|
|
|
TMC_SAY_PWMTHRS(Y,Y2); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
case Z_AXIS: |
|
|
|
#if Z_IS_TRINAMIC |
|
|
|
TMC_SAY_PWMTHRS(Z,Z); |
|
|
|
#endif |
|
|
|
#if Z2_IS_TRINAMIC |
|
|
|
TMC_SAY_PWMTHRS(Z,Z2); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
case E_AXIS: |
|
|
|
#if E0_IS_TRINAMIC |
|
|
|
TMC_SAY_PWMTHRS_E(0); |
|
|
|
#endif |
|
|
|
#if E1_IS_TRINAMIC |
|
|
|
TMC_SAY_PWMTHRS_E(1); |
|
|
|
#endif |
|
|
|
#if E2_IS_TRINAMIC |
|
|
|
TMC_SAY_PWMTHRS_E(2); |
|
|
|
#endif |
|
|
|
#if E3_IS_TRINAMIC |
|
|
|
TMC_SAY_PWMTHRS_E(3); |
|
|
|
#endif |
|
|
|
#if E4_IS_TRINAMIC |
|
|
|
TMC_SAY_PWMTHRS_E(4); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif // HYBRID_THRESHOLD
|
|
|
|
|
|
|
@ -128,34 +184,67 @@ void GcodeSuite::M912() { |
|
|
|
*/ |
|
|
|
#if ENABLED(SENSORLESS_HOMING) |
|
|
|
void GcodeSuite::M914() { |
|
|
|
#define TMC_SET_GET_SGT(P,Q) do { \ |
|
|
|
if (parser.seen(axis_codes[P##_AXIS])) tmc_set_sgt(stepper##Q, TMC_##Q, parser.value_int()); \ |
|
|
|
else tmc_get_sgt(stepper##Q, TMC_##Q); } while(0) |
|
|
|
|
|
|
|
#ifdef X_HOMING_SENSITIVITY |
|
|
|
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) |
|
|
|
TMC_SET_GET_SGT(X,X); |
|
|
|
#endif |
|
|
|
#if ENABLED(X2_IS_TMC2130) |
|
|
|
TMC_SET_GET_SGT(X,X2); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#ifdef Y_HOMING_SENSITIVITY |
|
|
|
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS) |
|
|
|
TMC_SET_GET_SGT(Y,Y); |
|
|
|
#endif |
|
|
|
#if ENABLED(Y2_IS_TMC2130) |
|
|
|
TMC_SET_GET_SGT(Y,Y2); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#ifdef Z_HOMING_SENSITIVITY |
|
|
|
#if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS) |
|
|
|
TMC_SET_GET_SGT(Z,Z); |
|
|
|
#endif |
|
|
|
#if ENABLED(Z2_IS_TMC2130) |
|
|
|
TMC_SET_GET_SGT(Z,Z2); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#define TMC_SAY_SGT(Q) tmc_get_sgt(stepper##Q, TMC_##Q) |
|
|
|
#define TMC_SET_SGT(Q) tmc_set_sgt(stepper##Q, TMC_##Q, value) |
|
|
|
|
|
|
|
bool report = true; |
|
|
|
LOOP_XYZ(i) if (parser.seen(axis_codes[i])) { |
|
|
|
const int8_t value = (int8_t)constrain(parser.value_int(), -63, 64); |
|
|
|
report = false; |
|
|
|
switch (i) { |
|
|
|
case X_AXIS: |
|
|
|
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) |
|
|
|
TMC_SET_SGT(X); |
|
|
|
#endif |
|
|
|
#if ENABLED(X2_IS_TMC2130) |
|
|
|
TMC_SET_SGT(X2); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
case Y_AXIS: |
|
|
|
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS) |
|
|
|
TMC_SET_SGT(Y); |
|
|
|
#endif |
|
|
|
#if ENABLED(Y2_IS_TMC2130) |
|
|
|
TMC_SET_SGT(Y2); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
case Z_AXIS: |
|
|
|
#if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS) |
|
|
|
TMC_SET_SGT(Z); |
|
|
|
#endif |
|
|
|
#if ENABLED(Z2_IS_TMC2130) |
|
|
|
TMC_SET_SGT(Z2); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (report) LOOP_XYZ(i) switch (i) { |
|
|
|
case X_AXIS: |
|
|
|
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) |
|
|
|
TMC_SAY_SGT(X); |
|
|
|
#endif |
|
|
|
#if ENABLED(X2_IS_TMC2130) |
|
|
|
TMC_SAY_SGT(X2); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
case Y_AXIS: |
|
|
|
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS) |
|
|
|
TMC_SAY_SGT(Y); |
|
|
|
#endif |
|
|
|
#if ENABLED(Y2_IS_TMC2130) |
|
|
|
TMC_SAY_SGT(Y2); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
case Z_AXIS: |
|
|
|
#if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS) |
|
|
|
TMC_SAY_SGT(Z); |
|
|
|
#endif |
|
|
|
#if ENABLED(Z2_IS_TMC2130) |
|
|
|
TMC_SAY_SGT(Z2); |
|
|
|
#endif |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif // SENSORLESS_HOMING
|
|
|
|
|
|
|
|