"disable_z()" for Delta PSU III
stealthChop set if motor-disable (@ Z) required
This commit is contained in:
parent
17a534e42b
commit
4b1fc69088
3 changed files with 46 additions and 24 deletions
|
@ -173,9 +173,13 @@ void manage_inactivity(bool ignore_stepper_queue=false);
|
|||
#endif
|
||||
|
||||
#ifdef PSU_Delta
|
||||
void init_force_z();
|
||||
#undef disable_z()
|
||||
#define disable_z() disable_force_z()
|
||||
void disable_force_z();
|
||||
#undef enable_disable_z()
|
||||
#define enable_z() enable_force_z()
|
||||
void enable_force_z();
|
||||
#endif // PSU_Delta
|
||||
|
||||
|
||||
|
|
|
@ -9604,35 +9604,27 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|||
#define FIL_LOAD_LENGTH 60
|
||||
|
||||
#ifdef PSU_Delta
|
||||
bool bEnableForce_z;
|
||||
|
||||
void init_force_z()
|
||||
{
|
||||
WRITE(Z_ENABLE_PIN,Z_ENABLE_ON);
|
||||
bEnableForce_z=true; // "true"-value enforce "disable_force_z()" executing
|
||||
disable_force_z();
|
||||
}
|
||||
|
||||
void disable_force_z()
|
||||
{
|
||||
uint16_t z_microsteps=0;
|
||||
|
||||
if(PIN_INQ(Z_ENABLE_PIN)!=Z_ENABLE_ON)
|
||||
if(!bEnableForce_z)
|
||||
return; // motor already disabled (may be ;-p )
|
||||
bEnableForce_z=false;
|
||||
|
||||
// alignment to full-step
|
||||
#ifdef TMC2130
|
||||
z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS);
|
||||
#endif //TMC2130
|
||||
/*
|
||||
//planner_abort_hard();
|
||||
//sei();
|
||||
plan_buffer_line(
|
||||
current_position[X_AXIS]+10,
|
||||
current_position[Y_AXIS]+20,
|
||||
// current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/axis_steps_per_unit[Z_AXIS],
|
||||
current_position[Z_AXIS]+0.026, //0.025,
|
||||
current_position[E_AXIS],
|
||||
40, active_extruder);
|
||||
st_synchronize();
|
||||
z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS);
|
||||
MYSERIAL.println(z_microsteps,DEC);
|
||||
|
||||
MYSERIAL.println(current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS],DEC);
|
||||
MYSERIAL.println(current_position[Z_AXIS],DEC);
|
||||
MYSERIAL.println(z_microsteps,DEC);
|
||||
MYSERIAL.println(cs.axis_steps_per_unit[Z_AXIS],DEC);
|
||||
MYSERIAL.println(float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS],DEC);
|
||||
*/
|
||||
#endif // TMC2130
|
||||
planner_abort_hard();
|
||||
sei();
|
||||
plan_buffer_line(
|
||||
|
@ -9643,7 +9635,30 @@ plan_buffer_line(
|
|||
40, active_extruder);
|
||||
st_synchronize();
|
||||
|
||||
WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON);
|
||||
// switching to silent mode
|
||||
#ifdef TMC2130
|
||||
tmc2130_mode=TMC2130_MODE_SILENT;
|
||||
update_mode_profile();
|
||||
tmc2130_init();
|
||||
#endif // TMC2130
|
||||
|
||||
axis_known_position[Z_AXIS]=false;
|
||||
}
|
||||
|
||||
|
||||
void enable_force_z()
|
||||
{
|
||||
if(bEnableForce_z)
|
||||
return; // motor already enabled (may be ;-p )
|
||||
bEnableForce_z=true;
|
||||
|
||||
// mode recovering
|
||||
#ifdef TMC2130
|
||||
tmc2130_mode=eeprom_read_byte((uint8_t*)EEPROM_SILENT)?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL;
|
||||
update_mode_profile();
|
||||
tmc2130_init();
|
||||
#endif // TMC2130
|
||||
|
||||
WRITE(Z_ENABLE_PIN,Z_ENABLE_ON); // slightly redundant ;-p
|
||||
}
|
||||
#endif // PSU_Delta
|
||||
|
|
|
@ -1122,7 +1122,7 @@ void clear_current_adv_vars() {
|
|||
}
|
||||
|
||||
#endif // LIN_ADVANCE
|
||||
|
||||
|
||||
void st_init()
|
||||
{
|
||||
#ifdef TMC2130
|
||||
|
@ -1306,6 +1306,9 @@ void st_init()
|
|||
SET_OUTPUT(Z2_STEP_PIN);
|
||||
WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN);
|
||||
#endif
|
||||
#ifdef PSU_Delta
|
||||
init_force_z();
|
||||
#endif // PSU_Delta
|
||||
disable_z();
|
||||
#endif
|
||||
#if defined(E0_STEP_PIN) && (E0_STEP_PIN > -1)
|
||||
|
|
Loading…
Reference in a new issue