|
@@ -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
|