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