Use float to init TMC2133 steps-per-mm

This commit is contained in:
Scott Lahteine 2017-08-05 02:33:20 -05:00
parent dd66d21749
commit a7e5c1bf19

View File

@ -171,7 +171,7 @@
// Use internal reference voltage for current calculations. This is the default. // Use internal reference voltage for current calculations. This is the default.
// Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609) // Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609)
// https://www.trinamic.com/products/integrated-circuits/details/tmc2130/ // https://www.trinamic.com/products/integrated-circuits/details/tmc2130/
void tmc2130_init(TMC2130Stepper &st, const uint16_t microsteps, const uint32_t thrs, const uint32_t spmm) { void tmc2130_init(TMC2130Stepper &st, const uint16_t microsteps, const uint32_t thrs, const float &spmm) {
st.begin(); st.begin();
st.setCurrent(st.getCurrent(), R_SENSE, HOLD_MULTIPLIER); st.setCurrent(st.getCurrent(), R_SENSE, HOLD_MULTIPLIER);
st.microsteps(microsteps); st.microsteps(microsteps);
@ -199,7 +199,7 @@
#define _TMC2130_INIT(ST, SPMM) tmc2130_init(stepper##ST, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM) #define _TMC2130_INIT(ST, SPMM) tmc2130_init(stepper##ST, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
void tmc2130_init() { void tmc2130_init() {
constexpr uint16_t steps_per_mm[] = DEFAULT_AXIS_STEPS_PER_UNIT; constexpr float steps_per_mm[] = DEFAULT_AXIS_STEPS_PER_UNIT;
#if ENABLED(X_IS_TMC2130) #if ENABLED(X_IS_TMC2130)
_TMC2130_INIT( X, steps_per_mm[X_AXIS]); _TMC2130_INIT( X, steps_per_mm[X_AXIS]);
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)