Handle disabled HYBRID_THRESHOLD in EEPROM (#10274)

This commit is contained in:
MoellerDi 2018-04-01 23:58:30 +02:00 committed by Scott Lahteine
parent 885ad70c8b
commit 6b150bfc40

View File

@ -747,7 +747,7 @@ void MarlinSettings::postprocess() {
_FIELD_TEST(tmc_hybrid_threshold); _FIELD_TEST(tmc_hybrid_threshold);
uint32_t tmc_hybrid_threshold[TMC_AXES] = { uint32_t tmc_hybrid_threshold[TMC_AXES] = {
#if HAS_TRINAMIC #if ENABLED(HYBRID_THRESHOLD)
#if X_IS_TRINAMIC #if X_IS_TRINAMIC
TMC_GET_PWMTHRS(X, X), TMC_GET_PWMTHRS(X, X),
#else #else
@ -1339,7 +1339,7 @@ void MarlinSettings::postprocess() {
for (uint8_t q=TMC_AXES; q--;) EEPROM_READ(val); for (uint8_t q=TMC_AXES; q--;) EEPROM_READ(val);
#endif #endif
#if HAS_TRINAMIC #if ENABLED(HYBRID_THRESHOLD)
#define TMC_SET_PWMTHRS(P,Q) tmc_set_pwmthrs(stepper##Q, TMC_##Q, tmc_hybrid_threshold[TMC_##Q], planner.axis_steps_per_mm[P##_AXIS]) #define TMC_SET_PWMTHRS(P,Q) tmc_set_pwmthrs(stepper##Q, TMC_##Q, tmc_hybrid_threshold[TMC_##Q], planner.axis_steps_per_mm[P##_AXIS])
uint32_t tmc_hybrid_threshold[TMC_AXES]; uint32_t tmc_hybrid_threshold[TMC_AXES];
EEPROM_READ(tmc_hybrid_threshold); EEPROM_READ(tmc_hybrid_threshold);
@ -1892,7 +1892,9 @@ void MarlinSettings::reset() {
#if HAS_TRINAMIC #if HAS_TRINAMIC
void say_M906() { SERIAL_ECHOPGM(" M906 "); } void say_M906() { SERIAL_ECHOPGM(" M906 "); }
void say_M913() { SERIAL_ECHOPGM(" M913 "); } #if ENABLED(HYBRID_THRESHOLD)
void say_M913() { SERIAL_ECHOPGM(" M913 "); }
#endif
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
void say_M914() { SERIAL_ECHOPGM(" M914 "); } void say_M914() { SERIAL_ECHOPGM(" M914 "); }
#endif #endif
@ -2425,56 +2427,58 @@ void MarlinSettings::reset() {
/** /**
* TMC2130 / TMC2208 / TRAMS Hybrid Threshold * TMC2130 / TMC2208 / TRAMS Hybrid Threshold
*/ */
if (!forReplay) { #if ENABLED(HYBRID_THRESHOLD)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM("Hybrid Threshold:");
}
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOLNPGM("Hybrid Threshold:"); #if X_IS_TRINAMIC
} say_M913();
CONFIG_ECHO_START; SERIAL_ECHOLNPAIR("X", TMC_GET_PWMTHRS(X, X));
#if X_IS_TRINAMIC #endif
say_M913(); #if X2_IS_TRINAMIC
SERIAL_ECHOLNPAIR("X", TMC_GET_PWMTHRS(X, X)); say_M913();
#endif SERIAL_ECHOLNPAIR("I1 X", TMC_GET_PWMTHRS(X, X2));
#if X2_IS_TRINAMIC #endif
say_M913(); #if Y_IS_TRINAMIC
SERIAL_ECHOLNPAIR("I1 X", TMC_GET_PWMTHRS(X, X2)); say_M913();
#endif SERIAL_ECHOLNPAIR("Y", TMC_GET_PWMTHRS(Y, Y));
#if Y_IS_TRINAMIC #endif
say_M913(); #if Y2_IS_TRINAMIC
SERIAL_ECHOLNPAIR("Y", TMC_GET_PWMTHRS(Y, Y)); say_M913();
#endif SERIAL_ECHOLNPAIR("I1 Y", TMC_GET_PWMTHRS(Y, Y2));
#if Y2_IS_TRINAMIC #endif
say_M913(); #if Z_IS_TRINAMIC
SERIAL_ECHOLNPAIR("I1 Y", TMC_GET_PWMTHRS(Y, Y2)); say_M913();
#endif SERIAL_ECHOLNPAIR("Z", TMC_GET_PWMTHRS(Z, Z));
#if Z_IS_TRINAMIC #endif
say_M913(); #if Z2_IS_TRINAMIC
SERIAL_ECHOLNPAIR("Z", TMC_GET_PWMTHRS(Z, Z)); say_M913();
#endif SERIAL_ECHOLNPAIR("I1 Z", TMC_GET_PWMTHRS(Z, Z2));
#if Z2_IS_TRINAMIC #endif
say_M913(); #if E0_IS_TRINAMIC
SERIAL_ECHOLNPAIR("I1 Z", TMC_GET_PWMTHRS(Z, Z2)); say_M913();
#endif SERIAL_ECHOLNPAIR("T0 E", TMC_GET_PWMTHRS(E, E0));
#if E0_IS_TRINAMIC #endif
say_M913(); #if E_STEPPERS > 1 && E1_IS_TRINAMIC
SERIAL_ECHOLNPAIR("T0 E", TMC_GET_PWMTHRS(E, E0)); say_M913();
#endif SERIAL_ECHOLNPAIR("T1 E", TMC_GET_PWMTHRS(E, E1));
#if E_STEPPERS > 1 && E1_IS_TRINAMIC #endif
say_M913(); #if E_STEPPERS > 2 && E2_IS_TRINAMIC
SERIAL_ECHOLNPAIR("T1 E", TMC_GET_PWMTHRS(E, E1)); say_M913();
#endif SERIAL_ECHOLNPAIR("T2 E", TMC_GET_PWMTHRS(E, E2));
#if E_STEPPERS > 2 && E2_IS_TRINAMIC #endif
say_M913(); #if E_STEPPERS > 3 && E3_IS_TRINAMIC
SERIAL_ECHOLNPAIR("T2 E", TMC_GET_PWMTHRS(E, E2)); say_M913();
#endif SERIAL_ECHOLNPAIR("T3 E", TMC_GET_PWMTHRS(E, E3));
#if E_STEPPERS > 3 && E3_IS_TRINAMIC #endif
say_M913(); #if E_STEPPERS > 4 && E4_IS_TRINAMIC
SERIAL_ECHOLNPAIR("T3 E", TMC_GET_PWMTHRS(E, E3)); say_M913();
#endif SERIAL_ECHOLNPAIR("T4 E", TMC_GET_PWMTHRS(E, E4));
#if E_STEPPERS > 4 && E4_IS_TRINAMIC #endif
say_M913(); SERIAL_EOL();
SERIAL_ECHOLNPAIR("T4 E", TMC_GET_PWMTHRS(E, E4)); #endif // HYBRID_THRESHOLD
#endif
SERIAL_EOL();
/** /**
* TMC2130 Sensorless homing thresholds * TMC2130 Sensorless homing thresholds