Fixes to the way COOLSTEP was being implemented.

master
Marcio Teixeira 7 years ago
parent 198b138c91
commit c864f864ee

@ -13,7 +13,7 @@
* got disabled. * got disabled.
*/ */
#define LULZBOT_FW_VERSION ".44" // Change this with each update #define LULZBOT_FW_VERSION ".45" // Change this with each update
#if ( \ #if ( \
!defined(LULZBOT_Gladiola_Mini) && \ !defined(LULZBOT_Gladiola_Mini) && \
@ -648,7 +648,12 @@
#define LULZBOT_TOOLHEAD_WIPE_X2_ADJ 0 #define LULZBOT_TOOLHEAD_WIPE_X2_ADJ 0
#define LULZBOT_TOOLHEAD_WIPE_Y1_ADJ 0 #define LULZBOT_TOOLHEAD_WIPE_Y1_ADJ 0
#define LULZBOT_TOOLHEAD_WIPE_Y2_ADJ 0 #define LULZBOT_TOOLHEAD_WIPE_Y2_ADJ 0
#if defined(LULZBOT_USE_EINSYRAMBO)
#define LULZBOT_MOTOR_CURRENT_E 960 // mA
#else
#define LULZBOT_MOTOR_CURRENT_E 1250 // mA #define LULZBOT_MOTOR_CURRENT_E 1250 // mA
#endif
#endif /* TOOLHEAD_Gladiola_SingleExtruder || TOOLHEAD_Albatross_Flexystruder || TOOLHEAD_Finch_Aerostruder */ #endif /* TOOLHEAD_Gladiola_SingleExtruder || TOOLHEAD_Albatross_Flexystruder || TOOLHEAD_Finch_Aerostruder */
#if defined(TOOLHEAD_Gladiola_SingleExtruder) #if defined(TOOLHEAD_Gladiola_SingleExtruder)
@ -1393,13 +1398,18 @@
LULZBOT_TMC_REPORT(Z) \ LULZBOT_TMC_REPORT(Z) \
LULZBOT_TMC_REPORT(E0) LULZBOT_TMC_REPORT(E0)
#define LULZBOT_ENABLE_COOLSTEP(st) \
/* Enable stallguard by disabling steathchop */ \
st.coolstep_min_speed(LULZBOT_COOLSTEP_MIN); \
st.stealthChop(0);
#define LULZBOT_ENABLE_STALLGUARD(st) \ #define LULZBOT_ENABLE_STALLGUARD(st) \
/* Enable stallguard by disabling steathchop */ \ /* Enable stallguard by disabling steathchop */ \
st.coolstep_min_speed(LULZBOT_COOLSTEP_DISABLED); \ st.coolstep_min_speed(LULZBOT_COOLSTEP_DISABLED); \
st.stealthChop(0); st.stealthChop(0);
#define LULZBOT_ENABLE_STEALTHCHOP(st) \ #define LULZBOT_ENABLE_STEALTHCHOP(st) \
st.coolstep_min_speed(0); \ st.coolstep_min_speed(LULZBOT_COOLSTEP_MIN); \
st.stealthChop(1); st.stealthChop(1);
#if defined(LULZBOT_USE_SERIES_Z_MOTORS) #if defined(LULZBOT_USE_SERIES_Z_MOTORS)
@ -1429,7 +1439,7 @@
/* Set Z homing sensitivity */ \ /* Set Z homing sensitivity */ \
stepperZ.sg_stall_value(LULZBOT_Z_HOMING_SENSITIVITY); \ stepperZ.sg_stall_value(LULZBOT_Z_HOMING_SENSITIVITY); \
/* Always disable STEALHCHOP on E0 */ \ /* Always disable STEALHCHOP on E0 */ \
LULZBOT_ENABLE_STALLGUARD(stepperE0) LULZBOT_ENABLE_COOLSTEP(stepperE0);
#define LULZBOT_TMC2130_ADV { \ #define LULZBOT_TMC2130_ADV { \
LULZBOT_MOTOR_INIT_XY \ LULZBOT_MOTOR_INIT_XY \
@ -1437,13 +1447,26 @@
LULZBOT_SENSORLESS_HOMING_Z_INIT \ LULZBOT_SENSORLESS_HOMING_Z_INIT \
} }
/* When STEALTHCHOP is disabled, sometimes the X axis refuses to #define LULZBOT_SENSORLESS_HOMING_ENABLE(st) \
* move at the start of G28, because the stallguard is triggered. /* Sometimes the X axis refuses to move at the start of G28, */ \
* Toggling in and out of STEALHCHOP mode seems to resolve this. */ /* because the stallguard is triggered. Toggling in and out */ \
#define LULZBOT_CLEAR_STALLGUARD_FLAG(st) \ /* of STEALHCHOP mode seems to resolve this. */ \
LULZBOT_ENABLE_STEALTHCHOP(st) \ LULZBOT_ENABLE_STEALTHCHOP(st) \
LULZBOT_ENABLE_STALLGUARD(st) LULZBOT_ENABLE_STALLGUARD(st)
#if defined(LULZBOT_STEALTHCHOP)
#define LULZBOT_SENSORLESS_HOMING_DISABLE(st) LULZBOT_ENABLE_STEALTHCHOP(st)
#else
#define LULZBOT_SENSORLESS_HOMING_DISABLE(st) LULZBOT_ENABLE_COOLSTEP(st)
#endif
#define LULZBOT_SENSORLESS_HOMING_TOGGLE(st, enable) \
if (enable) { \
LULZBOT_SENSORLESS_HOMING_ENABLE(st) \
} else { \
LULZBOT_SENSORLESS_HOMING_DISABLE(st) \
}
/* Leaving the toolhead resting on the endstops will likely cause /* Leaving the toolhead resting on the endstops will likely cause
* chatter if the machine is immediately re-homed, so don't leave * chatter if the machine is immediately re-homed, so don't leave
* the head sitting on the endstops after homing. */ * the head sitting on the endstops after homing. */

@ -2961,7 +2961,9 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
*/ */
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
void tmc2130_sensorless_homing(TMC2130Stepper &st, bool enable=true) { void tmc2130_sensorless_homing(TMC2130Stepper &st, bool enable=true) {
#if ENABLED(STEALTHCHOP) #if defined(LULZBOT_SENSORLESS_HOMING_TOGGLE)
LULZBOT_SENSORLESS_HOMING_TOGGLE(st, enable)
#elif ENABLED(STEALTHCHOP)
if (enable) { if (enable) {
st.coolstep_min_speed(1024UL * 1024UL - 1UL); st.coolstep_min_speed(1024UL * 1024UL - 1UL);
st.stealthChop(0); st.stealthChop(0);
@ -2970,8 +2972,6 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
st.coolstep_min_speed(0); st.coolstep_min_speed(0);
st.stealthChop(1); st.stealthChop(1);
} }
#else
LULZBOT_CLEAR_STALLGUARD_FLAG(st)
#endif #endif
st.diag1_stall(enable ? 1 : 0); st.diag1_stall(enable ? 1 : 0);
} }

Loading…
Cancel
Save